Add codes for handling rpk pkg 63/258263/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 13 May 2021 04:24:15 +0000 (13:24 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 13 May 2021 04:24:15 +0000 (13:24 +0900)
Change-Id: If3bc5d87d7a2dd4ae56ee00ad278b2e42b4ff127
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
CMakeLists.txt
packaging/unified-backend.spec
src/unified/CMakeLists.txt
src/unified/unified_installer_factory.cc

index 829cf9f3de6c928111f3a099acc79c8ccfafa262..1a860c14292bb8988d3886f207ab5bacdf065eb4 100644 (file)
@@ -55,6 +55,7 @@ PKG_CHECK_MODULES(WGT_INSTALLER_DEPS REQUIRED wgt-installer)
 PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock)
 PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0)
 PKG_CHECK_MODULES(GLIB_DEPS REQUIRED glib-2.0)
+PKG_CHECK_MODULES(RPK_INSTALLER_DEPS REQUIRED rpk-installer)
 
 FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem regex program_options)
 
index 335a67ff1e5cd71fb9f5f7dfa5e398a8008af3ff..013112c2cc7958b1605741e005cf4ea1e75c92ff 100644 (file)
@@ -28,6 +28,7 @@ BuildRequires: pkgconfig(wgt-installer)
 BuildRequires: pkgconfig(gmock)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(rpk-installer)
 
 %if 0%{?gcov:1}
 BuildRequires: lcov
@@ -139,4 +140,4 @@ Simple string key-val dictionary ADT gcov objects
 %files gcov
 %defattr(-,root,root,-)
 %{_datadir}/gcov/*
-%endif
\ No newline at end of file
+%endif
index e74495555e39ea3f291e39edfd3818b99c886b02..c12a6a9a1b7646e9c9501acd4e71f574bb223c13 100644 (file)
@@ -16,6 +16,7 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_UNIFIED} PUBLIC
   PKGMGR_TYPES_DEPS
   TPK_INSTALLER_DEPS
   WGT_INSTALLER_DEPS
+  RPK_INSTALLER_DEPS
 )
 
 # Target
index bcccc2a4a89c394baad930662352d5b8d2f06824..aaa0cc673b23660050c960ed5e7a96270b57fabd 100644 (file)
@@ -12,6 +12,8 @@
 #include <hybrid/hybrid_installer.h>
 #include <tpk/tpk_app_query_interface.h>
 #include <tpk/tpk_installer.h>
+#include <rpk/rpk_installer.h>
+#include <rpk/rpk_app_query_interface.h>
 #include <wgt/utils/wgt_app_query_interface.h>
 #include <wgt/wgt_installer.h>
 
@@ -31,7 +33,7 @@ std::map<const char*, const char*> kTypeMap = {
 };
 
 std::string ValidatePkgType(const std::string& type) {
-  if (type == "tpk" || type == "wgt")
+  if (type == "tpk" || type == "wgt" || type == "rpk")
     return type;
   else if (type == "rpm")
     return "tpk";
@@ -46,6 +48,10 @@ std::string GetPkgTypeFromPkgid(const std::string& pkgid, uid_t uid) {
 
 std::string GetPkgTypeFromPath(const std::string& path) {
   std::string type;
+
+  if (boost::filesystem::extension(path) == ".rpk")
+    return "rpk";
+
   unzFile uf = unzOpen(path.c_str());
   if (!uf) {
     LOG(ERROR) << "Failed to open zip file: " << path;
@@ -115,7 +121,7 @@ std::unique_ptr<AppInstaller> UnifiedInstallerFactory::CreateInstaller(
         new tpk::TpkAppQueryInterface());
     pkgmgr->AddAppQueryInterface(idx, tpk_aqi);
     installer.reset(new tpk::TpkInstaller(pkgmgr));
-  } else {
+  } else if (type == "wgt") {
     // should be fixed
     std::shared_ptr<wgt::WgtAppQueryInterface> wgt_aqi(
         new wgt::WgtAppQueryInterface());
@@ -127,6 +133,11 @@ std::unique_ptr<AppInstaller> UnifiedInstallerFactory::CreateInstaller(
     } else {
       installer.reset(new wgt::WgtInstaller(pkgmgr));
     }
+  } else {
+    std::shared_ptr<rpk::RpkAppQueryInterface> rpk_aqi(
+        new rpk::RpkAppQueryInterface());
+    pkgmgr->AddAppQueryInterface(idx, rpk_aqi);
+    installer.reset(new rpk::RpkInstaller(pkgmgr));
   }
 
   installer->SetIndex(idx);