Release 7.5.4
[platform/core/system/dlog.git] / packaging / dlog.spec
1 %define _with_dlog_dynamic_filters on
2 %bcond_with dlog_dynamic_filters
3
4 Name:       dlog
5 Summary:    Logging service
6 Version:    7.5.4
7 Release:    1
8 Group:      System/Libraries
9 License:    Apache-2.0, MIT
10 Source0:    %{name}-%{version}.tar.gz
11 Source101:  packaging/dlog.manifest
12 Source501:  packaging/01-dlog.rules
13
14 # NOTE: hardcoded instead of a build dependency on libudev.
15 #       Needed to prevent a cyclic build dependency in case
16 #       dlog is used in a package dependent on libsystemd,
17 #       since libudev is a part of it
18 %define _udevrulesdir %{_prefix}/lib/udev/rules.d
19
20 BuildRequires: autoconf
21 BuildRequires: automake
22 BuildRequires: libtool
23 BuildRequires: pkgconfig(capi-base-common)
24 BuildRequires: pkgconfig(libtzplatform-config)
25 BuildRequires: linux-tizen-modules-headers
26 %if 0%{?gcov:1}
27 BuildRequires: lcov
28 BuildRequires: zip
29 %endif
30
31 Requires:      %{name}-config-persistent-logs
32 Obsoletes:     %{name}-common < 6.5.3
33
34 %description
35 Shared files between libdlog and service
36
37 %package -n libdlog
38 Summary:    dlog library APIs
39 License:    MIT
40 Group:      Development/Libraries
41 Requires(pre): coreutils
42 Requires(post): coreutils
43 Requires(post): /sbin/ldconfig
44 Requires(post): /usr/bin/chsmack
45 Requires(postun): /sbin/ldconfig
46 Requires: %{name} = %{version}-%{release}
47 Requires: %{name}-logger = %{version}-%{release}
48 Obsoletes: libdlogutil < 6.5.3
49 Obsoletes: libdlog-redirect-stdout < 6.5.3
50 %description -n libdlog
51 * libdlog - client API
52 * libdlogutil - log retrieval library
53 * libdlog_redirect_stdout - client library for attaching stdout/stderr
54
55 %package -n libdlog-devel
56 Summary:    Logging service dlog API
57 License:    MIT
58 Group:      Development/Libraries
59 Requires:   libdlog = %{version}-%{release}
60 Requires:   pkgconfig(capi-base-common)
61 Obsoletes:  libdlogutil-devel < 6.5.3
62 Obsoletes:  libdlog-redirect-stdout-devel < 6.5.3
63 %description -n libdlog-devel
64
65 %package    logger
66 Summary:    Logger service
67 License:    Apache-2.0
68 Group:      Development/Libraries
69 Requires:   %{name} = %{version}-%{release}
70 %description logger
71
72 %package -n dlogutil
73 Summary:    print log data to the screen
74 Group:      Development/Libraries
75 %description -n dlogutil
76
77 %package    config-backend-zero-copy
78 License:    Apache-2.0
79 Summary:    Force usage of zero-copy dlog backend
80 Group:      Base/Startup
81 %description config-backend-zero-copy
82 Provides dlog config to enable zero-copy backend and tunes libdlog
83 performance while sacrificing some of dlog features (static and
84 dynamic filtering)
85
86 %package config-syslog
87 License:    Apache-2.0
88 Summary:    Logger: syslog-source logging via dlog
89 Group:      Base/Startup
90 Provides:   tizen-log-syslog
91 %description config-syslog
92 Systemd unit for syslog socket configation to use with dlog
93
94 %package config-persistent-logs
95 Summary: enable persistent storage of logs
96 %description config-persistent-logs
97 Enable persistent logs in dlog (stored in /var/log/dlog/)
98
99 %package config-qos
100 Summary: enable quality of service module
101 %description config-qos
102 Enables Quality of Service module in dlog
103
104 %package doc
105 Summary: dlog documentation
106 BuildRequires: doxygen
107 %description doc
108 Documentation for dlog
109
110 %package tests
111 Summary: dlog integration tests
112 Requires: lib%{name} = %{version}-%{release}
113 Requires(post): /usr/bin/chsmack
114 %description tests
115 Integration tests for dlog.
116
117 %if 0%{?gcov:1}
118 %package gcov
119 Summary:  gcov files for libdlog
120 Group:    Development/Libraries
121 %description gcov
122 This package contains gcov code coverage/profiling files for libdlog.
123 %endif
124
125 %prep
126 %setup -q
127
128 %build
129 # TODO: Respect the defaults, and have all custom flags in one place
130 CFLAGS="-Wno-gnu-variable-sized-type-not-at-end -g"
131 TEST_CFLAGS="-Wno-gnu-variable-sized-type-not-at-end -Wno-logical-op-parentheses"
132
133 %if 0%{?gcov:1}
134 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
135 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
136 export LDFLAGS+=" -lgcov"
137 TEST_CFLAGS+=" -ftest-coverage"
138 %endif
139
140 %if 0%{?asan:1}
141 export CFLAGS+=" -DASAN_BUILD=True"
142 export CXXFLAGS+=" -DASAN_BUILD=True"
143 TEST_CFLAGS+=" -DASAN_BUILD=True"
144 %endif
145
146 cp %{SOURCE101} .
147
148 %autogen --disable-static
149 %configure --disable-static \
150 %if %{without dlog_dynamic_filters}
151 --disable-dynamic-filters
152 %else
153 --enable-dynamic-filters
154 %endif
155
156 make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
157
158 # autoconf adds a bunch of flags, including -O2.
159 # Clear those so that test coverage can be measured properly
160 CFLAGS="$TEST_CFLAGS"
161 make check CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
162
163 make dox
164
165 %if 0%{?gcov:1}
166 %check -n libdlog
167 lcov -c --ignore-errors graph --no-external -q -d ./src -o dlog.info
168 genhtml dlog.info -o dlog.out
169 zip -r dlog.zip dlog.out dlog.info
170 install -m 0644 dlog.zip %{buildroot}%{_datadir}/gcov/
171 %endif
172
173 %install
174 rm -rf %{buildroot}
175
176 %make_install
177 mkdir -p %{buildroot}/usr/bin/
178
179 mkdir -p %{buildroot}/usr/share/doc/dlog
180 cp -r documentation/* %{buildroot}/usr/share/doc/dlog
181
182 mkdir -p %{buildroot}%{_unitdir}/basic.target.wants/
183 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants/
184 ln -s ../dlog_logger.service %{buildroot}%{_unitdir}/basic.target.wants/dlog_logger.service
185 ln -s ../dlog_dev-log.socket %{buildroot}%{_unitdir}/sockets.target.wants/dlog_dev-log.socket
186
187 mkdir -p %{buildroot}%{_udevrulesdir}
188 install -m 0644 %SOURCE501 %{buildroot}%{_udevrulesdir}/01-dlog.rules
189
190 mkdir -p %{buildroot}/var/log/dlog
191
192 mkdir -p %{buildroot}/var/lib/dlog-tests
193 mkdir -p %{buildroot}/usr/share/dlog-filters.conf.test
194
195 %if %{without dlog_dynamic_filters}
196 rm -f %{buildroot}%{_bindir}/dlogctl
197 sed -i -e 's,^\(dynamic_config_path=\),#\1,g' -e 's,^\(limiter_apply_to_all_buffers=\),#\1,g' %{buildroot}%{_sysconfdir}/dlog.conf
198 %endif
199
200 %if 0%{?gcov:1}
201 builddir=$(basename $PWD)
202 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
203 mkdir -p "$gcno_obj_dir"
204 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
205 %endif
206
207 %files -n dlogutil
208 %manifest dlog.manifest
209 %license LICENSE.APACHE2.0 LICENSE.MIT
210 %attr(750,log,log) %{_bindir}/dlogutil
211 %attr(755,log,log) %{_bindir}/dlogsend
212 %attr(750,log,log) %{_bindir}/dlog_cleanup
213 %attr(750,log,log) %{_bindir}/dlogmetrics
214 %attr(755,log,log) %{_bindir}/dlog_redirect_stdout
215 %{_unitdir}/dlog_cleanup.service
216
217 %if %{with dlog_dynamic_filters}
218 %attr(750,log,log) %{_bindir}/dlogctl
219 %endif
220
221 %post -n dlogutil
222 %if %{with dlog_dynamic_filters}
223 chsmack %{_bindir}/dlogctl -a "System::Tools"
224 %endif
225
226 %post -n libdlog -p /sbin/ldconfig
227
228 %post
229 chsmack -a System /var/log/dlog
230 # set timestamp to beginning of the unix epoch to make rotation work even if we are run on system with no/broken rtc
231 touch -m -t 197001010000.01 /var/log/dlog/critical.a
232 touch -m -t 197001010000.00 /var/log/dlog/critical.b
233 chmod 660 /var/log/dlog/critical*
234 chown log:log /var/log/dlog/critical*
235 chsmack -e 'System' %{_libexecdir}/dlog-log-critical
236
237 %files
238 %manifest dlog.manifest
239 %license LICENSE.APACHE2.0
240 %{_sysconfdir}/dlog.conf
241 %{_sysconfdir}/dlog.conf.d/20-pipe.conf
242 %{_sysconfdir}/dlog.conf.d/25-logger.conf
243 # not in a separate package for debugging convenience
244 %{_sysconfdir}/dlog.conf.d/86-disable-dlog.conf_inactive
245 %attr(755,log,log) /var/log/dlog
246 %attr(2551,log,log) %{_libexecdir}/dlog-log-critical
247 /usr/lib/tmpfiles.d/dlog-run.conf
248 %{_udevrulesdir}/01-dlog.rules
249
250 %files -n libdlog
251 %manifest dlog.manifest
252 %license LICENSE.MIT
253 %{_libdir}/libdlog.so.0
254 %{_libdir}/libdlog.so.0.0.0
255 %{_libdir}/libdlogutil.so.*
256 %{_libdir}/libdlog_redirect_stdout.so.*
257
258 %files -n libdlog-devel
259 %manifest dlog.manifest
260 %license LICENSE.MIT
261 %{_includedir}/dlog/dlog.h
262 %{_includedir}/dlog/dlog-internal.h
263 %{_includedir}/dlog/dlogutil.h
264 %{_includedir}/dlog/dlog-redirect-stdout.h
265 %{_libdir}/libdlog.so
266 %{_libdir}/libdlogutil.so
267 %{_libdir}/libdlog_redirect_stdout.so
268 %{_libdir}/pkgconfig/dlog.pc
269 %{_libdir}/pkgconfig/dlogutil.pc
270 %{_libdir}/pkgconfig/dlog-redirect-stdout.pc
271
272 %files logger
273 %manifest dlog.manifest
274 %license LICENSE.APACHE2.0
275 %attr(750,log,log) %{_bindir}/dlog_logger
276 %{_unitdir}/basic.target.wants/dlog_logger.service
277 %{_unitdir}/dlog_logger.service
278 /usr/lib/systemd/system-generators/dlog-unit-generator
279
280 %files config-backend-zero-copy
281 %manifest dlog.manifest
282 %license LICENSE.APACHE2.0 LICENSE.MIT
283 /usr/lib/modules/modules-load.d/tizen-modules-dlog-zero-copy.conf
284 %{_sysconfdir}/dlog.conf.d/30-zero-copy.conf
285
286 %files config-syslog
287 %manifest dlog.manifest
288 %license LICENSE.APACHE2.0 LICENSE.MIT
289 %{_unitdir}/sockets.target.wants/dlog_dev-log.socket
290 %{_unitdir}/dlog_dev-log.socket
291
292 %files config-persistent-logs
293 %{_sysconfdir}/dlog.conf.d/10-persistent-logs.conf
294
295 %files config-qos
296 %{_sysconfdir}/dlog.conf.d/15-qos.conf
297
298 %files doc
299 %manifest dlog.manifest
300 %license LICENSE.APACHE2.0 LICENSE.MIT
301 /usr/share/doc/dlog
302
303 %files tests
304 %manifest dlog.manifest
305 %license LICENSE.APACHE2.0 LICENSE.MIT
306 %{_bindir}/dlog_test
307 %{_bindir}/dlog_test_header
308 %{_bindir}/dlog_cpu
309 /usr/share/doc/dlog/README.testsuite
310 %{_libexecdir}/libdlog/perf_libdlog
311 %{_libexecdir}/libdlog/dlog_stdout_benchmark
312 %{_libexecdir}/libdlog/dlog_compression_benchmark
313 %{_libexecdir}/libdlog/test_libdlog
314 %{_libexecdir}/libdlog/test_libdlogutil
315 %{_libexecdir}/libdlog/test_verifytime
316 %{_libexecdir}/libdlog/test_libredirect
317 %{_libexecdir}/libdlog/test_libredirect_multi
318 %{_libexecdir}/libdlog/test_filters
319 %{_datadir}/dlog-pipe.conf.test
320 %{_datadir}/dlog-logger.conf.test
321 %{_datadir}/dlog-zero-copy.conf.test
322 %{_datadir}/dlog-logger.conf.alias
323 %{_datadir}/dlog-pipe.conf.cpu
324 %{_datadir}/dlog-logger.conf.cpu
325 %{_datadir}/dlog-pipe.conf.qos
326 %{_datadir}/dlog-logger.conf.qos
327 %{_datadir}/dlog-pipe.conf.plog
328 %{_datadir}/dlog-logger.conf.plog
329 %{_datadir}/dlog-pipe.conf.autodetect
330 %{_datadir}/dlog-logger.conf.autodetect
331 %{_sysconfdir}/dlog.conf.d/99-dlog-logger.disable-platform-logging-for-testsuite.conf
332 %dir %attr(755,log,log) /var/lib/dlog-tests
333 %dir %attr(755,log,log) /usr/share/dlog-filters.conf.test
334
335 %post tests
336 chsmack -a System /var/lib/dlog-tests
337 echo "Warning! Installation of dlog-tests will break platform logging."
338 echo "This is done intentionally, to make logger and zero-copy backend testing possible."
339 echo "To restore normal behavior, please uninstall dlog-tests package."
340 echo ""
341 echo "For more information please read the /usr/share/doc/dlog/README.testsuite file"
342 echo ""
343 echo "A reboot is required to properly configure logger and zero-copy backend for testing."
344
345 %if 0%{?gcov:1}
346 %files gcov
347 %{_datadir}/gcov/*
348 %endif