Merge changes from topic "dlog-stdout-writer-03-2021" into tizen
[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:    6.5.0
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 Source502:  packaging/logger-devices.conf
14
15 # NOTE: hardcoded instead of a build dependency on libudev.
16 #       Needed to prevent a cyclic build dependency in case
17 #       dlog is used in a package dependent on libsystemd,
18 #       since libudev is a part of it
19 %define _udevrulesdir %{_prefix}/lib/udev/rules.d
20
21 BuildRequires: autoconf
22 BuildRequires: automake
23 BuildRequires: libcap-devel
24 BuildRequires: libtool
25 BuildRequires: pkgconfig(capi-base-common)
26 BuildRequires: pkgconfig(libtzplatform-config)
27 %if 0%{?gcov:1}
28 BuildRequires: lcov
29 BuildRequires: zip
30 %endif
31
32 %description
33 dlog API library
34
35 %package -n libdlog
36 Summary:    Logging service dlog API
37 License:    MIT
38 Group:      Development/Libraries
39 Requires(pre): coreutils
40 Requires(post): coreutils
41 Requires(post): /sbin/ldconfig
42 Requires(post): /usr/bin/chsmack
43 Requires(postun): /sbin/ldconfig
44 Requires: %{name}-config-persistent-logs
45 Requires: %{name}-common = %{version}-%{release}
46 Requires: %{name}-logger = %{version}-%{release}
47
48 %description -n libdlog
49 dlog API library. If dlog-config-backend-logger is not installed, pipe backend is selected.
50
51 %package -n libdlog-devel
52 Summary:    Logging service dlog API
53 License:    MIT
54 Group:      Development/Libraries
55 Requires:   lib%{name} = %{version}-%{release}
56 Requires:   pkgconfig(capi-base-common)
57
58 %description -n libdlog-devel
59 dlog API library
60
61 %package    common
62 Summary:    Shared files between libdlog and service
63 License:    Apache-2.0
64 Group:      Development/Libraries
65
66 %description common
67
68 %package    logger
69 Summary:    Logger service
70 License:    Apache-2.0
71 Group:      Development/Libraries
72 Requires:   %{name}-common = %{version}-%{release}
73
74 %description logger
75
76 %package -n libdlogutil
77 Summary:    Log retrieval API
78 Group:      Development/Libraries
79 Requires:   lib%{name} = %{version}-%{release}
80
81 %description -n libdlogutil
82 dlog log retrieval API
83
84 %package -n libdlogutil-devel
85 Summary:    Log retrieval API
86 Group:      Development/Libraries
87 Requires:   libdlog-devel
88 Requires:   lib%{name} = %{version}-%{release}
89
90 %description -n libdlogutil-devel
91 dlog log retrieval API development files
92
93 %package config-backend-logger
94 Summary:        Android-logger backend selection for dlog
95 Requires:       lib%{name} = %{version}-%{release}
96
97 %description config-backend-logger
98 Change dlog backend to logger backend. Require kernel support (Android-logger)
99
100 %package -n dlogutil
101 Summary:    print log data to the screen
102 Group:      Development/Libraries
103 Requires:   lib%{name} = %{version}-%{release}
104
105 %description -n dlogutil
106 Utilities for print log data
107
108 %package config-syslog
109 License:    Apache-2.0
110 Summary:    Logger: syslog-source logging via dlog
111 Group:      Base/Startup
112 Requires:   lib%{name} = %{version}-%{release}
113 Provides:   tizen-log-syslog
114
115 %description config-syslog
116 Systemd unit for syslog socket configation to use with dlog
117
118 %package config-persistent-logs
119 Summary: enable persistent storage of logs
120
121 %description config-persistent-logs
122 Enable persistent logs in dlog (stored in /var/log/dlog/)
123
124 %package config-qos
125 Summary: enable quality of service module
126
127 %description config-qos
128 Enables Quality of Service module in dlog
129
130 %package -n libdlog-redirect-stdout
131 Summary:    Redirect standard streams to dlog log buffers
132 Group:      Development/Libraries
133 Requires:   lib%{name} = %{version}-%{release}
134
135 %description -n libdlog-redirect-stdout
136 Redirect standard streams to dlog log buffers
137
138 %package -n libdlog-redirect-stdout-devel
139 Summary:    Redirect standard streams to dlog log buffers
140 Group:      Development/Libraries
141 Requires:   libdlog-devel
142 Requires:   lib%{name} = %{version}-%{release}
143
144 %description -n libdlog-redirect-stdout-devel
145 Redirect standard streams to dlog log buffers
146
147 %package -n dlog-redirect-stdout
148 Summary:    Utility to launch any binary with output redirected to dlog
149 Group:      Development/Libraries
150 Requires:   lib%{name} = %{version}-%{release}
151
152 %description -n dlog-redirect-stdout
153 Utility to launch any binary with output redirected to dlog
154
155 %package config-enable-redirector-for-pipe
156 Summary:    enable stdout redirector in the pipe backend
157
158 %description config-enable-redirector-for-pipe
159 Enables redirecting standard streams to dlog in the pipe backend
160
161 %package doc
162 Summary: dlog documentation
163 BuildRequires: doxygen
164
165 %description doc
166 Documentation for dlog
167
168 %package tests
169 Summary: dlog integration tests
170 Requires: lib%{name} = %{version}-%{release}
171 Requires(post): /usr/bin/chsmack
172
173 %description tests
174 Integration tests for dlog.
175
176 %if 0%{?gcov:1}
177 %package -n libdlog-gcov
178 Summary:  gcov files for libdlog
179 Group:    Development/Libraries
180 %description -n libdlog-gcov
181 This package contains gcov code coverage/profiling files for libdlog.
182 %endif
183
184 %prep
185 %setup -q
186
187 %build
188 # TODO: Respect the defaults, and have all custom flags in one place
189 CFLAGS="-Wno-gnu-variable-sized-type-not-at-end -g"
190
191 %if 0%{?gcov:1}
192 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
193 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
194 export LDFLAGS+=" -lgcov"
195 %endif
196
197
198 cp %{SOURCE101} .
199
200 %autogen --disable-static
201 %configure --disable-static \
202 %if %{without dlog_dynamic_filters}
203 --disable-dynamic-filters
204 %else
205 --enable-dynamic-filters
206 %endif
207
208 make %{?jobs:-j%jobs} CFLAGS+='-D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
209
210 # autoconf adds a bunch of flags, including -O2.
211 # Clear those so that test coverage can be measured properly
212 %if 0%{?gcov:1}
213 make check CFLAGS='-Wno-gnu-variable-sized-type-not-at-end -Wno-logical-op-parentheses -ftest-coverage -D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
214 %else
215 make check CFLAGS='-Wno-gnu-variable-sized-type-not-at-end -Wno-logical-op-parentheses -D__DLOG_VERSION=\"%{version}\" -D__DLOG_RELEASE=\"%{release}\"'
216 %endif
217
218 make dox
219
220 %if 0%{?gcov:1}
221 mkdir -p gcov-obj
222 find ./src/libdlog -name '*.gcno' -exec cp '{}' gcov-obj ';'
223 %endif
224
225 %if 0%{?gcov:1}
226 %check -n libdlog
227 lcov -c --ignore-errors graph --no-external -q -d ./src/libdlog -o libdlog.info
228 genhtml libdlog.info -o libdlog.out
229 zip -r libdlog.zip libdlog.out libdlog.info
230 install -m 0644 libdlog.zip %{buildroot}%{_datadir}/gcov/
231 %endif
232
233 %install
234 rm -rf %{buildroot}
235
236 %make_install
237 mkdir -p %{buildroot}/usr/bin/
238
239 mkdir -p %{buildroot}/usr/share/doc/dlog
240 cp -r documentation/* %{buildroot}/usr/share/doc/dlog
241
242 mkdir -p %{buildroot}%{_unitdir}/basic.target.wants/
243 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants/
244 ln -s ../dlog_logger.service %{buildroot}%{_unitdir}/basic.target.wants/dlog_logger.service
245 ln -s ../dlog_dev-log.socket %{buildroot}%{_unitdir}/sockets.target.wants/dlog_dev-log.socket
246
247 mkdir -p %{buildroot}%{_udevrulesdir}
248 install -m 0644 %SOURCE501 %{buildroot}%{_udevrulesdir}/01-dlog.rules
249
250 mkdir -p %{buildroot}%{_unitdir}/dlog_logger.service.d
251 install -m 0644 %SOURCE502 %{buildroot}%{_unitdir}/dlog_logger.service.d/logger-devices.conf
252
253 mkdir -p %{buildroot}/var/log/dlog
254
255 mkdir -p %{buildroot}/var/lib/dlog-tests
256 mkdir -p %{buildroot}/usr/share/dlog-filters.conf.test
257
258 %if %{without dlog_dynamic_filters}
259 rm -f %{buildroot}%{_bindir}/dlogctl
260 sed -i -e 's,^\(dynamic_config_path=\),#\1,g' -e 's,^\(limiter_apply_to_all_buffers=\),#\1,g' %{buildroot}%{_sysconfdir}/dlog.conf
261 %endif
262
263 %if 0%{?gcov:1}
264 mkdir -p %{buildroot}%{_datadir}/gcov/obj
265 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
266 %endif
267
268 %files -n dlogutil
269 %manifest dlog.manifest
270 %license LICENSE.APACHE2.0 LICENSE.MIT
271 %attr(750,log,log) %{_bindir}/dlogutil
272 %attr(755,log,log) %{_bindir}/dlogsend
273 %attr(750,log,log) %{_bindir}/dlog_cleanup
274 %attr(750,log,log) %{_bindir}/dlogmetrics
275 %{_unitdir}/dlog_cleanup.service
276
277 %if %{with dlog_dynamic_filters}
278 %attr(750,log,log) %{_bindir}/dlogctl
279 %endif
280
281 %post -n dlogutil
282 %if %{with dlog_dynamic_filters}
283 chsmack %{_bindir}/dlogctl -a "System::Tools"
284 %endif
285
286 %files -n libdlog
287 %manifest dlog.manifest
288 %license LICENSE.MIT
289 %{_libdir}/libdlog.so.0
290 %{_libdir}/libdlog.so.0.0.0
291
292 %post -n libdlog -p /sbin/ldconfig
293 %postun -n libdlog -p /sbin/ldconfig
294
295 %files common
296 %manifest dlog.manifest
297 %license LICENSE.APACHE2.0
298 %{_sysconfdir}/dlog.conf
299 %{_sysconfdir}/dlog.conf.d/20-pipe.conf
300 %attr(755,log,log) /var/log/dlog
301 %attr(2551,log,log) %{_libexecdir}/dlog-log-critical
302 /usr/lib/tmpfiles.d/dlog-run.conf
303 %{_udevrulesdir}/01-dlog.rules
304
305 %post common
306 chsmack -a System /var/log/dlog
307 # set timestamp to beginning of the unix epoch to make rotation work even if we are run on system with no/broken rtc
308 touch -m -t 197001010000.01 /var/log/dlog/critical.a
309 touch -m -t 197001010000.00 /var/log/dlog/critical.b
310 chmod 660 /var/log/dlog/critical*
311 chown log:log /var/log/dlog/critical*
312 chsmack -e 'System' %{_libexecdir}/dlog-log-critical
313
314 %files logger
315 %manifest dlog.manifest
316 %license LICENSE.APACHE2.0
317 %attr(750,log,log) %{_bindir}/dlog_logger
318 %{_unitdir}/basic.target.wants/dlog_logger.service
319 %{_unitdir}/dlog_logger.service
320
321 %files -n libdlog-devel
322 %manifest dlog.manifest
323 %license LICENSE.MIT
324 %{_includedir}/dlog/dlog.h
325 %{_includedir}/dlog/dlog-internal.h
326 %{_libdir}/pkgconfig/dlog.pc
327 %{_libdir}/libdlog.so
328
329 %files -n libdlogutil
330 %manifest dlog.manifest
331 %license LICENSE.MIT
332 %{_libdir}/libdlogutil.so.*
333
334 %files -n libdlogutil-devel
335 %manifest dlog.manifest
336 %license LICENSE.MIT
337 %{_includedir}/dlog/dlogutil.h
338 %{_libdir}/pkgconfig/dlogutil.pc
339 %{_libdir}/libdlogutil.so
340
341 %files config-backend-logger
342 %manifest dlog.manifest
343 %license LICENSE.APACHE2.0 LICENSE.MIT
344 %{_sysconfdir}/dlog.conf.d/25-logger.conf
345 %{_unitdir}/dlog_logger.service.d/logger-devices.conf
346
347 %files config-syslog
348 %manifest dlog.manifest
349 %license LICENSE.APACHE2.0 LICENSE.MIT
350 %{_unitdir}/sockets.target.wants/dlog_dev-log.socket
351 %{_unitdir}/dlog_dev-log.socket
352
353 %files config-persistent-logs
354 %{_sysconfdir}/dlog.conf.d/10-persistent-logs.conf
355
356 %files config-qos
357 %{_sysconfdir}/dlog.conf.d/15-qos.conf
358
359 %files -n libdlog-redirect-stdout
360 %manifest dlog.manifest
361 %license LICENSE.MIT
362 %{_libdir}/libdlog_redirect_stdout.so.*
363
364 %files -n libdlog-redirect-stdout-devel
365 %manifest dlog.manifest
366 %license LICENSE.MIT
367 %{_includedir}/dlog/dlog-redirect-stdout.h
368 %{_libdir}/pkgconfig/dlog-redirect-stdout.pc
369 %{_libdir}/libdlog_redirect_stdout.so
370
371 %files -n dlog-redirect-stdout
372 %manifest dlog.manifest
373 %license LICENSE.APACHE2.0 LICENSE.MIT
374 %attr(755,log,log) %{_bindir}/dlog_redirect_stdout
375
376 %files config-enable-redirector-for-pipe
377 %{_sysconfdir}/dlog.conf.d/30-enable-redirector-for-pipe.conf
378
379 %files doc
380 %manifest dlog.manifest
381 %license LICENSE.APACHE2.0 LICENSE.MIT
382 /usr/share/doc/dlog
383
384 %files tests
385 %manifest dlog.manifest
386 %license LICENSE.APACHE2.0 LICENSE.MIT
387 %{_bindir}/dlog_test
388 %{_bindir}/dlog_cpu
389 /usr/share/doc/dlog/README.testsuite
390 %{_libexecdir}/libdlog/perf_libdlog
391 %{_libexecdir}/libdlog/test_libdlog
392 %{_libexecdir}/libdlog/test_libdlogutil
393 %{_libexecdir}/libdlog/test_filters
394 %{_datadir}/dlog-pipe.conf.test
395 %{_datadir}/dlog-pipe.conf.redir
396 %{_datadir}/dlog-logger.conf.test
397 %{_datadir}/dlog-logger.conf.alias
398 %{_datadir}/dlog-pipe.conf.cpu
399 %{_datadir}/dlog-logger.conf.cpu
400 %{_datadir}/dlog-pipe.conf.qos
401 %{_datadir}/dlog-logger.conf.qos
402 %{_sysconfdir}/dlog.conf.d/99-dlog-logger.disable-platform-logging-for-testsuite.conf
403 %dir %attr(755,log,log) /var/lib/dlog-tests
404 %dir %attr(755,log,log) /usr/share/dlog-filters.conf.test
405
406 %post tests
407 chsmack -a System /var/lib/dlog-tests
408 echo "Warning! Installation of dlog-tests will break platform logging."
409 echo "This is done intentionally, to make logger backend testing possible."
410 echo "To restore normal behavior, please uninstall dlog-tests package."
411 echo ""
412 echo "For more information please read the /usr/share/doc/dlog/README.testsuite file"
413 echo ""
414 echo "A reboot is required to properly configure logger backend for testing."
415
416 %if 0%{?gcov:1}
417 %files -n libdlog-gcov
418 %{_datadir}/gcov/*
419 %endif