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