Split rpm packaging into library part and backend part 18/217018/6
authorSangyoon Jang <jeremy.jang@samsung.com>
Mon, 14 Oct 2019 01:59:07 +0000 (10:59 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Mon, 17 Feb 2020 06:48:03 +0000 (15:48 +0900)
Change-Id: Icdf2ae772b047ae521a5cfbceb7586c1df946ed5
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
packaging/wgt-backend-tests.manifest [deleted file]
packaging/wgt-backend.spec
packaging/wgt-installer-tests.manifest [new file with mode: 0644]
packaging/wgt-installer.manifest [new file with mode: 0644]
src/hybrid/CMakeLists.txt
src/unit_tests/CMakeLists.txt
src/unit_tests/manifest_test.cc
src/unit_tests/smoke_test.cc
src/unit_tests/smoke_utils.cc
src/wgt/CMakeLists.txt
src/wgt/wgt-installer.pc.in [new file with mode: 0644]

diff --git a/packaging/wgt-backend-tests.manifest b/packaging/wgt-backend-tests.manifest
deleted file mode 100644 (file)
index 8ea34c3..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<manifest>
-        <request>
-                <domain name="_" />
-        </request>
-        <assign>
-                <filesystem path="/usr/bin/wgt-backend-ut/smoke-test" exec_label="System" />
-                <filesystem path="/usr/bin/wgt-backend-ut/smoke-test-helper" exec_label="System" />
-                <filesystem path="/usr/bin/wgt-backend-ut/extensive-smoke-test" exec_label="System" />
-        </assign>
-</manifest>
index 6f44f5f9edb82c93331bb5883d4afdb8f9e1933b..7c933b45c46372543b994f3328375d654d590fb9 100644 (file)
@@ -7,8 +7,10 @@ License:        Apache-2.0
 Source0:        %{name}-%{version}.tar.gz
 
 Source1000:     wgt-backend.manifest
-Source1001:     wgt-backend-tests.manifest
+Source1001:     wgt-installer.manifest
+Source1002:     wgt-installer-tests.manifest
 
+Requires:       wgt-installer = %{version}
 BuildRequires:  boost-devel
 BuildRequires:  cmake
 BuildRequires:  gtest-devel
@@ -26,18 +28,34 @@ BuildRequires:  pkgconfig(libgum)
 %description
 This is a package that installs the WGT backend of pkgmgr.
 
-%package tests
-Summary: Unit tests for wgt-backend
-Requires: %{name} = %{version}
+%package -n wgt-installer
+Summary: Wgt-installer library
+Group:   Application Framework/Package Management
 
-%description tests
-Unit tests for wgt-backend
+%description -n wgt-installer
+This package contains wgt-installer library
+
+%package -n wgt-installer-devel
+Summary:  Wgt-installer development files
+Group:    Application Framework/Package Management
+Requires: wgt-installer = %{version}
+
+%description -n wgt-installer-devel
+This package contains header files of wgt-installer library
+
+%package -n wgt-installer-tests
+Summary: Unit tests for wgt-installer
+Requires: wgt-installer = %{version}
+
+%description -n wgt-installer-tests
+Unit tests for wgt-installer
 
 %prep
 %setup -q
 
 cp %{SOURCE1000} .
 cp %{SOURCE1001} .
+cp %{SOURCE1002} .
 
 %build
 %cmake . -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}
@@ -48,22 +66,35 @@ make %{?_smp_mflags}
 mkdir -p %{buildroot}/etc/package-manager/backend
 ln -s %{_bindir}/wgt-backend %{buildroot}%{_sysconfdir}/package-manager/backend/wgt
 
-%post tests
-/usr/sbin/setcap cap_chown,cap_dac_override,cap_fowner=eip %{_bindir}/wgt-backend-ut/smoke-test
-/usr/sbin/setcap cap_chown,cap_dac_override,cap_fowner=eip %{_bindir}/wgt-backend-ut/smoke-test-helper
+%post -n wgt-installer-tests
+/usr/sbin/setcap cap_chown,cap_dac_override,cap_fowner=eip %{_bindir}/wgt-installer-ut/smoke-test
+/usr/sbin/setcap cap_chown,cap_dac_override,cap_fowner=eip %{_bindir}/wgt-installer-ut/smoke-test-helper
 
 %files
 %manifest wgt-backend.manifest
 %license LICENSE
 %{_sysconfdir}/package-manager/backend/wgt
-%{_sysconfdir}/package-manager/backendlib/libwgt.so
 %{_bindir}/wgt-backend
 %{_datadir}/wgt-backend/default.png
 
