From 0037024e0e3c53b9cdf7e23da84f4590d3934b85 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 16 Apr 2020 13:31:54 +0900 Subject: [PATCH 01/16] Release version 0.15.1 Changes: - Adjust install step order Change-Id: Ie9aadb9fdd36f9c19b7c0d16073b421769eac294 Signed-off-by: Junghyun Yeon --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 6ca01da..18a431e 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.0 +Version: 0.15.1 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 1eb15f89acdb86cb9285a8313b1c25c3a029a286 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 7 Apr 2020 13:53:57 +0900 Subject: [PATCH 02/16] Add GetArchiveInfo Requires : - [app-installers]https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/228145/ Change-Id: If8ccd2c9b92ab5232c62e6cf4237fbebdc649b6f Signed-off-by: Ilho Kim --- src/hybrid/hybrid_installer.cc | 7 +++++++ src/hybrid/hybrid_installer.h | 1 + src/wgt/CMakeLists.txt | 5 ++++- src/wgt/wgt_installer.cc | 7 +++++++ src/wgt/wgt_installer.h | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index d3accd7..c1c4326 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -26,6 +26,7 @@ #include "hybrid/step/configuration/step_stash_tpk_config.h" #include "hybrid/step/encryption/step_encrypt_hybrid_resources.h" #include "hybrid/step/pkgmgr/step_merge_xml.h" +#include "lib/wgt_archive_info.h" #include "wgt/step/configuration/step_parse.h" #include "wgt/step/configuration/step_set_old_signature_files_location.h" #include "wgt/step/encryption/step_remove_encryption_data.h" @@ -50,6 +51,12 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) context_->backend_data.set(new HybridBackendData()); } +std::unique_ptr HybridInstaller::GetArchiveInfo() { + std::unique_ptr archive_info; + archive_info.reset(new WgtArchiveInfo(pkgmgr_->GetRequestInfo(GetIndex()))); + return archive_info; +} + void HybridInstaller::InstallSteps() { AppInstaller::InstallSteps(); AddStepAfter("CheckInstallable"); diff --git a/src/hybrid/hybrid_installer.h b/src/hybrid/hybrid_installer.h index 2102a55..c595153 100644 --- a/src/hybrid/hybrid_installer.h +++ b/src/hybrid/hybrid_installer.h @@ -24,6 +24,7 @@ namespace hybrid { class HybridInstaller : public common_installer::AppInstaller { public: explicit HybridInstaller(common_installer::PkgMgrPtr pkgmgr); + std::unique_ptr GetArchiveInfo() override; SCOPE_LOG_TAG(HybridInstaller) diff --git a/src/wgt/CMakeLists.txt b/src/wgt/CMakeLists.txt index 9aa1b7b..4a98bc4 100755 --- a/src/wgt/CMakeLists.txt +++ b/src/wgt/CMakeLists.txt @@ -6,6 +6,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/filesystem WGT_STEP_FILESY AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/pkgmgr WGT_STEP_PKGMGR_SRCS) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/security WGT_STEP_SECURITY_SRCS) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/utils WGT_UTILS_SRCS) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../lib LIB_SRCS) # Target - definition ADD_LIBRARY(${TARGET_LIBNAME_WGT} SHARED @@ -15,7 +16,8 @@ ADD_LIBRARY(${TARGET_LIBNAME_WGT} SHARED ${WGT_STEP_FILESYSTEM_SRCS} ${WGT_STEP_PKGMGR_SRCS} ${WGT_STEP_SECURITY_SRCS} - ${WGT_UTILS_SRCS}) + ${WGT_UTILS_SRCS} + ${LIB_SRCS}) # Target - includes TARGET_INCLUDE_DIRECTORIES(${TARGET_LIBNAME_WGT} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../") # Target - deps @@ -26,6 +28,7 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_WGT} PUBLIC PKGMGR_INSTALLER_DEPS ENCRYPTION_DEPS Boost + VCONF_DEPS ) SET_TARGET_PROPERTIES(${TARGET_LIBNAME_WGT} PROPERTIES COMPILE_FLAGS "-fPIC") diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index f064f30..87ff292 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -15,6 +15,7 @@ #include +#include "lib/wgt_archive_info.h" #include "wgt/utils/shared_dirs.h" #include "wgt/step/configuration/step_check_rds_manifest.h" #include "wgt/step/configuration/step_check_start_files.h" @@ -49,6 +50,12 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) context_->backend_data.set(new WgtBackendData()); } +std::unique_ptr WgtInstaller::GetArchiveInfo() { + std::unique_ptr archive_info; + archive_info.reset(new WgtArchiveInfo(pkgmgr_->GetRequestInfo(GetIndex()))); + return archive_info; +} + void WgtInstaller::InstallSteps() { AppInstaller::InstallSteps(); ReplaceStep("ParseManifest", diff --git a/src/wgt/wgt_installer.h b/src/wgt/wgt_installer.h index d0a4c2b..e210622 100644 --- a/src/wgt/wgt_installer.h +++ b/src/wgt/wgt_installer.h @@ -24,6 +24,7 @@ class WgtInstaller : public common_installer::AppInstaller { * \param pkgmgr pointer to pkgmgr */ explicit WgtInstaller(common_installer::PkgMgrPtr pkgrmgr); + std::unique_ptr GetArchiveInfo() override; protected: void InstallSteps() override; -- 2.7.4 From 7349d64e9bbcac23cc00ea5e1c75ed83a4ef2a32 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 24 Mar 2020 15:20:40 +0900 Subject: [PATCH 03/16] Make smoke utils as a library This wgt-smoke-utils library is used at smoke test of unified-installer. Requires: - https://review.tizen.org/gerrit/c/platform/core/appfw/app-installers/+/228720 Change-Id: I7689f92e3699073fbd4c1836e917d06f7470784a Signed-off-by: Sangyoon Jang --- CMakeLists.txt | 1 + packaging/wgt-backend.spec | 2 ++ src/unit_tests/CMakeLists.txt | 16 ++++++++-------- src/unit_tests/extensive_smoke_test.cc | 2 +- src/unit_tests/smoke_test.cc | 2 +- src/unit_tests/{smoke_utils.cc => wgt_smoke_utils.cc} | 4 ++-- src/unit_tests/{smoke_utils.h => wgt_smoke_utils.h} | 12 +++++++----- 7 files changed, 22 insertions(+), 17 deletions(-) rename src/unit_tests/{smoke_utils.cc => wgt_smoke_utils.cc} (98%) rename src/unit_tests/{smoke_utils.h => wgt_smoke_utils.h} (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86b3f98..ff9ec02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ SET(TARGET_SMOKE_TEST "smoke-test") SET(TARGET_SMOKE_TEST_EXTENSIVE "extensive-smoke-test") SET(TARGET_SMOKE_TEST_HELPER "smoke-test-helper") SET(TARGET_MANIFEST_TEST "manifest-test") +SET(TARGET_WGT_SMOKE_UTILS "wgt-smoke-utils") ADD_DEFINITIONS("-DPROJECT_TAG=\"WGT_BACKEND\"") diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 18a431e..e83df85 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -95,6 +95,8 @@ ln -s %{_bindir}/wgt-backend %{buildroot}%{_sysconfdir}/package-manager/backend/ %manifest wgt-installer-tests.manifest %{_bindir}/wgt-installer-ut/* %{_datadir}/wgt-installer-ut/* +%{_libdir}/libwgt-smoke-utils.so* +%{_includedir}/app-installers/unit_tests/wgt_smoke_utils.h %changelog * Thu Dec 18 2015 Pawel Sikorski 0.1-1 diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt index 380ad2d..203e3d7 100644 --- a/src/unit_tests/CMakeLists.txt +++ b/src/unit_tests/CMakeLists.txt @@ -4,13 +4,9 @@ SET(TARGET_SMOKE_UTILS smoke-utils) # Executables ADD_EXECUTABLE(${TARGET_SMOKE_TEST} smoke_test.cc - smoke_utils.h - smoke_utils.cc ) ADD_EXECUTABLE(${TARGET_SMOKE_TEST_EXTENSIVE} extensive_smoke_test.cc - smoke_utils.h - smoke_utils.cc ) ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER} smoke_test_helper.cc @@ -18,6 +14,9 @@ ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER} ADD_EXECUTABLE(${TARGET_MANIFEST_TEST} manifest_test.cc ) +ADD_LIBRARY(${TARGET_WGT_SMOKE_UTILS} SHARED + wgt_smoke_utils.cc +) TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../) TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../) @@ -30,13 +29,11 @@ APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST} PUBLIC Boost GTEST GUM_DEPS - VCONF_DEPS ) APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC Boost GTEST GUM_DEPS - VCONF_DEPS ) APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC Boost @@ -46,12 +43,15 @@ APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC # FindGTest module do not sets all needed libraries in GTEST_LIBRARIES and # GTest main libraries is still missing, so additional linking of # GTEST_MAIN_LIBRARIES is needed. -TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS}) -TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS}) +TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS}) +TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS}) TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_WGT}) TARGET_LINK_LIBRARIES(${TARGET_MANIFEST_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${GTEST_MAIN_LIBRARIES}) +TARGET_LINK_LIBRARIES(${TARGET_WGT_SMOKE_UTILS} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${TARGET_SMOKE_UTILS}) INSTALL(TARGETS ${TARGET_SMOKE_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR}) INSTALL(TARGETS ${TARGET_SMOKE_TEST_EXTENSIVE} DESTINATION ${BINDIR}/${DESTINATION_DIR}) INSTALL(TARGETS ${TARGET_SMOKE_TEST_HELPER} DESTINATION ${BINDIR}/${DESTINATION_DIR}) INSTALL(TARGETS ${TARGET_MANIFEST_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR}) +INSTALL(TARGETS ${TARGET_WGT_SMOKE_UTILS} DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(FILES wgt_smoke_utils.h DESTINATION ${INCLUDEDIR}/app-installers/unit_tests/) diff --git a/src/unit_tests/extensive_smoke_test.cc b/src/unit_tests/extensive_smoke_test.cc index 92abb49..bc4ef46 100644 --- a/src/unit_tests/extensive_smoke_test.cc +++ b/src/unit_tests/extensive_smoke_test.cc @@ -10,7 +10,7 @@ #include #include -#include "unit_tests/smoke_utils.h" +#include "unit_tests/wgt_smoke_utils.h" namespace ci = common_installer; diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 53fc9eb..40a1304 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -11,7 +11,7 @@ #include -#include "unit_tests/smoke_utils.h" +#include "unit_tests/wgt_smoke_utils.h" namespace st = smoke_test; namespace bf = boost::filesystem; diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/wgt_smoke_utils.cc similarity index 98% rename from src/unit_tests/smoke_utils.cc rename to src/unit_tests/wgt_smoke_utils.cc index 44c8158..d467315 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/wgt_smoke_utils.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by an apache-2.0 license that can be // found in the LICENSE file. +#include "unit_tests/wgt_smoke_utils.h" + #include #include @@ -11,8 +13,6 @@ #include "wgt/wgt_installer.h" #include "hybrid/hybrid_installer.h" -#include "unit_tests/smoke_utils.h" - namespace ci = common_installer; namespace st = smoke_test; diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/wgt_smoke_utils.h similarity index 96% rename from src/unit_tests/smoke_utils.h rename to src/unit_tests/wgt_smoke_utils.h index 14e0994..6de6b32 100644 --- a/src/unit_tests/smoke_utils.h +++ b/src/unit_tests/wgt_smoke_utils.h @@ -2,8 +2,8 @@ // Use of this source code is governed by an apache-2.0 license that can be // found in the LICENSE file. -#ifndef UNIT_TESTS_SMOKE_UTILS_H_ -#define UNIT_TESTS_SMOKE_UTILS_H_ +#ifndef UNIT_TESTS_WGT_SMOKE_UTILS_H_ +#define UNIT_TESTS_WGT_SMOKE_UTILS_H_ #include #include @@ -38,7 +38,7 @@ class WgtBackendInterface: public BackendInterface { public: using BackendInterface::BackendInterface; - private: +// private: AppQueryInterfacePtr CreateQueryInterface() const override; AppInstallerPtr CreateInstaller( common_installer::PkgMgrPtr pkgmgr) const override; @@ -50,7 +50,6 @@ class HybridBackendInterface: public BackendInterface { public: using BackendInterface::BackendInterface; - private: AppQueryInterfacePtr CreateQueryInterface() const override; AppInstallerPtr CreateInstaller( common_installer::PkgMgrPtr pkgmgr) const override; @@ -58,6 +57,9 @@ class HybridBackendInterface: public BackendInterface { common_installer::PkgMgrPtr pkgmgr, int fail_at) const override; }; +#ifdef OVERRIDE_STEPS_BLOCK +#undef OVERRIDE_STEPS_BLOCK +#endif #define OVERRIDE_STEPS_BLOCK(TYPE, STEPS) \ void STEPS() override { \ TYPE::STEPS(); \ @@ -132,4 +134,4 @@ class FailExpectedHybridInstaller : public hybrid::HybridInstaller { } // namespace smoke_test -#endif // UNIT_TESTS_SMOKE_UTILS_H_ +#endif // UNIT_TESTS_WGT_SMOKE_UTILS_H_ -- 2.7.4 From e19b3a98b0211c9aaba1e7084a306ec5556647e8 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 24 Mar 2020 20:08:04 +0900 Subject: [PATCH 04/16] Move CrashWgtInstaller class to wgt-smoke-utils This class can be used at other test, such as smoke test of unified-installer. Change-Id: Iaaed178a2a5c29a3cf213f29b2f1e025e3c1e886 Signed-off-by: Sangyoon Jang --- src/unit_tests/CMakeLists.txt | 2 +- src/unit_tests/smoke_test_helper.cc | 89 +++---------------------------------- src/unit_tests/wgt_smoke_utils.h | 48 ++++++++++++++++++++ 3 files changed, 54 insertions(+), 85 deletions(-) diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt index 203e3d7..4523d05 100644 --- a/src/unit_tests/CMakeLists.txt +++ b/src/unit_tests/CMakeLists.txt @@ -45,7 +45,7 @@ APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC # GTEST_MAIN_LIBRARIES is needed. TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS}) TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS}) -TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_WGT}) +TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_WGT_SMOKE_UTILS}) TARGET_LINK_LIBRARIES(${TARGET_MANIFEST_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${GTEST_MAIN_LIBRARIES}) TARGET_LINK_LIBRARIES(${TARGET_WGT_SMOKE_UTILS} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${TARGET_SMOKE_UTILS}) diff --git a/src/unit_tests/smoke_test_helper.cc b/src/unit_tests/smoke_test_helper.cc index 6e8643c..0c0e6f4 100644 --- a/src/unit_tests/smoke_test_helper.cc +++ b/src/unit_tests/smoke_test_helper.cc @@ -3,99 +3,20 @@ // found in the LICENSE file. #include -#include +#include +#include "unit_tests/wgt_smoke_utils.h" #include "wgt/utils/wgt_app_query_interface.h" #include "wgt/wgt_installer.h" namespace ci = common_installer; -namespace { - -enum class CrashStepType { - PROCESS, - CLEAN -}; - -class StepCrash : public ci::Step { - public: - using Step::Step; - - explicit StepCrash(ci::InstallerContext* context, CrashStepType type) : - ci::Step::Step(context), type_(type) {} - - ci::Step::Status process() override { - if (type_ == CrashStepType::PROCESS) - raise(SIGSEGV); - return Status::OK; - } - ci::Step::Status clean() override { - if (type_ == CrashStepType::CLEAN) - raise(SIGSEGV); - return Status::OK; - } - ci::Step::Status undo() override { return ci::Step::Status::OK; } - ci::Step::Status precheck() override { return ci::Step::Status::OK; } - - STEP_NAME(Crash) - - private: - CrashStepType type_; -}; - -#define OVERRIDE_STEPS_BLOCK(STEPS) \ - void STEPS() override { \ - wgt::WgtInstaller::STEPS(); \ - if (crash_at_ > -1) \ - AddStepAtIndex(crash_at_, type_); \ - else if (step_name_.size()) \ - AddStepAfter(step_name_, type_); \ - else \ - AddStep(type_); \ - } \ - -class CrashWgtInstaller : public wgt::WgtInstaller { - public: - explicit CrashWgtInstaller(ci::PkgMgrPtr pkgmgr, int crash_at, - std::string step_name, CrashStepType type) : - wgt::WgtInstaller(pkgmgr), crash_at_(crash_at), - step_name_(step_name), type_(type) { } - - private: - OVERRIDE_STEPS_BLOCK(InstallSteps) - OVERRIDE_STEPS_BLOCK(UpdateSteps) - OVERRIDE_STEPS_BLOCK(UninstallSteps) - OVERRIDE_STEPS_BLOCK(ReinstallSteps) - OVERRIDE_STEPS_BLOCK(DeltaSteps) - OVERRIDE_STEPS_BLOCK(MoveSteps) - OVERRIDE_STEPS_BLOCK(RecoverySteps) - OVERRIDE_STEPS_BLOCK(MountInstallSteps) - OVERRIDE_STEPS_BLOCK(MountUpdateSteps) - OVERRIDE_STEPS_BLOCK(ManifestDirectInstallSteps) - OVERRIDE_STEPS_BLOCK(ManifestDirectUpdateSteps) - OVERRIDE_STEPS_BLOCK(ManifestPartialInstallSteps) - OVERRIDE_STEPS_BLOCK(ManifestPartialUpdateSteps) - OVERRIDE_STEPS_BLOCK(PartialUninstallSteps) - OVERRIDE_STEPS_BLOCK(ReadonlyUpdateInstallSteps) - OVERRIDE_STEPS_BLOCK(ReadonlyUpdateUninstallSteps) - OVERRIDE_STEPS_BLOCK(DisablePkgSteps) - OVERRIDE_STEPS_BLOCK(EnablePkgSteps) - OVERRIDE_STEPS_BLOCK(MigrateExtImgSteps) - OVERRIDE_STEPS_BLOCK(RecoverDBSteps) - - int crash_at_; - std::string step_name_; - CrashStepType type_; -}; - -} // namespace - // this main of test binay in done purely for recovery smoke test. int main(int argc, char** argv) { int index = -1; int backend_argc = argc; std::string step_name; - CrashStepType type = CrashStepType::PROCESS; + smoke_test::CrashStepType type = smoke_test::CrashStepType::PROCESS; if (!strcmp(argv[backend_argc - 2], "-idx")) { index = atoi(argv[argc - 1]); @@ -111,7 +32,7 @@ int main(int argc, char** argv) { if (!strcmp(argv[backend_argc - 1], "-type_clean")) { backend_argc--; - type = CrashStepType::CLEAN; + type = smoke_test::CrashStepType::CLEAN; LOG(DEBUG) << "step will be crashed in clean operation"; } @@ -124,7 +45,7 @@ int main(int argc, char** argv) { return EINVAL; } - ::CrashWgtInstaller installer(pkgmgr, index, step_name, type); + smoke_test::CrashWgtInstaller installer(pkgmgr, index, step_name, type); return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } diff --git a/src/unit_tests/wgt_smoke_utils.h b/src/unit_tests/wgt_smoke_utils.h index 6de6b32..3aa4ec7 100644 --- a/src/unit_tests/wgt_smoke_utils.h +++ b/src/unit_tests/wgt_smoke_utils.h @@ -131,6 +131,54 @@ class FailExpectedHybridInstaller : public hybrid::HybridInstaller { int fail_at_; }; +#ifdef OVERRIDE_STEPS_BLOCK +#undef OVERRIDE_STEPS_BLOCK +#endif +#define OVERRIDE_STEPS_BLOCK(STEPS) \ + void STEPS() override { \ + wgt::WgtInstaller::STEPS(); \ + if (crash_at_ > -1) \ + AddStepAtIndex(crash_at_, type_); \ + else if (step_name_.size()) \ + AddStepAfter(step_name_, type_); \ + else \ + AddStep(type_); \ + } \ + +class CrashWgtInstaller : public wgt::WgtInstaller { + public: + explicit CrashWgtInstaller(common_installer::PkgMgrPtr pkgmgr, int crash_at, + std::string step_name, CrashStepType type) : + wgt::WgtInstaller(pkgmgr), crash_at_(crash_at), + step_name_(step_name), type_(type) { } + + private: + OVERRIDE_STEPS_BLOCK(InstallSteps) + OVERRIDE_STEPS_BLOCK(UpdateSteps) + OVERRIDE_STEPS_BLOCK(UninstallSteps) + OVERRIDE_STEPS_BLOCK(ReinstallSteps) + OVERRIDE_STEPS_BLOCK(DeltaSteps) + OVERRIDE_STEPS_BLOCK(MoveSteps) + OVERRIDE_STEPS_BLOCK(RecoverySteps) + OVERRIDE_STEPS_BLOCK(MountInstallSteps) + OVERRIDE_STEPS_BLOCK(MountUpdateSteps) + OVERRIDE_STEPS_BLOCK(ManifestDirectInstallSteps) + OVERRIDE_STEPS_BLOCK(ManifestDirectUpdateSteps) + OVERRIDE_STEPS_BLOCK(ManifestPartialInstallSteps) + OVERRIDE_STEPS_BLOCK(ManifestPartialUpdateSteps) + OVERRIDE_STEPS_BLOCK(PartialUninstallSteps) + OVERRIDE_STEPS_BLOCK(ReadonlyUpdateInstallSteps) + OVERRIDE_STEPS_BLOCK(ReadonlyUpdateUninstallSteps) + OVERRIDE_STEPS_BLOCK(DisablePkgSteps) + OVERRIDE_STEPS_BLOCK(EnablePkgSteps) + OVERRIDE_STEPS_BLOCK(MigrateExtImgSteps) + OVERRIDE_STEPS_BLOCK(RecoverDBSteps) + + int crash_at_; + std::string step_name_; + CrashStepType type_; +}; + } // namespace smoke_test -- 2.7.4 From f1edc8e50bf2b25b58be686b4719e40178b3b2f9 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 14 Apr 2020 13:40:54 +0900 Subject: [PATCH 05/16] Fix ReadonlyUpdateInstallSteps base step name Relates : - [app-installers]https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/230753/ Change-Id: Ia933be951e9facedfb0095995b6666b51fe3a0c4 Signed-off-by: Ilho Kim --- src/hybrid/hybrid_installer.cc | 2 +- src/wgt/wgt_installer.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index c1c4326..37ac600 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -380,7 +380,7 @@ void HybridInstaller::ReadonlyUpdateInstallSteps() { AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStepAfter( - "CreateStorageDirectories"); + "UpdateStorageDirectories"); } void HybridInstaller::ReadonlyUpdateUninstallSteps() { diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 87ff292..12f151c 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -293,7 +293,7 @@ void WgtInstaller::ReadonlyUpdateInstallSteps() { "CreateWgtSymbolicLink"); AddStepAfter("CheckExtensionPrivileges"); AddStepAfter( - "CreateStorageDirectories"); + "UpdateStorageDirectories"); } void WgtInstaller::ReadonlyUpdateUninstallSteps() { -- 2.7.4 From 636733b2230362869af9d1086173ffb0ec679efa Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Tue, 12 May 2020 22:59:49 -0700 Subject: [PATCH 06/16] Change wrt-service symlink to wrt-service-launcher The wrt-service has been changed with wrt-service-launcher to launch service daemon properly. Change-Id: Ie0377742be3e9bde23ba6dbfda69a3addd2b3cbd Signed-off-by: Youngsoo Choi --- src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc index 8581504..c6ea4fd 100644 --- a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc @@ -22,7 +22,7 @@ namespace bs = boost::system; namespace { -const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service"; +const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service-launcher"; const char kWebWidgetRuntimeBinaryPath[] = "/usr/bin/web-widget-runtime"; const char kWRTPath[] = "/usr/bin/wrt"; -- 2.7.4 From 948b1829aba80028de02dcbaf4cd047a3c995fe5 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Fri, 17 Apr 2020 17:06:10 +0900 Subject: [PATCH 07/16] Add WgtInstallerFactory and HybridInstallerFactory Now wgt-backend uses installer-runner to run the installer Change-Id: I801c452dcaababf77527de54876957689d48974f Signed-off-by: Ilho Kim --- src/hybrid/hybrid_installer_factory.cc | 37 ++++++++++++++++++++++++++++++++++ src/hybrid/hybrid_installer_factory.h | 27 +++++++++++++++++++++++++ src/wgt/wgt_installer_factory.cc | 37 ++++++++++++++++++++++++++++++++++ src/wgt/wgt_installer_factory.h | 27 +++++++++++++++++++++++++ src/wgt_backend/wgt_backend.cc | 27 +++++++++++++++++++++---- 5 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 src/hybrid/hybrid_installer_factory.cc create mode 100644 src/hybrid/hybrid_installer_factory.h create mode 100644 src/wgt/wgt_installer_factory.cc create mode 100644 src/wgt/wgt_installer_factory.h diff --git a/src/hybrid/hybrid_installer_factory.cc b/src/hybrid/hybrid_installer_factory.cc new file mode 100644 index 0000000..52c5395 --- /dev/null +++ b/src/hybrid/hybrid_installer_factory.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by an apache-2.0 license that can be +// found in the LICENSE file. + +#include "hybrid/hybrid_installer_factory.h" + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "common/pkgmgr_interface.h" +#include "common/pkgmgr_query.h" + +namespace ci = common_installer; + +namespace hybrid { + +std::unique_ptr HybridInstallerFactory::CreateInstaller( + ci::PkgMgrPtr pkgmgr, int idx) { + std::unique_ptr installer; + wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface(); + + pkgmgr->AddAppQueryInterface(idx, wgt_aqi); + installer.reset(new hybrid::HybridInstaller(pkgmgr)); + installer->SetIndex(idx); + + return installer; +} + +} // namespace hybrid diff --git a/src/hybrid/hybrid_installer_factory.h b/src/hybrid/hybrid_installer_factory.h new file mode 100644 index 0000000..f93bb76 --- /dev/null +++ b/src/hybrid/hybrid_installer_factory.h @@ -0,0 +1,27 @@ +// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by an apache-2.0 license that can be +// found in the LICENSE file. + +#ifndef HYBRID_HYBRID_INSTALLER_FACTORY_H_ +#define HYBRID_HYBRID_INSTALLER_FACTORY_H_ + +#include +#include + +#include + +namespace ci = common_installer; + +namespace hybrid { + +class AppInstaller; + +class HybridInstallerFactory : public ci::InstallerFactory { + public: + std::unique_ptr CreateInstaller( + ci::PkgMgrPtr pkgmgr, int idx); +}; + +} // namespace hybrid + +#endif // HYBRID_HYBRID_INSTALLER_FACTORY_H_ diff --git a/src/wgt/wgt_installer_factory.cc b/src/wgt/wgt_installer_factory.cc new file mode 100644 index 0000000..e826ee2 --- /dev/null +++ b/src/wgt/wgt_installer_factory.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by an apache-2.0 license that can be +// found in the LICENSE file. + +#include "wgt/wgt_installer_factory.h" + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "common/pkgmgr_interface.h" +#include "common/pkgmgr_query.h" + +namespace ci = common_installer; + +namespace wgt { + +std::unique_ptr WgtInstallerFactory::CreateInstaller( + ci::PkgMgrPtr pkgmgr, int idx) { + std::unique_ptr installer; + WgtAppQueryInterface* wgt_aqi = new WgtAppQueryInterface(); + + pkgmgr->AddAppQueryInterface(idx, wgt_aqi); + installer.reset(new wgt::WgtInstaller(pkgmgr)); + installer->SetIndex(idx); + + return installer; +} + +} // namespace wgt diff --git a/src/wgt/wgt_installer_factory.h b/src/wgt/wgt_installer_factory.h new file mode 100644 index 0000000..dd1ff4f --- /dev/null +++ b/src/wgt/wgt_installer_factory.h @@ -0,0 +1,27 @@ +// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by an apache-2.0 license that can be +// found in the LICENSE file. + +#ifndef WGT_WGT_INSTALLER_FACTORY_H_ +#define WGT_WGT_INSTALLER_FACTORY_H_ + +#include +#include + +#include + +namespace ci = common_installer; + +namespace wgt { + +class AppInstaller; + +class WgtInstallerFactory : public ci::InstallerFactory { + public: + std::unique_ptr CreateInstaller( + ci::PkgMgrPtr pkgmgr, int idx); +}; + +} // namespace wgt + +#endif // WGT_WGT_INSTALLER_FACTORY_H_ diff --git a/src/wgt_backend/wgt_backend.cc b/src/wgt_backend/wgt_backend.cc index 9f003e3..c72e135 100644 --- a/src/wgt_backend/wgt_backend.cc +++ b/src/wgt_backend/wgt_backend.cc @@ -3,34 +3,53 @@ // Use of this source code is governed by a apache 2.0 license that can be // found in the LICENSE file. +#include #include #include #include "hybrid/hybrid_installer.h" +#include "hybrid/hybrid_installer_factory.h" #include "wgt/utils/wgt_app_query_interface.h" #include "wgt/wgt_installer.h" +#include "wgt/wgt_installer_factory.h" namespace ci = common_installer; +#if __cplusplus < 201300L +namespace { + +template +std::unique_ptr make_unique(Args&&... args) { + return std::unique_ptr(new T(std::forward(args)...)); +} + +} // namespace +#endif + int main(int argc, char** argv) { ci::PkgmgrInstaller pkgmgr_installer; wgt::WgtAppQueryInterface query_interface; auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer, &query_interface); + std::unique_ptr installer_factory; if (!pkgmgr) { LOG(ERROR) << "Options of pkgmgr installer cannot be parsed"; return EINVAL; } +#if __cplusplus >= 201300L + using std; +#endif // This is workaround for hybrid apps as they requires much different flow // but installer does not branch at all in current design if (query_interface.IsHybridApplication( pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) { LOG(INFO) << "Hybrid package detected"; - hybrid::HybridInstaller installer(pkgmgr); - return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; + ci::InstallerRunner runner( + make_unique(), pkgmgr); + return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } else { - wgt::WgtInstaller installer(pkgmgr); - return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; + ci::InstallerRunner runner(make_unique(), pkgmgr); + return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } } -- 2.7.4 From 9492f8462e01aedbd262652fbfb0783800f078e6 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Mon, 1 Jun 2020 11:29:59 +0900 Subject: [PATCH 08/16] Release version 0.15.2 Changes: - Add GetArchiveInfo - Make smoke utils as a library - Move CrashWgtInstaller class to wgt-smoke-utils - Fix ReadonlyUpdateInstallSteps base step name - Change wrt-service symlink to wrt-service-launcher - Add WgtInstallerFactory and HybridInstallerFactory Change-Id: Ia4d702d7f8dee66ac49eb2009acb07e56b26735c Signed-off-by: Ilho Kim --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index e83df85..20b7224 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.1 +Version: 0.15.2 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 72925c80c61285e2bc28c1dbe3570055772eb63c Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Thu, 4 Jun 2020 13:31:11 +0900 Subject: [PATCH 09/16] Change routine to check start file If webapp has not ui application and all service app's type global, routine to check start file is skipped Change-Id: I5108a635525181cbeba8596b27b622914a58bb0d Signed-off-by: Ilho Kim --- src/wgt/step/configuration/step_parse.cc | 54 +++++++++++++++++--------------- src/wgt/step/configuration/step_parse.h | 1 + 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index b544181..757a3c6 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -161,7 +161,8 @@ StepParse::StepParse(common_installer::InstallerContext* context, bool check_start_file) : Step(context), config_location_(config_location), - check_start_file_(check_start_file) { + check_start_file_(check_start_file), + ui_app_not_exists_(false) { } std::set StepParse::ExtractPrivileges( @@ -368,6 +369,7 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { return true; if (app_info.get()->id().empty()) { + ui_app_not_exists_ = true; if (!AllServiceAppGlobal()) { LOG(ERROR) << "Empty of ui app's id is possible" << " when service app types are all global"; @@ -949,30 +951,6 @@ common_installer::Step::Status StepParse::process() { return common_installer::Step::Status::PARSE_ERROR; } - WgtBackendData* backend_data = - static_cast(context_->backend_data.get()); - - if (check_start_file_) { - if (!parser_->CheckValidStartFile()) { - LOG(ERROR) << parser_->GetErrorMessage(); - return common_installer::Step::Status::PARSE_ERROR; - } - if (!parser_->CheckValidServicesStartFiles()) { - LOG(ERROR) << parser_->GetErrorMessage(); - return common_installer::Step::Status::PARSE_ERROR; - } - } else { - // making backup of content data and services content data - auto content_info = GetManifestDataForKey( - app_keys::kTizenContentKey); - auto service_list = GetManifestDataForKey( - app_keys::kTizenServiceKey); - if (content_info) - backend_data->content.set(*content_info); - if (service_list) - backend_data->service_list.set(*service_list); - } - // Copy data from ManifestData to InstallerContext auto info = GetManifestDataForKey( app_keys::kTizenApplicationKey); @@ -1014,6 +992,32 @@ common_installer::Step::Status StepParse::process() { return common_installer::Step::Status::PARSE_ERROR; } + WgtBackendData* backend_data = + static_cast(context_->backend_data.get()); + + if (check_start_file_) { + if (!ui_app_not_exists_ && !parser_->CheckValidStartFile()) { + LOG(ERROR) << parser_->GetErrorMessage(); + pkgmgr_parser_free_manifest_xml(manifest); + return common_installer::Step::Status::PARSE_ERROR; + } + if (!parser_->CheckValidServicesStartFiles()) { + LOG(ERROR) << parser_->GetErrorMessage(); + pkgmgr_parser_free_manifest_xml(manifest); + return common_installer::Step::Status::PARSE_ERROR; + } + } else { + // making backup of content data and services content data + auto content_info = GetManifestDataForKey( + app_keys::kTizenContentKey); + auto service_list = GetManifestDataForKey( + app_keys::kTizenServiceKey); + if (content_info) + backend_data->content.set(*content_info); + if (service_list) + backend_data->service_list.set(*service_list); + } + context_->pkgid.set(manifest->package); // write pkgid for recovery file diff --git a/src/wgt/step/configuration/step_parse.h b/src/wgt/step/configuration/step_parse.h index c4afe3a..55cd0d7 100644 --- a/src/wgt/step/configuration/step_parse.h +++ b/src/wgt/step/configuration/step_parse.h @@ -81,6 +81,7 @@ class StepParse : public common_installer::Step { std::unique_ptr parser_; ConfigLocation config_location_; bool check_start_file_; + bool ui_app_not_exists_; template std::shared_ptr GetManifestDataForKey(const std::string& key) { -- 2.7.4 From 7517cbcd46dbef6933f759344d5ab54bbbebc43d Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 12 Jun 2020 15:58:44 +0900 Subject: [PATCH 10/16] Release version 0.15.3 Changes: - Change routine to check start file Change-Id: I53583f7060e739cda0f61e0d50230b7167079a45 Signed-off-by: Junghyun Yeon --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 20b7224..bd96389 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.2 +Version: 0.15.3 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From e875b1443f706b9b4be8dadbf4603e986212f802 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Wed, 17 Jun 2020 16:03:56 +0900 Subject: [PATCH 11/16] Fix WgtArchiveInfo Allow addon only wgt package. Change-Id: I78a2c71f6dbbed09e47d40f9c17ee5c5c313587c Signed-off-by: Sangyoon Jang --- src/lib/wgt_archive_info.cc | 46 +++++++++++++++++++++++++++++++++++++++------ src/lib/wgt_archive_info.h | 2 ++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/lib/wgt_archive_info.cc b/src/lib/wgt_archive_info.cc index 4f5a18b..df7efc2 100644 --- a/src/lib/wgt_archive_info.cc +++ b/src/lib/wgt_archive_info.cc @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -47,20 +48,44 @@ bool WgtArchiveInfo::GetPackageInfo( auto widget_info = std::static_pointer_cast( parser.GetManifestData(wgt::parse::WidgetInfo::Key())); + if (!widget_info) { + LOG(ERROR) << "WidgetInfo not found"; + return false; + } + + type_ = "wgt"; + version_ = widget_info->version().c_str(); + author_ = widget_info->author().c_str(); + + return true; +} + +bool WgtArchiveInfo::GetApplicationInfo( + const wgt::parse::WidgetConfigParser& parser) { auto app_info = std::static_pointer_cast( parser.GetManifestData(wgt::parse::TizenApplicationInfo::Key())); - if (!widget_info || !app_info) { - LOG(ERROR) << "WidgetInfo / TizenApplicationInfo not found"; + if (!app_info) return false; - } - type_ = "wgt"; name_ = app_info->package().c_str(); pkgid_ = app_info->package().c_str(); - version_ = widget_info->version().c_str(); api_version_ = app_info->required_version().c_str(); - author_ = widget_info->author().c_str(); + + return true; +} + +bool WgtArchiveInfo::GetAddonInfo( + const wgt::parse::WidgetConfigParser& parser) { + auto addon_info = + std::static_pointer_cast( + parser.GetManifestData(wgt::parse::AddonInfo::Key())); + if (!addon_info) + return false; + + name_ = addon_info->package().c_str(); + pkgid_ = addon_info->package().c_str(); + api_version_ = addon_info->required_version().c_str(); return true; } @@ -203,6 +228,15 @@ bool WgtArchiveInfo::LoadArchiveInfo() { bf::remove_all(tmp_dir); return false; } + if (!GetApplicationInfo(parser)) { + if (!GetAddonInfo(parser)) { + LOG(ERROR) << "Failed to get application info nor addon info. " + << "At least one of them must exist"; + bf::remove_all(tmp_dir); + return false; + } + } + if (!GetPrivilegesInfo(parser)) LOG(WARNING) << "Failed to get privileges info"; if (!GetIconInfo(parser)) diff --git a/src/lib/wgt_archive_info.h b/src/lib/wgt_archive_info.h index 085bb47..debc32c 100644 --- a/src/lib/wgt_archive_info.h +++ b/src/lib/wgt_archive_info.h @@ -23,6 +23,8 @@ class WgtArchiveInfo : public common_installer::ArchiveInfo { private: bool GetPackageInfo(const wgt::parse::WidgetConfigParser& parser); + bool GetApplicationInfo(const wgt::parse::WidgetConfigParser& parser); + bool GetAddonInfo(const wgt::parse::WidgetConfigParser& parser); bool GetPrivilegesInfo(const wgt::parse::WidgetConfigParser& parser); bool GetIconInfo(const wgt::parse::WidgetConfigParser& parser); bool ReadIcon(const bf::path& icon, const bf::path& tmp_dir); -- 2.7.4 From c9687915743c9ca70b2347cb460c2bdffad706c5 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Wed, 17 Jun 2020 16:23:43 +0900 Subject: [PATCH 12/16] Release version 0.15.4 Changes: - Fix WgtArchiveInfo Change-Id: I251da6505d0e93b045d5721a1f9fb15a4b0b6a92 Signed-off-by: Sangyoon Jang --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index bd96389..65bdfc6 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.3 +Version: 0.15.4 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 52b547ac35c47af9cbfa7208bf85591f4db2f4cd Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 2 Jun 2020 17:16:48 +0900 Subject: [PATCH 13/16] Add InstallerWithoutPasrserPlugins for test This installer runs without parser plugin Change-Id: I4ed03253d9144616a58674c896971311b17a9a4c Signed-off-by: Ilho Kim --- src/unit_tests/wgt_smoke_utils.h | 109 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/src/unit_tests/wgt_smoke_utils.h b/src/unit_tests/wgt_smoke_utils.h index 3aa4ec7..8c5e0ef 100644 --- a/src/unit_tests/wgt_smoke_utils.h +++ b/src/unit_tests/wgt_smoke_utils.h @@ -179,6 +179,115 @@ class CrashWgtInstaller : public wgt::WgtInstaller { CrashStepType type_; }; +#ifdef OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS +#undef OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS +#endif +#define OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS(TYPE, STEPS) \ + void STEPS() override { \ + TYPE::STEPS(); \ + RemoveStep("RunParserPlugin"); \ + } \ + +class WgtInstallerWithoutPasrserPlugins : public wgt::WgtInstaller { + public: + explicit WgtInstallerWithoutPasrserPlugins( + common_installer::PkgMgrPtr pkgmgr) : wgt::WgtInstaller(pkgmgr) { } + + private: + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, InstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, UpdateSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, UninstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, ReinstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, DeltaSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, MoveSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, MountInstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, MountUpdateSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, ManifestDirectInstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, ManifestDirectUpdateSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, ManifestPartialInstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, ManifestPartialUpdateSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, PartialUninstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, ReadonlyUpdateInstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, ReadonlyUpdateUninstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, DisablePkgSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, EnablePkgSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, MigrateExtImgSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + wgt::WgtInstaller, RecoverDBSteps) + void RecoverySteps() override { + wgt::WgtInstaller::RecoverySteps(); + RemoveStep("RecoverParserPlugin"); + } +}; + +class HybridInstallerWithoutPasrserPlugins : public hybrid::HybridInstaller { + public: + explicit HybridInstallerWithoutPasrserPlugins( + common_installer::PkgMgrPtr pkgmgr) : hybrid::HybridInstaller(pkgmgr) { } + + private: + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, InstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, UpdateSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, UninstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, ReinstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, DeltaSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, MoveSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, MountInstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, MountUpdateSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, ManifestDirectInstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, ManifestDirectUpdateSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, ManifestPartialInstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, ManifestPartialUpdateSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, PartialUninstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, ReadonlyUpdateInstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, ReadonlyUpdateUninstallSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, DisablePkgSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, EnablePkgSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, MigrateExtImgSteps) + OVERRIDE_STEPS_BLOCK_WITHOUT_PARSER_PLUGINS( + hybrid::HybridInstaller, RecoverDBSteps) + void RecoverySteps() override { + hybrid::HybridInstaller::RecoverySteps(); + RemoveStep("RecoverParserPlugin"); + } +}; + } // namespace smoke_test -- 2.7.4 From 56072f09e758ec479aa3774758316da7c97bcc69 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 2 Jul 2020 09:46:44 +0900 Subject: [PATCH 14/16] Change filepath Its path has changed. Related changes: [app-installers] : https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/237608 Change-Id: I29b2a771da487cd56649a185c050620dff4254c5 Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_installer.h | 2 +- src/hybrid/hybrid_installer_factory.cc | 2 +- src/unit_tests/manifest_test.cc | 2 +- src/unit_tests/smoke_test.cc | 2 +- src/unit_tests/wgt_smoke_utils.h | 2 +- src/wgt/step/configuration/step_check_start_files.cc | 2 +- src/wgt/step/configuration/step_check_start_files.h | 2 +- src/wgt/step/configuration/step_parse.cc | 6 +++--- src/wgt/step/configuration/step_parse.h | 2 +- src/wgt/step/configuration/step_parse_recovery.cc | 2 +- src/wgt/step/filesystem/step_copy_preview_icons.h | 2 +- src/wgt/step/filesystem/step_create_wgt_symbolic_link.h | 2 +- src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc | 2 +- src/wgt/step/filesystem/step_wgt_resource_directory.h | 2 +- src/wgt/step/filesystem/step_wgt_update_package_directory.cc | 2 +- src/wgt/step/security/step_add_default_privileges.h | 2 +- src/wgt/step/security/step_check_extension_privileges.h | 2 +- src/wgt/step/security/step_check_settings_level.h | 2 +- src/wgt/utils/wgt_app_query_interface.cc | 4 ++-- src/wgt/wgt_installer.h | 2 +- src/wgt/wgt_installer_factory.cc | 2 +- 21 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/hybrid/hybrid_installer.h b/src/hybrid/hybrid_installer.h index c595153..cc07dff 100644 --- a/src/hybrid/hybrid_installer.h +++ b/src/hybrid/hybrid_installer.h @@ -5,7 +5,7 @@ #ifndef HYBRID_HYBRID_INSTALLER_H_ #define HYBRID_HYBRID_INSTALLER_H_ -#include "common/app_installer.h" +#include "common/installer/app_installer.h" #include "common/pkgmgr_interface.h" namespace ci = common_installer; diff --git a/src/hybrid/hybrid_installer_factory.cc b/src/hybrid/hybrid_installer_factory.cc index 52c5395..ed9cf2a 100644 --- a/src/hybrid/hybrid_installer_factory.cc +++ b/src/hybrid/hybrid_installer_factory.cc @@ -16,7 +16,7 @@ #include #include "common/pkgmgr_interface.h" -#include "common/pkgmgr_query.h" +#include "common/utils/pkgmgr_query.h" namespace ci = common_installer; diff --git a/src/unit_tests/manifest_test.cc b/src/unit_tests/manifest_test.cc index ca90c26..56549d0 100644 --- a/src/unit_tests/manifest_test.cc +++ b/src/unit_tests/manifest_test.cc @@ -5,8 +5,8 @@ #include #include -#include #include +#include #include diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 40a1304..2157903 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include diff --git a/src/unit_tests/wgt_smoke_utils.h b/src/unit_tests/wgt_smoke_utils.h index 8c5e0ef..51d82a9 100644 --- a/src/unit_tests/wgt_smoke_utils.h +++ b/src/unit_tests/wgt_smoke_utils.h @@ -5,7 +5,7 @@ #ifndef UNIT_TESTS_WGT_SMOKE_UTILS_H_ #define UNIT_TESTS_WGT_SMOKE_UTILS_H_ -#include +#include #include #include #include diff --git a/src/wgt/step/configuration/step_check_start_files.cc b/src/wgt/step/configuration/step_check_start_files.cc index c39474b..e1c2b42 100644 --- a/src/wgt/step/configuration/step_check_start_files.cc +++ b/src/wgt/step/configuration/step_check_start_files.cc @@ -6,7 +6,7 @@ #include -#include +#include #include #include diff --git a/src/wgt/step/configuration/step_check_start_files.h b/src/wgt/step/configuration/step_check_start_files.h index 31f42d5..31424c0 100644 --- a/src/wgt/step/configuration/step_check_start_files.h +++ b/src/wgt/step/configuration/step_check_start_files.h @@ -6,7 +6,7 @@ #include -#include +#include #include #include diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 757a3c6..8c97c72 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -7,10 +7,10 @@ #include -#include -#include +#include +#include #include -#include +#include #include #include #include diff --git a/src/wgt/step/configuration/step_parse.h b/src/wgt/step/configuration/step_parse.h index 55cd0d7..0480048 100644 --- a/src/wgt/step/configuration/step_parse.h +++ b/src/wgt/step/configuration/step_parse.h @@ -6,7 +6,7 @@ #include -#include +#include #include #include diff --git a/src/wgt/step/configuration/step_parse_recovery.cc b/src/wgt/step/configuration/step_parse_recovery.cc index 728a19e..6d8bee9 100644 --- a/src/wgt/step/configuration/step_parse_recovery.cc +++ b/src/wgt/step/configuration/step_parse_recovery.cc @@ -4,7 +4,7 @@ #include "wgt/step/configuration/step_parse_recovery.h" -#include +#include #include namespace { diff --git a/src/wgt/step/filesystem/step_copy_preview_icons.h b/src/wgt/step/filesystem/step_copy_preview_icons.h index 5a51d83..cf843b9 100644 --- a/src/wgt/step/filesystem/step_copy_preview_icons.h +++ b/src/wgt/step/filesystem/step_copy_preview_icons.h @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h index a91cbf1..548baab 100644 --- a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h @@ -9,7 +9,7 @@ #include -#include +#include #include #include diff --git a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc index 3ac814c..5b2bb0f 100644 --- a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include diff --git a/src/wgt/step/filesystem/step_wgt_resource_directory.h b/src/wgt/step/filesystem/step_wgt_resource_directory.h index f81ebd5..af811fe 100644 --- a/src/wgt/step/filesystem/step_wgt_resource_directory.h +++ b/src/wgt/step/filesystem/step_wgt_resource_directory.h @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/src/wgt/step/filesystem/step_wgt_update_package_directory.cc b/src/wgt/step/filesystem/step_wgt_update_package_directory.cc index efe6be8..9cb801d 100644 --- a/src/wgt/step/filesystem/step_wgt_update_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_update_package_directory.cc @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace bf = boost::filesystem; diff --git a/src/wgt/step/security/step_add_default_privileges.h b/src/wgt/step/security/step_add_default_privileges.h index 84c7bca..fc0671a 100644 --- a/src/wgt/step/security/step_add_default_privileges.h +++ b/src/wgt/step/security/step_add_default_privileges.h @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/src/wgt/step/security/step_check_extension_privileges.h b/src/wgt/step/security/step_check_extension_privileges.h index c390d3c..ee1cf4e 100755 --- a/src/wgt/step/security/step_check_extension_privileges.h +++ b/src/wgt/step/security/step_check_extension_privileges.h @@ -8,7 +8,7 @@ #ifndef WGT_STEP_SECURITY_STEP_CHECK_EXTENSION_PRIVILEGES_H_ #define WGT_STEP_SECURITY_STEP_CHECK_EXTENSION_PRIVILEGES_H_ -#include +#include #include #include #include diff --git a/src/wgt/step/security/step_check_settings_level.h b/src/wgt/step/security/step_check_settings_level.h index 772188b..2ad7a98 100644 --- a/src/wgt/step/security/step_check_settings_level.h +++ b/src/wgt/step/security/step_check_settings_level.h @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/src/wgt/utils/wgt_app_query_interface.cc b/src/wgt/utils/wgt_app_query_interface.cc index 3c9131e..d785f90 100644 --- a/src/wgt/utils/wgt_app_query_interface.cc +++ b/src/wgt/utils/wgt_app_query_interface.cc @@ -12,10 +12,10 @@ #include #include -#include +#include #include -#include #include +#include #include #include diff --git a/src/wgt/wgt_installer.h b/src/wgt/wgt_installer.h index e210622..2c99aa6 100644 --- a/src/wgt/wgt_installer.h +++ b/src/wgt/wgt_installer.h @@ -5,7 +5,7 @@ #ifndef WGT_WGT_INSTALLER_H_ #define WGT_WGT_INSTALLER_H_ -#include +#include namespace wgt { diff --git a/src/wgt/wgt_installer_factory.cc b/src/wgt/wgt_installer_factory.cc index e826ee2..54d191e 100644 --- a/src/wgt/wgt_installer_factory.cc +++ b/src/wgt/wgt_installer_factory.cc @@ -16,7 +16,7 @@ #include #include "common/pkgmgr_interface.h" -#include "common/pkgmgr_query.h" +#include "common/utils/pkgmgr_query.h" namespace ci = common_installer; -- 2.7.4 From 5bdf7c41cd18ac13a2b37fc761854ad9e9e2230f Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Mon, 6 Jul 2020 17:09:17 +0900 Subject: [PATCH 15/16] Release version 0.15.5 Changes: - Add InstallerWithoutPasrserPlugins for test - Change filepath Change-Id: Ib0e8cd332b5d5ae95a9479836e156f75e3561178 Signed-off-by: Junghyun Yeon --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 65bdfc6..da7a197 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.4 +Version: 0.15.5 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From b18a76a8af3c11a56d1852cbc6e13f42dbfe0de9 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 30 Jul 2020 16:18:54 +0900 Subject: [PATCH 16/16] Add try-catch statements Change-Id: Ib83a73359ab768f2af0e5bbf7e5eac52446a3ba3 Signed-off-by: Junghyun Yeon --- src/wgt_backend/wgt_backend.cc | 44 ++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/wgt_backend/wgt_backend.cc b/src/wgt_backend/wgt_backend.cc index c72e135..3286b08 100644 --- a/src/wgt_backend/wgt_backend.cc +++ b/src/wgt_backend/wgt_backend.cc @@ -29,27 +29,33 @@ std::unique_ptr make_unique(Args&&... args) { int main(int argc, char** argv) { ci::PkgmgrInstaller pkgmgr_installer; wgt::WgtAppQueryInterface query_interface; - auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer, - &query_interface); - std::unique_ptr installer_factory; - if (!pkgmgr) { - LOG(ERROR) << "Options of pkgmgr installer cannot be parsed"; - return EINVAL; - } + try { + auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer, + &query_interface); + std::unique_ptr installer_factory; + if (!pkgmgr) { + LOG(ERROR) << "Options of pkgmgr installer cannot be parsed"; + return EINVAL; + } #if __cplusplus >= 201300L - using std; + using std; #endif - // This is workaround for hybrid apps as they requires much different flow - // but installer does not branch at all in current design - if (query_interface.IsHybridApplication( - pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) { - LOG(INFO) << "Hybrid package detected"; - ci::InstallerRunner runner( - make_unique(), pkgmgr); - return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; - } else { - ci::InstallerRunner runner(make_unique(), pkgmgr); - return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; + // This is workaround for hybrid apps as they requires much different flow + // but installer does not branch at all in current design + if (query_interface.IsHybridApplication( + pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) { + LOG(INFO) << "Hybrid package detected"; + ci::InstallerRunner runner( + make_unique(), pkgmgr); + return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; + } else { + ci::InstallerRunner runner( + make_unique(), pkgmgr); + return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; + } + } catch(...) { + LOG(ERROR) << "Exception occured"; + return 1; } } -- 2.7.4