summaryrefslogtreecommitdiff
path: root/packaging/crash-worker.spec
blob: 41fe2498bb8263918edf86aeb94cb714e7a2c113 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# "on_off foo" wil turn into "ON" or "OFF"
%define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}

%define _with_tests on
%define _with_livedumper on
%define _with_crashservice on
%bcond_with doc
%bcond_with tests
%bcond_with livedumper
%bcond_with crashservice

# NOTE: To disable coredump set DumpCore=0 in configuration file

Name:      crash-worker
Summary:    Crash-manager
Version:    5.5.26
Release:    1
Group:      Framework/system
License:    Apache-2.0 and BSD
Source0:    %{name}-%{version}.tar.gz
Source1001:    crash-worker.manifest
BuildRequires:  pkgconfig(dlog)
BuildRequires:  pkgconfig(libtzplatform-config)
BuildRequires:  pkgconfig(iniparser)
BuildRequires:  pkgconfig(capi-system-info)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(rpm)
BuildRequires:  cmake
BuildRequires:  pkgconfig(pkgmgr-info)

BuildRequires:  pkgconfig(libunwind-generic)
BuildRequires:  libelf-devel libelf
BuildRequires:  libebl-devel libebl
BuildRequires:  libdw-devel libdw

%if %{with doc}
BuildRequires:  doxygen
%endif

%if %{with livedumper}
BuildRequires:  boost-devel
%endif

Requires(post): coreutils
Requires(post): tar
Requires(post): gzip
Requires: zip
Requires: libelf
Requires: libdw
Requires: minicoredumper >= 2.1.0
Requires: %{_bindir}/buxton2ctl
%if %{with crashservice}
Requires: %{name}-livedumper = %{version}-%{release}
%endif

%description
crash-manager

%package devel
Requires: crash-worker
Summary:    Crash-manager development package
%description devel
This package provides library and header files.

%if %{with doc}
%package doc
Summary:       Documentation package for crash-worker
Group:         Framework/System

%description doc
This package provides development documentation for crash-worker.
%endif

%if %{with tests}
%package tests
Summary:	Package with binaries and data for crash-worker tests

%description tests
This package contains installable tests in Bash.
%endif

%if %{with livedumper}
%package livedumper
Summary:	Livedumper allows to dump core of live process

%description livedumper
%endif

%prep
%setup -q

#Path to store logs and coredump files
%define crash_root_path %{TZ_SYS_CRASH_ROOT}
%define crash_path      %{TZ_SYS_CRASH}
%define crash_temp      %{crash_root_path}/temp

#Debug mode path - existence of file at path below mean that core file should be generated
%define debugmode_path      %{TZ_SYS_ETC}/.debugmode

%define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts

%build
cp %{SOURCE1001} .

export CFLAGS+=" -Werror"

%ifarch %{arm} aarch64
	%define ARCH arm
%else
	%define ARCH x86
%endif

%ifarch %{arm} %ix86
	%define ARCH_BIT 32
%else
	%define ARCH_BIT 64
%endif

