Relase 5.5.34: Merge branch 'tizen' into tizen_5.5
[platform/core/system/crash-worker.git] / packaging / crash-worker.spec
1 # "on_off foo" wil turn into "ON" or "OFF"
2 %define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
3
4 %define _with_tests on
5 %define _with_livedumper on
6 %define _with_crashservice on
7 %bcond_with doc
8 %bcond_with tests
9 %bcond_with livedumper
10 %bcond_with crashservice
11
12 # NOTE: To disable coredump set DumpCore=0 in configuration file
13
14 Name:           crash-worker
15 Summary:        Coredump handler and report generator for Tizen
16 Version:        5.5.34
17 Release:        1
18 Group:          Framework/system
19 License:        Apache-2.0 and BSD-2-Clause and MIT
20 Source0:        %{name}-%{version}.tar.gz
21 Source1001:     crash-worker.manifest
22 BuildRequires:  pkgconfig(dlog)
23 BuildRequires:  pkgconfig(libtzplatform-config)
24 BuildRequires:  pkgconfig(iniparser)
25 BuildRequires:  pkgconfig(capi-system-info)
26 BuildRequires:  pkgconfig(glib-2.0)
27 BuildRequires:  pkgconfig(rpm)
28 BuildRequires:  cmake
29 BuildRequires:  pkgconfig(pkgmgr-info)
30 BuildRequires:  pkgconfig(libunwind-generic)
31 BuildRequires:  libelf-devel libelf
32 BuildRequires:  libebl-devel libebl
33 BuildRequires:  libdw-devel libdw
34 BuildRequires:  libcap-devel
35
36 %if %{with doc}
37 BuildRequires:  doxygen
38 %endif
39
40 %if %{with livedumper}
41 BuildRequires:  boost-devel
42 %endif
43
44 Requires(post): coreutils
45 Requires(post): tar
46 Requires(post): gzip
47 Requires:       zip
48 Requires:       libelf
49 Requires:       libdw
50 Requires:       minicoredumper >= 2.1.0
51 Requires:       %{_bindir}/buxton2ctl
52 %if %{with crashservice}
53 Requires:       %{name}-livedumper = %{version}-%{release}
54 %endif
55 %description
56
57 %package -n     libcrash-service
58 Summary:        libcrash-service provides API to communicate with crash-service
59 %description -n libcrash-service
60
61 %package        devel
62 Requires:       libcrash-service
63 Summary:        Crash-manager headers and library for linking
64 %description    devel
65
66 %if %{with doc}
67 %package        doc
68 Summary:        Documentation package for crash-worker
69 Group:          Framework/System
70 %description    doc
71 %endif
72
73 %if %{with tests}
74 %package        tests
75 Summary:        Package with binaries and data for crash-worker tests
76 %description    tests
77 %endif
78
79 %if %{with livedumper}
80 %package        livedumper
81 Summary:        Livedumper allows to dump core of live process
82 %description    livedumper
83 %endif
84
85 %package        system-tests
86 Summary:        System tests for crash-worker components
87 Requires:       diff
88 Requires:       gdb
89 Requires:       coreutils
90 Requires:       tlm
91 Requires:       /bin/bash
92 Requires:       /usr/bin/unzip
93 Requires:       /usr/bin/mcookie
94 Requires:       %{_sbindir}/minicoredumper
95 Requires:       %{name}-system-tests-debuginfo = %{version}-%{release}
96 %description    system-tests
97
98 %prep
99 %setup -q
100
101 #Path to store logs and coredump files
102 %define crash_root_path %{TZ_SYS_CRASH_ROOT}
103 %define crash_path      %{TZ_SYS_CRASH}
104 %define crash_temp      %{crash_root_path}/temp
105
106 #Debug mode path - existence of file at path below mean that core file should be generated
107 %define debugmode_path      %{TZ_SYS_ETC}/.debugmode
108
109 %define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts
110
111 %build
112 cp %{SOURCE1001} .
113
114 export CFLAGS+=" -Werror"
115
116 %ifarch %{arm} aarch64
117         %define ARCH arm
118 %else
119         %define ARCH x86
120 %endif
121
122 %ifarch %{arm} %ix86
123         %define ARCH_BIT 32
124 %else
125         %define ARCH_BIT 64
126 %endif
127
128 %cmake . \
129            -DCMAKE_INSTALL_PREFIX=%{_prefix} \
130            -DTMP_FILES_DIR=%{_sysconfdir}/tmpfiles.d \
131            -DARCH=%{ARCH} \
132            -DARCH_BIT=%{ARCH_BIT} \
133            -DDUMP_SYSTEMSTATE_CONFIG_DIR_PATH=%{_sysconfdir}/dump_systemstate.conf.d \
134            -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf \
135            -DCRASH_ROOT_PATH=%{crash_root_path} \
136            -DCRASH_PATH=%{crash_path} \
137            -DCRASH_TEMP=%{crash_temp} \
138            -DDEBUGMODE_PATH=%{debugmode_path} \
139            -DMINICOREDUMPER_BIN_PATH=%{_sbindir}/minicoredumper \
140            -DMINICOREDUMPER_CONFIG_PATH=%{_sysconfdir}/minicoredumper/minicoredumper.cfg.json \
141            -DLIVEDUMPER_BIN_PATH=%{_bindir}/livedumper \
142            -DDUMP_SYSTEMSTATE_BIN_PATH=%{_bindir}/dump_systemstate \
143            -DCRASH_STACK_BIN_PATH=%{_libexecdir}/crash-stack \
144            -DCRASH_POPUP_BIN_PATH=%{_libexecdir}/crash-popup-launch \
145            -DCRASH_NOTIFY_BIN_PATH=%{_libexecdir}/crash-notify-send \
146            -DCRASH_TESTS_PATH=%{_libdir}/crash-worker/tests \
147            -DCRASH_SYSTEM_TESTS_PATH=%{_libdir}/crash-worker/system-tests \
148            -DLIVEDUMPER=%{on_off livedumper} \
149            -DCRASH_SERVICE=%{on_off crashservice} \
150            -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
151            -DLOGGER=dlog \
152            -DDLOG_LOG_LEVEL=DLOG_INFO \
153            -DVERSION=%{version}
154
155 make %{?jobs:-j%jobs}
156
157 %if %{with doc}
158 make doc
159 %endif
160
161 %install
162 rm -rf %{buildroot}
163 %make_install
164 mkdir -p %{buildroot}%{crash_root_path}
165 mkdir -p %{buildroot}%{crash_path}
166 mkdir -p %{buildroot}%{crash_temp}
167
168 %post
169 /usr/bin/chsmack -a "System" -t %{crash_path}
170 /usr/bin/chsmack -a "System" -t %{crash_temp}
171
172 %files
173 %license LICENSE LICENSE.BSD LICENSE.MIT
174 %manifest crash-worker.manifest
175 %defattr(-,crash_worker,crash_worker,-)
176 %dir %{crash_root_path}
177 %dir %{crash_path}
178 %dir %{crash_temp}
179 %{_sysconfdir}/crash-manager.conf
180 %{_sysconfdir}/crash-manager.conf.d/crash-manager.conf.example
181 %attr(-,root,root) %{_prefix}/lib/sysctl.d/70-crash-manager.conf
182 %attr(0750,crash_worker,crash_worker) %{_bindir}/crash-manager
183 %attr(0750,crash_worker,crash_worker) %{_bindir}/dump_systemstate
184 %{_sysconfdir}/dump_systemstate.conf.d/files/*.conf*
185 %{_sysconfdir}/dump_systemstate.conf.d/programs/*.conf*
186 %{_libexecdir}/crash-stack
187 %{_libexecdir}/crash-popup-launch
188 %{_libexecdir}/crash-notify-send
189 %{_libdir}/libcrash-manager.so.*
190
191 %if %{with crashservice}
192 %attr(0750,crash_worker,crash_worker) %{_bindir}/crash-service
193 %attr(-,root,root) %{_unitdir}/crash-service.service
194 %attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/crash-service.conf
195 %attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.livedump.service
196 %endif
197
198 #upgrade script
199 %attr(-,root,root) %{upgrade_script_path}/500.crash-manager-upgrade.sh
200
201 %files -n libcrash-service
202 %{_libdir}/libcrash-service.so.*
203
204 %files devel
205 %{_includedir}/crash-manager.h
206 %{_libdir}/libcrash-manager.so
207 %{_libdir}/pkgconfig/crash-manager.pc
208 %if %{with crashservice}
209 %{_includedir}/libcrash-service.h
210 %{_libdir}/libcrash-service.so
211 %{_libdir}/pkgconfig/crash-service.pc
212 %endif
213
214 %if %{with doc}
215 %files doc
216 %{_datadir}/doc/crash-worker
217 %endif
218
219 %if %{with tests}
220 %files tests
221 %manifest %{name}.manifest
222 %defattr(-,root,root)
223 %{_libdir}/crash-worker/tests/test1-default-crash
224 %{_libdir}/crash-worker/tests/test1-default-sleep
225 %{_libdir}/crash-worker/tests/test1-default-ill
226 %{_libdir}/crash-worker/tests/test1-custom-crash
227 %{_libdir}/crash-worker/tests/test1-custom-sleep
228 %{_libdir}/crash-worker/tests/test1-custom-ill
229 %{_libdir}/crash-worker/tests/run_tests.sh
230 %{_libdir}/crash-worker/tests/tests_common.sh
231 %{_libdir}/crash-worker/tests/crash_common.sh
232
233 %endif
234
235 %if %{with livedumper}
236 %files livedumper
237 %manifest %{name}.manifest
238 %{_bindir}/livedumper
239 %endif
240
241 %files system-tests
242 %manifest %{name}.manifest
243 %{_bindir}/crash-worker-system-tests-run
244
245 %{_libdir}/crash-worker/system-tests/check_minicore_mem/check_minicore_mem.sh
246 %{_libdir}/crash-worker/system-tests/check_minicore_mem/cp.sh
247 %{_libdir}/crash-worker/system-tests/cmp_backtraces/cmp_backtraces.sh
248 %{_libdir}/crash-worker/system-tests/cmp_backtraces/cp.sh
249 %{_libdir}/crash-worker/system-tests/crash_root_path/crash_root_path.sh
250 %{_libdir}/crash-worker/system-tests/critical_process/critical_process.sh
251 %{_libdir}/crash-worker/system-tests/dbus_notify/dbus_notify.sh
252 %{_libdir}/crash-worker/system-tests/dbus_notify_legacy/dbus_notify_legacy.sh
253 %{_libdir}/crash-worker/system-tests/dump_systemstate_extras/dump_systemstate_extras.sh
254 %{_libdir}/crash-worker/system-tests/exclude_paths/exclude_paths.sh
255 %{_libdir}/crash-worker/system-tests/extra_script/extra_script.sh
256 %{_libdir}/crash-worker/system-tests/full_core/full_core.sh
257 %{_libdir}/crash-worker/system-tests/info_file/info_file.sh
258 %{_libdir}/crash-worker/system-tests/libcrash-service/libcrash-service.sh
259 %{_libdir}/crash-worker/system-tests/log_file/log_file.sh
260 %{_libdir}/crash-worker/system-tests/output_param/output_param.sh
261 %{_libdir}/crash-worker/system-tests/report_basic/report_basic.sh
262 %{_libdir}/crash-worker/system-tests/report_type_info/report_type_info.sh
263 %{_libdir}/crash-worker/system-tests/so_info_file/so_info_file.sh
264 %{_libdir}/crash-worker/system-tests/time_test/cp.sh
265 %{_libdir}/crash-worker/system-tests/time_test/time_test.sh
266 %{_libdir}/crash-worker/system-tests/utils/btee
267 %{_libdir}/crash-worker/system-tests/utils/kenny
268 %{_libdir}/crash-worker/system-tests/utils/libcrash-servicetest
269 %{_libdir}/crash-worker/system-tests/utils/minicore-utils.sh
270 %{_libdir}/crash-worker/system-tests/wait_for_opt_usr/wait_for_opt_usr.sh
271 %{_libdir}/crash-worker/system-tests/without_core/without_core.sh
272
273 %if %{with livedumper}
274 %{_libdir}/crash-worker/system-tests/livedumper/livedumper.sh
275 %endif