Separate log_dump from crash-worker 75/212875/3
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Mon, 19 Aug 2019 11:33:15 +0000 (13:33 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 26 Sep 2019 12:34:06 +0000 (14:34 +0200)
crash-worker can be installed without log_dump

Change-Id: Ifa045dede15148e4c5215b1a54fd0e3280d75f52

CMakeLists.txt
packaging/crash-worker.manifest
packaging/crash-worker.spec
packaging/log_dump.manifest [new file with mode: 0644]
packaging/log_dump.spec [new file with mode: 0644]
src/log_dump/CMakeLists.txt

index df5c180..630e1aa 100644 (file)
@@ -18,10 +18,6 @@ ENDIF("${SYS_ASSERT}" STREQUAL "ON")
 ADD_SUBDIRECTORY(src/crash-stack)
 ADD_SUBDIRECTORY(src/dump_systemstate)
 
-IF("${LOG_DUMP}" STREQUAL "ON")
-       ADD_SUBDIRECTORY(src/log_dump)
-ENDIF()
-
 IF("${LIVEDUMPER}" STREQUAL "ON")
        ADD_SUBDIRECTORY(src/livedumper)
 ENDIF()
index c6cdebc..25bee3e 100644 (file)
@@ -5,6 +5,5 @@
        <assign>
                <filesystem path="/usr/bin/dump_systemstate" label="System" exec_label="System"/>
                <filesystem path="/usr/bin/crash-manager" label="System" exec_label="System"/>
-               <filesystem path="/usr/bin/log_dump" label="System" exec_label="System"/>
        </assign>
 </manifest>
index 1349392..bd6cbd7 100644 (file)
@@ -2,13 +2,11 @@
 %define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
 
 %define _with_tests on
-%define _with_logdump on
 %define _with_livedumper on
 %define _with_crashservice on
 %bcond_with doc
 %bcond_with sys_assert
 %bcond_with tests
-%bcond_with logdump
 %bcond_with livedumper
 %bcond_with crashservice
 
@@ -97,10 +95,6 @@ Summary:     Livedumper allows to dump core of live process
 #Debug mode path - existence of file at path below mean that core file should be generated
 %define debugmode_path      %{TZ_SYS_ETC}/.debugmode
 
-#Path for log_dump module
-%define crash_all_log   %{TZ_SYS_ALLLOGS}
-%define crash_dump_gen  %{TZ_SYS_DUMPGEN}
-
 %define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts
 
 %build
@@ -134,14 +128,12 @@ export CFLAGS+=" -Werror"
           -DMINICOREDUMPER_BIN_PATH=%{_sbindir}/minicoredumper \
           -DMINICOREDUMPER_CONFIG_PATH=%{_sysconfdir}/minicoredumper/minicoredumper.cfg.json \
           -DLIVEDUMPER_BIN_PATH=%{_bindir}/livedumper \
-          -DLOG_DUMP_BIN_PATH=%{_bindir}/log_dump \
           -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 \
           -DSYS_ASSERT=%{on_off sys_assert} \
-          -DLOG_DUMP=%{on_off logdump} \
           -DLIVEDUMPER=%{on_off livedumper} \
           -DCRASH_SERVICE=%{on_off crashservice} \
           -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
@@ -160,14 +152,6 @@ mkdir -p %{buildroot}%{crash_root_path}
 mkdir -p %{buildroot}%{crash_path}
 mkdir -p %{buildroot}%{crash_temp}
 
-# log_dump dir
-%if %{with logdump}
-mkdir -p %{buildroot}%{crash_all_log}
-mkdir -p %{buildroot}%{crash_dump_gen}
-cp dump_scripts/* %{buildroot}%{crash_dump_gen}
-chmod 755 %{buildroot}%{crash_dump_gen}/*
-%endif
-
 %post
 %if %{with sys_assert}
 if [ ! -d /.build ]; then
@@ -186,13 +170,6 @@ fi
 /usr/bin/chsmack -a "System" -t %{crash_path}
 /usr/bin/chsmack -a "System" -t %{crash_temp}
 
-%if %{with logdump}
-/usr/bin/chsmack -a "System" -t %{crash_dump_gen}
-/usr/bin/chsmack -a "System" -t %{crash_dump_gen}/module.d
-/usr/bin/chsmack -a "System::Shared" -t %{crash_all_log}
-/usr/bin/chsmack -a "_"  %{crash_dump_gen}/module.d/*
-%endif
-
 %postun
 %if %{with sys_assert}
 orig="%{_libdir}/libsys-assert.so"
@@ -227,15 +204,6 @@ sed -i "/${pattern}/D" %{_sysconfdir}/ld.so.preload
 %{_libdir}/libcrash-service.so.*
 %endif
 
-%if %{with logdump}
-%dir %{crash_all_log}
-%{crash_dump_gen}/*
-%attr(-,root,root) %{_unitdir}/log_dump.service
-%attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/log_dump.conf
-%attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.service
-%attr(0750,system_fw,system_fw) %{_bindir}/log_dump
-%endif
-
 %if %{with sys_assert}
 %{_libdir}/libsys-assert.so
 %{_sysconfdir}/tmpfiles.d/sys-assert.conf
diff --git a/packaging/log_dump.manifest b/packaging/log_dump.manifest
new file mode 100644 (file)
index 0000000..a340d2e
--- /dev/null
@@ -0,0 +1,8 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+       <assign>
+               <filesystem path="/usr/bin/log_dump" label="System" exec_label="System"/>
+       </assign>
+</manifest>
diff --git a/packaging/log_dump.spec b/packaging/log_dump.spec
new file mode 100644 (file)
index 0000000..ce97c0b
--- /dev/null
@@ -0,0 +1,62 @@
+Name:      log_dump
+Summary:    log_dump
+Version:    5.5.19
+Release:    1
+Group:      Framework/system
+License:    Apache-2.0 and BSD
+Source0:    %{name}-%{version}.tar.gz
+Source1001:    log_dump.manifest
+Requires:       crash-worker
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(libtzplatform-config)
+BuildRequires:  pkgconfig(iniparser)
+BuildRequires:  pkgconfig(capi-system-info)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(pkgmgr-info)
+
+%description
+log_dump
+
+%prep
+%setup -q
+
+%define crash_root_path %{TZ_SYS_CRASH_ROOT}
+%define crash_all_log   %{TZ_SYS_ALLLOGS}
+%define crash_dump_gen  %{TZ_SYS_DUMPGEN}
+
+%build
+cp %{SOURCE1001} .
+
+%cmake src/log_dump/ \
+       -DCRASH_ROOT_PATH=%{crash_root_path} \
+       -DDUMP_SYSTEMSTATE_BIN_PATH=%{_bindir}/dump_systemstate \
+       -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}%{crash_all_log}
+mkdir -p %{buildroot}%{crash_dump_gen}
+cp dump_scripts/* %{buildroot}%{crash_dump_gen}
+chmod 755 %{buildroot}%{crash_dump_gen}/*
+
+%post
+/usr/bin/chsmack -a "System" -t %{crash_dump_gen}
+/usr/bin/chsmack -a "System" -t %{crash_dump_gen}/module.d
+/usr/bin/chsmack -a "System::Shared" -t %{crash_all_log}
+/usr/bin/chsmack -a "_"  %{crash_dump_gen}/module.d/*
+
+%files
+%license LICENSE
+%manifest log_dump.manifest
+%dir %{crash_all_log}
+%{crash_dump_gen}/*
+%attr(-,root,root) %{_unitdir}/log_dump.service
+%attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/log_dump.conf
+%attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.service
+%attr(0750,system_fw,system_fw) %{_bindir}/log_dump
+
+
index a7446a2..cc91ea5 100644 (file)
@@ -1,13 +1,18 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(log_dump C)
 
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
+ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/../../include ${CMAKE_SOURCE_DIR}/../../include)
+ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../../include/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../)
+
 SET(LOG_DUMP_SRCS
        log_dump.c
        dbus-handler.c
-       ${CMAKE_SOURCE_DIR}/src/shared/util.c
-       ${CMAKE_SOURCE_DIR}/src/shared/spawn.c
-       ${CMAKE_SOURCE_DIR}/src/shared/config.c
+       ${CMAKE_SOURCE_DIR}/../shared/util.c
+       ${CMAKE_SOURCE_DIR}/../shared/spawn.c
+       ${CMAKE_SOURCE_DIR}/../shared/config.c
    )
 
 INCLUDE(FindPkgConfig)
@@ -19,7 +24,7 @@ pkg_check_modules(log_dump_pkgs REQUIRED
        gio-2.0
        )
 
-INCLUDE(${CMAKE_SOURCE_DIR}/cmake/ProcessM4.cmake)
+INCLUDE(${CMAKE_SOURCE_DIR}/../../cmake/ProcessM4.cmake)
 
 FOREACH(flag ${log_dump_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")