-%files tests
-%manifest wgt-backend-tests.manifest
-%{_bindir}/wgt-backend-ut/*
-%{_datadir}/wgt-backend-ut/*
+%files -n wgt-installer
+%manifest wgt-installer.manifest
+%{_sysconfdir}/package-manager/backendlib/libwgt.so
+%{_libdir}/libwgt-installer.so*
+%{_libdir}/libhybrid-installer.so*
+
+%files -n wgt-installer-devel
+%{_includedir}/app-installers/wgt/*.h
+%{_includedir}/app-installers/wgt/*/*.h
+%{_includedir}/app-installers/wgt/*/*/*.h
+%{_includedir}/app-installers/hybrid/*.h
+%{_includedir}/app-installers/hybrid/*/*/*.h
+%{_libdir}/pkgconfig/wgt-installer.pc
+
+%files -n wgt-installer-tests
+%manifest wgt-installer-tests.manifest
+%{_bindir}/wgt-installer-ut/*
+%{_datadir}/wgt-installer-ut/*
 
 %changelog
 * Thu Dec 18 2015 Pawel Sikorski <p.sikorski@samsung.com> 0.1-1
diff --git a/packaging/wgt-installer-tests.manifest b/packaging/wgt-installer-tests.manifest
new file mode 100644 (file)
index 0000000..f5159f3
--- /dev/null
@@ -0,0 +1,10 @@
+<manifest>
+        <request>
+                <domain name="_" />
+        </request>
+        <assign>
+                <filesystem path="/usr/bin/wgt-installer-ut/smoke-test" exec_label="System" />
+                <filesystem path="/usr/bin/wgt-installer-ut/smoke-test-helper" exec_label="System" />
+                <filesystem path="/usr/bin/wgt-installer-ut/extensive-smoke-test" exec_label="System" />
+        </assign>
+</manifest>
diff --git a/packaging/wgt-installer.manifest b/packaging/wgt-installer.manifest
new file mode 100644 (file)
index 0000000..c00c25b
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+        <request>
+                <domain name="_" />
+        </request>
+</manifest>
index 016c783e16c9e753581ece55ec728ad9562b518a..9d11bd91c79f26f56963520dbc817cea2c0ce134 100644 (file)
@@ -2,7 +2,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} HYBRID_SRCS)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/configuration HYBRID_STEP_CONFIGURATION_SRCS)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/encryption HYBRID_STEP_ENCRYPTION_SRCS)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/pkgmgr HYBRID_STEP_PKGMGR_SRCS)
-ADD_LIBRARY(${TARGET_LIBNAME_HYBRID} STATIC
+ADD_LIBRARY(${TARGET_LIBNAME_HYBRID} SHARED
   ${HYBRID_SRCS}
   ${HYBRID_STEP_CONFIGURATION_SRCS}
   ${HYBRID_STEP_ENCRYPTION_SRCS}
@@ -19,3 +19,7 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_HYBRID} PUBLIC
 # Target - in-package deps
 TARGET_LINK_LIBRARIES(${TARGET_LIBNAME_HYBRID} PRIVATE ${TARGET_LIBNAME_WGT})
 SET_TARGET_PROPERTIES(${TARGET_LIBNAME_HYBRID} PROPERTIES COMPILE_FLAGS "-fPIC")
+
+INSTALL(TARGETS ${TARGET_LIBNAME_HYBRID} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(DIRECTORY ./ DESTINATION ${INCLUDEDIR}/app-installers/hybrid/
+        FILES_MATCHING PATTERN "*.h")
index 5e98bc351a1a88a16b5cda2770509b5d57fb5bc2..380ad2d1a69534c9ec63f7c25b55852893aa76ff 100644 (file)
@@ -1,4 +1,4 @@
-SET(DESTINATION_DIR wgt-backend-ut)
+SET(DESTINATION_DIR wgt-installer-ut)
 SET(TARGET_SMOKE_UTILS smoke-utils)
 
 # Executables
index e195ff0ddee6ce820020aa6f5c5ccb1de0a8b2ea..ca90c2613ebc750f8b0eaea4b4c8259c739ca91e 100644 (file)
@@ -30,7 +30,7 @@ namespace ci = common_installer;
 namespace {
 
 const char kManifestTestcaseData[] =
-    "/usr/share/wgt-backend-ut/test_samples/manifest/";
+    "/usr/share/wgt-installer-ut/test_samples/manifest/";
 
 template<typename T>
 gint Size(GListRange<T>* range) {
index 4ceba21adfb22d79719e5042af0ebe3fa9fe07b1..581908a8f6c123b73bf32e354bd3bd9aa6afb8c2 100644 (file)
@@ -235,7 +235,7 @@ TEST_F(SmokeTest, DeltaMode) {
 
 TEST_F(SmokeTest, RecoveryMode_ForInstallation) {
   bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt";
-  ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper");
+  ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
   std::string test_uid_str = std::to_string(params.test_user.uid);
   backend_crash.Run("-i", path.string(), "-u", test_uid_str.c_str());
   ASSERT_NE(backend_crash.Wait(), 0);
@@ -256,7 +256,7 @@ TEST_F(SmokeTest, RecoveryMode_ForUpdate) {
   std::string pkgid = "smokewgt10";
   std::string appid = "smokewgt10.RecoveryModeForUpdate";
   AddDataFiles(pkgid, params.test_user.uid);
-  ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper");
+  ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
   std::string test_uid_str = std::to_string(params.test_user.uid);
   backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str());
   ASSERT_NE(backend_crash.Wait(), 0);
@@ -277,7 +277,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) {
   bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta";
   RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
   ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK);
-  ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper");
+  ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
   std::string test_uid_str = std::to_string(params.test_user.uid);
   backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str());
   ASSERT_NE(backend_crash.Wait(), 0);
@@ -297,7 +297,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) {
 TEST_F(SmokeTest, RecoveryMode_ForMountInstall) {
   bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt";
   RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
-  ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper");
+  ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
   std::string test_uid_str = std::to_string(params.test_user.uid);
   backend_crash.Run("-w", path.string(), "-u", test_uid_str.c_str());
   ASSERT_NE(backend_crash.Wait(), 0);
@@ -321,7 +321,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
   ASSERT_EQ(backend.MountInstallSuccess(path_old),
             ci::AppInstaller::Result::OK);
   AddDataFiles(pkgid, params.test_user.uid);
-  ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper");
+  ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
   std::string test_uid_str = std::to_string(params.test_user.uid);
   backend_crash.Run("-w", path_new.string(), "-u", test_uid_str.c_str());
   ASSERT_NE(backend_crash.Wait(), 0);
@@ -867,7 +867,7 @@ TEST_F(SmokeTest, InstallExtendedMode) {
 TEST_F(SmokeTest, RecoveryMode_CrashAfterUnzip) {
   bf::path path = kSmokePackagesDirectory / "RecoveryMode_CrashAfterUnzip.wgt";
   RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
-  ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper");
+  ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
   std::string test_uid_str = std::to_string(params.test_user.uid);
   backend_crash.Run("-i", path.string(), "-u", test_uid_str.c_str(),
       "-step_name", "Unzip");
index 14965f98a87951039d6d31ec0cf2636dfdb76224..44c81583a5a2ebd1bae1df6e5a498815d5513cdb 100644 (file)
@@ -19,7 +19,7 @@ namespace st = smoke_test;
 namespace smoke_test {
 
 const bf::path kSmokePackagesDirectory =
-    "/usr/share/wgt-backend-ut/test_samples/smoke/";
+    "/usr/share/wgt-installer-ut/test_samples/smoke/";
 
 bool ValidatePackage(const std::string& pkgid,
     const std::vector<std::string>& appids,
index e2456c754514bc65550086bbb3fd493c392ab1db..9aa1b7befbb768116aff3257d998dd9bccd410bb 100755 (executable)
@@ -8,7 +8,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/security WGT_STEP_SECURITY
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/utils WGT_UTILS_SRCS)
 
 # Target - definition
-ADD_LIBRARY(${TARGET_LIBNAME_WGT} STATIC
+ADD_LIBRARY(${TARGET_LIBNAME_WGT} SHARED
   ${WGT_SRCS}
   ${WGT_STEP_CONFIGURATION_SRCS}
   ${WGT_STEP_ENCRYPTION_SRCS}
@@ -28,3 +28,11 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_WGT} PUBLIC
   Boost
 )
 SET_TARGET_PROPERTIES(${TARGET_LIBNAME_WGT} PROPERTIES COMPILE_FLAGS "-fPIC")
+
+INSTALL(TARGETS ${TARGET_LIBNAME_WGT} DESTINATION ${LIB_INSTALL_DIR})
+
+# Export devel package
+CONFIGURE_FILE(wgt-installer.pc.in wgt-installer.pc @ONLY)
+INSTALL(FILES wgt-installer.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(DIRECTORY ./ DESTINATION ${INCLUDEDIR}/app-installers/wgt/
+        FILES_MATCHING PATTERN "*.h")
diff --git a/src/wgt/wgt-installer.pc.in b/src/wgt/wgt-installer.pc.in
new file mode 100644 (file)
index 0000000..ec397c2
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: wgt-installer
+Description: Wgt-installer library
+Version: @FULLVER@
+Requires: app-installers pkgmgr wgt-manifest-handlers manifest-parser
+Libs: -L${libdir} -lwgt-installer -lhybrid-installer
+Cflags: -I${includedir}/app-installers/