%cmake . \
	   -DCMAKE_INSTALL_PREFIX=%{_prefix} \
	   -DTMP_FILES_DIR=%{_sysconfdir}/tmpfiles.d \
	   -DARCH=%{ARCH} \
	   -DARCH_BIT=%{ARCH_BIT} \
	   -DDUMP_SYSTEMSTATE_CONFIG_DIR_PATH=%{_sysconfdir}/dump_systemstate.conf.d \
	   -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf \
	   -DCRASH_ROOT_PATH=%{crash_root_path} \
	   -DCRASH_PATH=%{crash_path} \
	   -DCRASH_TEMP=%{crash_temp} \
	   -DDEBUGMODE_PATH=%{debugmode_path} \
	   -DMINICOREDUMPER_BIN_PATH=%{_sbindir}/minicoredumper \
	   -DMINICOREDUMPER_CONFIG_PATH=%{_sysconfdir}/minicoredumper/minicoredumper.cfg.json \
	   -DLIVEDUMPER_BIN_PATH=%{_bindir}/livedumper \
	   -DDUMP_SYSTEMSTATE_BIN_PATH=%{_bindir}/dump_systemstate \
	   -DCRASH_STACK_BIN_PATH=%{_libexecdir}/crash-stack \
	   -DCRASH_POPUP_BIN_PATH=%{_libexecdir}/crash-popup-launch \
	   -DCRASH_NOTIFY_BIN_PATH=%{_libexecdir}/crash-notify-send \
	   -DCRASH_TESTS_PATH=%{_libdir}/crash-worker-tests \
	   -DLIVEDUMPER=%{on_off livedumper} \
	   -DCRASH_SERVICE=%{on_off crashservice} \
	   -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
	   -DLOGGER=dlog \
	   -DVERSION=%{version}

make %{?jobs:-j%jobs}
%if %{with doc}
make doc
%endif

%install
rm -rf %{buildroot}
%make_install
mkdir -p %{buildroot}%{crash_root_path}
mkdir -p %{buildroot}%{crash_path}
mkdir -p %{buildroot}%{crash_temp}

%post
/usr/bin/chsmack -a "System" -t %{crash_path}
/usr/bin/chsmack -a "System" -t %{crash_temp}

%files
%license LICENSE LICENSE.BSD
%manifest crash-worker.manifest
%defattr(-,system_fw,system_fw,-)
%dir %{crash_root_path}
%dir %{crash_path}
%dir %{crash_temp}
%{_sysconfdir}/crash-manager.conf
%attr(-,root,root) %{_prefix}/lib/sysctl.d/70-crash-manager.conf
%attr(0750,system_fw,system_fw) %{_bindir}/crash-manager
%attr(0750,system_fw,system_fw) %{_bindir}/dump_systemstate
%{_sysconfdir}/dump_systemstate.conf.d/files/files.conf.example
%{_sysconfdir}/dump_systemstate.conf.d/programs/programs.conf.example
%{_libexecdir}/crash-stack
%{_libexecdir}/crash-popup-launch
%{_libexecdir}/crash-notify-send
%{_libdir}/libcrash-manager.so.*

%if %{with crashservice}
%attr(0750,system_fw,system_fw) %{_bindir}/crash-service
%attr(-,root,root) %{_unitdir}/crash-service.service
%attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/crash-service.conf
%attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.livedump.service
%{_libdir}/libcrash-service.so.*
%endif

#upgrade script
%attr(-,root,root) %{upgrade_script_path}/500.crash-manager-upgrade.sh

%files devel
%{_includedir}/crash-manager.h
%{_libdir}/libcrash-manager.so
%{_libdir}/pkgconfig/crash-manager.pc
%if %{with crashservice}
%{_includedir}/libcrash-service.h
%{_libdir}/libcrash-service.so
%{_libdir}/pkgconfig/crash-service.pc
%endif

%if %{with doc}
%files doc
%{_datadir}/doc/crash-worker
%endif

%if %{with tests}
%files tests
%manifest %{name}.manifest
%defattr(-,root,root)
%{_libdir}/crash-worker-tests/test1-default-crash
%{_libdir}/crash-worker-tests/test1-default-sleep
%{_libdir}/crash-worker-tests/test1-default-ill
%{_libdir}/crash-worker-tests/test1-custom-crash
%{_libdir}/crash-worker-tests/test1-custom-sleep
%{_libdir}/crash-worker-tests/test1-custom-ill
%{_libdir}/crash-worker-tests/run_tests.sh
%{_libdir}/crash-worker-tests/tests_common.sh
%{_libdir}/crash-worker-tests/crash_common.sh

%endif

%if %{with livedumper}
%files livedumper
%manifest %{name}.manifest
%{_bindir}/livedumper
%endif