From 3363d275e172a0c1235a36f7bc30adeca9528ebb Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 22 Nov 2019 13:25:36 +0900 Subject: [PATCH 01/16] Release version 0.12.14 Changes: - Fix static analysis issue Change-Id: I8489d7691b59361c1a388cde6b105a2795fdc47c 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 8ddec31..fed4d3f 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.12.13 +Version: 0.12.14 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From b6d6b153631dff98fd8ca9392bfb83ac87096b11 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 28 Nov 2019 20:21:51 +0900 Subject: [PATCH 02/16] Apply early return policy on StepCopyPreviewIcons Change-Id: I4ae9087fa4e149459df982e8311e471f19a732ee Signed-off-by: Junghyun Yeon --- src/wgt/step/filesystem/step_copy_preview_icons.cc | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/wgt/step/filesystem/step_copy_preview_icons.cc b/src/wgt/step/filesystem/step_copy_preview_icons.cc index 95710f8..2cdf5cc 100644 --- a/src/wgt/step/filesystem/step_copy_preview_icons.cc +++ b/src/wgt/step/filesystem/step_copy_preview_icons.cc @@ -5,6 +5,7 @@ #include "wgt/step/filesystem/step_copy_preview_icons.h" #include + #include #include @@ -29,22 +30,22 @@ ci::Step::Status StepCopyPreviewIcons::process() { static_cast(context_->backend_data.get()); for (auto& appwidget : backend_data->appwidgets.get().app_widgets()) { for (auto& size : appwidget.content_size) { - if (!size.preview.empty()) { - bf::path icon_path = - context_->GetPkgPath() / kResWgt / size.preview; - std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type); - std::string icon_name = appwidget.id + "." + type + "." + "preview" + - bf::path(size.preview).extension().string(); - bf::path preview_icon = - context_->GetPkgPath() / kSharedRes / icon_name; - if (!ci::CopyFile(icon_path, preview_icon)) { - LOG(ERROR) << "Cannot create preview icon: " << preview_icon; - return Status::ICON_ERROR; - } + if (size.preview.empty()) + continue; + + bf::path icon_path = context_->GetPkgPath() / kResWgt / size.preview; + std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type); + std::string icon_name = appwidget.id + "." + type + "." + "preview" + + bf::path(size.preview).extension().string(); + bf::path preview_icon = context_->GetPkgPath() / kSharedRes / icon_name; + if (!ci::CopyFile(icon_path, preview_icon)) { + LOG(ERROR) << "Cannot create preview icon: " << preview_icon; + return Status::ICON_ERROR; } } } LOG(DEBUG) << "Preview icons created"; + return Status::OK; } -- 2.7.4 From 08d91e262044fd9ee82018db71b48373834317cb Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 19 Nov 2019 18:35:50 +0900 Subject: [PATCH 03/16] Fix smoke-test functions for rollback cases The custom step cannot be added outside of installer, because steps are initialized when Run() invoked. (If some step added outside of installer, that step will be executed at first, ignoring original steps) This patch defines a new virtual function creating overridden installer object which is fail at the end of steps or specific stage. Requires: - https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/218093 Change-Id: I99de606909e5a673d45545dd05095ee0f4111a51 Signed-off-by: Sangyoon Jang --- src/unit_tests/smoke_utils.cc | 16 +++++++-- src/unit_tests/smoke_utils.h | 80 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index 817cdbc..14965f9 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -61,14 +61,26 @@ WgtBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const { return AppInstallerPtr(new wgt::WgtInstaller(pkgmgr)); } -WgtBackendInterface::AppQueryInterfacePtr +WgtBackendInterface::AppInstallerPtr +WgtBackendInterface::CreateFailExpectedInstaller( + ci::PkgMgrPtr pkgmgr, int fail_at) const { + return AppInstallerPtr(new FailExpectedWgtInstaller(pkgmgr, fail_at)); +} + +HybridBackendInterface::AppQueryInterfacePtr HybridBackendInterface::CreateQueryInterface() const { return AppQueryInterfacePtr(new wgt::WgtAppQueryInterface()); } -WgtBackendInterface::AppInstallerPtr +HybridBackendInterface::AppInstallerPtr HybridBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const { return AppInstallerPtr(new hybrid::HybridInstaller(pkgmgr)); } +HybridBackendInterface::AppInstallerPtr +HybridBackendInterface::CreateFailExpectedInstaller( + ci::PkgMgrPtr pkgmgr, int fail_at) const { + return AppInstallerPtr(new FailExpectedHybridInstaller(pkgmgr, fail_at)); +} + } // namespace smoke_test diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/smoke_utils.h index e6ecbae..7b22263 100644 --- a/src/unit_tests/smoke_utils.h +++ b/src/unit_tests/smoke_utils.h @@ -5,14 +5,17 @@ #ifndef UNIT_TESTS_SMOKE_UTILS_H_ #define UNIT_TESTS_SMOKE_UTILS_H_ -#include #include +#include +#include #include #include #include #include +#include "hybrid/hybrid_installer.h" +#include "wgt/wgt_installer.h" #include "wgt/wgt_app_query_interface.h" namespace smoke_test { @@ -39,6 +42,8 @@ class WgtBackendInterface: public BackendInterface { AppQueryInterfacePtr CreateQueryInterface() const override; AppInstallerPtr CreateInstaller( common_installer::PkgMgrPtr pkgmgr) const override; + AppInstallerPtr CreateFailExpectedInstaller( + common_installer::PkgMgrPtr pkgmgr, int fail_at) const override; }; class HybridBackendInterface: public BackendInterface { @@ -49,6 +54,79 @@ class HybridBackendInterface: public BackendInterface { AppQueryInterfacePtr CreateQueryInterface() const override; AppInstallerPtr CreateInstaller( common_installer::PkgMgrPtr pkgmgr) const override; + AppInstallerPtr CreateFailExpectedInstaller( + common_installer::PkgMgrPtr pkgmgr, int fail_at) const override; +}; + +#define OVERRIDE_STEPS_BLOCK(TYPE, STEPS) \ + void STEPS() override { \ + TYPE::STEPS(); \ + if (fail_at_ > -1) \ + AddStepAtIndex(fail_at_); \ + else \ + AddStep(); \ + } \ + +class FailExpectedWgtInstaller : public wgt::WgtInstaller { + public: + explicit FailExpectedWgtInstaller( + common_installer::PkgMgrPtr pkgmgr, int fail_at) + : wgt::WgtInstaller(pkgmgr), fail_at_(fail_at) { } + + private: + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, InstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, UpdateSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, UninstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReinstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, DeltaSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MoveSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, RecoverySteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MountInstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MountUpdateSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestDirectInstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestDirectUpdateSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestPartialInstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestPartialUpdateSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, PartialUninstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReadonlyUpdateInstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReadonlyUpdateUninstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, DisablePkgSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, EnablePkgSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MigrateExtImgSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, RecoverDBSteps) + + int fail_at_; +}; + +class FailExpectedHybridInstaller : public hybrid::HybridInstaller { + public: + explicit FailExpectedHybridInstaller( + common_installer::PkgMgrPtr pkgmgr, int fail_at) + : hybrid::HybridInstaller(pkgmgr), fail_at_(fail_at) { } + + private: + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, InstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, UpdateSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, UninstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReinstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, DeltaSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MoveSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, RecoverySteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MountInstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MountUpdateSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestDirectInstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestDirectUpdateSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestPartialInstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestPartialUpdateSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, PartialUninstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReadonlyUpdateInstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReadonlyUpdateUninstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, DisablePkgSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, EnablePkgSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MigrateExtImgSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, RecoverDBSteps) + + int fail_at_; }; } // namespace smoke_test -- 2.7.4 From 5382bd989e0a34e8d3fbe9a3072e914ca0d26df7 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 28 Nov 2019 20:14:24 +0900 Subject: [PATCH 04/16] Change duplicated step name Same step name exists on tpk-backend Change-Id: Ia96de025c403f19af3deca55f9ff669a863d0092 Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_installer.cc | 28 +++++++++++----------- ...ic_link.cc => step_create_wgt_symbolic_link.cc} | 21 +++++++++++----- ...olic_link.h => step_create_wgt_symbolic_link.h} | 12 +++++----- src/wgt/wgt_installer.cc | 14 +++++------ 4 files changed, 42 insertions(+), 33 deletions(-) rename src/wgt/step/filesystem/{step_create_symbolic_link.cc => step_create_wgt_symbolic_link.cc} (79%) rename src/wgt/step/filesystem/{step_create_symbolic_link.h => step_create_wgt_symbolic_link.h} (75%) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index fc7824f..2f00998 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -79,7 +79,7 @@ #include #include -#include +#include #include #include #include @@ -98,7 +98,7 @@ #include "wgt/step/configuration/step_set_old_signature_files_location.h" #include "wgt/step/encryption/step_remove_encryption_data.h" #include "wgt/step/filesystem/step_copy_preview_icons.h" -#include "wgt/step/filesystem/step_create_symbolic_link.h" +#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h" #include "wgt/step/filesystem/step_wgt_patch_icons.h" #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h" #include "wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h" @@ -155,8 +155,8 @@ void HybridInstaller::InstallSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); @@ -214,8 +214,8 @@ void HybridInstaller::UpdateSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); @@ -309,8 +309,8 @@ void HybridInstaller::DeltaSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); AddStep( @@ -383,8 +383,8 @@ void HybridInstaller::MountInstallSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); @@ -441,8 +441,8 @@ void HybridInstaller::MountUpdateSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); @@ -663,8 +663,8 @@ void HybridInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); diff --git a/src/wgt/step/filesystem/step_create_symbolic_link.cc b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc similarity index 79% rename from src/wgt/step/filesystem/step_create_symbolic_link.cc rename to src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc index c1091d0..d234494 100644 --- a/src/wgt/step/filesystem/step_create_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc @@ -3,7 +3,7 @@ // Use of this source code is governed by a apache 2.0 license that can be // found in the LICENSE file. -#include "wgt/step/filesystem/step_create_symbolic_link.h" +#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h" #include #include @@ -31,10 +31,10 @@ const char kWRTPath[] = "/usr/bin/wrt"; namespace wgt { namespace filesystem { -bool StepCreateSymbolicLink::CreateSymlinksForApps() { +bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() { boost::system::error_code error; for (application_x* app : - GListRange(context_->manifest_data.get()->application)) { + GListRange(context_->manifest_data.get()->application)) { // filter out non-wgt apps as this step is run for hybrid backend too if (strcmp("webapp", app->type) != 0) continue; @@ -63,7 +63,16 @@ bool StepCreateSymbolicLink::CreateSymlinksForApps() { return true; } -common_installer::Step::Status StepCreateSymbolicLink::process() { +common_installer::Step::Status StepCreateWgtSymbolicLink::precheck() { + if (!context_->manifest_data.get()) { + LOG(ERROR) << "Manifest data empty"; + return Status::ERROR; + } + + return Status::OK; +} + +common_installer::Step::Status StepCreateWgtSymbolicLink::process() { assert(context_->manifest_data.get()); if (!CreateSymlinksForApps()) @@ -73,9 +82,9 @@ common_installer::Step::Status StepCreateSymbolicLink::process() { return Status::OK; } -common_installer::Step::Status StepCreateSymbolicLink::undo() { +common_installer::Step::Status StepCreateWgtSymbolicLink::undo() { for (application_x* app : - GListRange(context_->manifest_data.get()->application)) { + GListRange(context_->manifest_data.get()->application)) { bf::path exec_path = context_->GetPkgPath() / "bin" / app->appid; common_installer::RemoveAll(exec_path); } diff --git a/src/wgt/step/filesystem/step_create_symbolic_link.h b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h similarity index 75% rename from src/wgt/step/filesystem/step_create_symbolic_link.h rename to src/wgt/step/filesystem/step_create_wgt_symbolic_link.h index c1129e7..8f8e326 100644 --- a/src/wgt/step/filesystem/step_create_symbolic_link.h +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a apache 2.0 license that can be // found in the LICENSE file. -#ifndef WGT_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ -#define WGT_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ +#ifndef WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_ +#define WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_ #include @@ -19,7 +19,7 @@ namespace filesystem { /** * \brief Step that create symbolic link to application */ -class StepCreateSymbolicLink : public common_installer::Step { +class StepCreateWgtSymbolicLink : public common_installer::Step { public: using Step::Step; @@ -46,11 +46,11 @@ class StepCreateSymbolicLink : public common_installer::Step { Status undo() override; /** - * \brief Empty method + * \brief Check weather manifest data is empty or not * * \return Status::OK */ - Status precheck() override { return Status::OK; } + Status precheck() override; private: bool CreateSymlinksForApps(); @@ -61,4 +61,4 @@ class StepCreateSymbolicLink : public common_installer::Step { } // namespace filesystem } // namespace wgt -#endif // WGT_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ +#endif // WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_ diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 2031f14..2187656 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -99,7 +99,7 @@ #include "wgt/step/encryption/step_encrypt_resources.h" #include "wgt/step/encryption/step_remove_encryption_data.h" #include "wgt/step/filesystem/step_copy_preview_icons.h" -#include "wgt/step/filesystem/step_create_symbolic_link.h" +#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h" #include "wgt/step/filesystem/step_wgt_patch_icons.h" #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h" #include "wgt/step/filesystem/step_wgt_prepare_package_directory.h" @@ -151,7 +151,7 @@ void WgtInstaller::InstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -204,7 +204,7 @@ void WgtInstaller::UpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -322,7 +322,7 @@ void WgtInstaller::DeltaSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -391,7 +391,7 @@ void WgtInstaller::MountInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -442,7 +442,7 @@ void WgtInstaller::MountUpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -560,7 +560,7 @@ void WgtInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); -- 2.7.4 From 989a3134534199af2ab4626597ae3dbe9ec038d9 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 28 Nov 2019 18:50:52 +0900 Subject: [PATCH 05/16] Change default value of nodisplay Change it to true in order to hide it from app drawer. Change-Id: I93f92f127be05686968f8de2b3034ab0345af9f0 Signed-off-by: Junghyun Yeon --- src/wgt/step/configuration/step_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 9799b3e..9cbf0fb 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -470,7 +470,7 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { service_info.on_boot() ? strdup("true") : strdup("false"); application->autorestart = service_info.auto_restart() ? strdup("true") : strdup("false"); - application->nodisplay = strdup("false"); + application->nodisplay = strdup("true"); application->taskmanage = strdup("true"); SetApplicationXDefaults(application); application->support_ambient = strdup("false"); -- 2.7.4 From af489d9d75a35ab926b56d436df01d05a3c4aee2 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 28 Nov 2019 09:18:02 +0900 Subject: [PATCH 06/16] Fix StepEncryptResources - Fix typo. - Use summarized namespace for readability. - Remove some 1 line if statement braces. Change-Id: Id42e04fca3516ce19c783d4cb6ef7af9a74d4891 Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_installer.cc | 14 ++-- ...sources.cc => step_encrypt_hybrid_resources.cc} | 4 +- ...resources.h => step_encrypt_hybrid_resources.h} | 11 ++-- src/wgt/step/encryption/step_encrypt_resources.cc | 77 +++++++++++----------- 4 files changed, 54 insertions(+), 52 deletions(-) rename src/hybrid/step/encryption/{step_encrypt_resources.cc => step_encrypt_hybrid_resources.cc} (73%) rename src/hybrid/step/encryption/{step_encrypt_resources.h => step_encrypt_hybrid_resources.h} (66%) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 2f00998..4d18750 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -92,7 +92,7 @@ #include "hybrid/step/configuration/step_merge_tpk_privileges.h" #include "hybrid/step/configuration/step_set_mainapp.h" #include "hybrid/step/configuration/step_stash_tpk_config.h" -#include "hybrid/step/encryption/step_encrypt_resources.h" +#include "hybrid/step/encryption/step_encrypt_hybrid_resources.h" #include "hybrid/step/pkgmgr/step_merge_xml.h" #include "wgt/step/configuration/step_parse.h" #include "wgt/step/configuration/step_set_old_signature_files_location.h" @@ -137,7 +137,7 @@ void HybridInstaller::InstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(false); @@ -189,7 +189,7 @@ void HybridInstaller::UpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::BACKUP); @@ -287,7 +287,7 @@ void HybridInstaller::DeltaSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -365,7 +365,7 @@ void HybridInstaller::MountInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -417,7 +417,7 @@ void HybridInstaller::MountUpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::BACKUP); @@ -640,7 +640,7 @@ void HybridInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, diff --git a/src/hybrid/step/encryption/step_encrypt_resources.cc b/src/hybrid/step/encryption/step_encrypt_hybrid_resources.cc similarity index 73% rename from src/hybrid/step/encryption/step_encrypt_resources.cc rename to src/hybrid/step/encryption/step_encrypt_hybrid_resources.cc index 2265a35..b56bc30 100644 --- a/src/hybrid/step/encryption/step_encrypt_resources.cc +++ b/src/hybrid/step/encryption/step_encrypt_hybrid_resources.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by an apache-2.0 license that can be // found in the LICENSE file. -#include "hybrid/step/encryption/step_encrypt_resources.h" +#include "hybrid/step/encryption/step_encrypt_hybrid_resources.h" namespace hybrid { namespace encryption { -void StepEncryptResources::SetEncryptionRoot() { +void StepEncryptHybridResources::SetEncryptionRoot() { input_ = context_->unpacked_dir_path.get() / "res/wgt"; } diff --git a/src/hybrid/step/encryption/step_encrypt_resources.h b/src/hybrid/step/encryption/step_encrypt_hybrid_resources.h similarity index 66% rename from src/hybrid/step/encryption/step_encrypt_resources.h rename to src/hybrid/step/encryption/step_encrypt_hybrid_resources.h index 88b0f5b..2360651 100644 --- a/src/hybrid/step/encryption/step_encrypt_resources.h +++ b/src/hybrid/step/encryption/step_encrypt_hybrid_resources.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 HYBRID_STEP_ENCRYPTION_STEP_ENCRYPT_RESOURCES_H_ -#define HYBRID_STEP_ENCRYPTION_STEP_ENCRYPT_RESOURCES_H_ +#ifndef HYBRID_STEP_ENCRYPTION_STEP_ENCRYPT_HYBRID_RESOURCES_H_ +#define HYBRID_STEP_ENCRYPTION_STEP_ENCRYPT_HYBRID_RESOURCES_H_ #include @@ -17,17 +17,18 @@ namespace encryption { * * This is variant for hybrid package */ -class StepEncryptResources : public wgt::encryption::StepEncryptResources { +class StepEncryptHybridResources : + public wgt::encryption::StepEncryptResources { public: using wgt::encryption::StepEncryptResources::StepEncryptResources; private: void SetEncryptionRoot() override; - STEP_NAME(EncryptResources) + STEP_NAME(EncryptHybridResources) }; } // namespace encryption } // namespace hybrid -#endif // HYBRID_STEP_ENCRYPTION_STEP_ENCRYPT_RESOURCES_H_ +#endif // HYBRID_STEP_ENCRYPTION_STEP_ENCRYPT_HYBRID_RESOURCES_H_ diff --git a/src/wgt/step/encryption/step_encrypt_resources.cc b/src/wgt/step/encryption/step_encrypt_resources.cc index dc4b6ec..dffaa89 100644 --- a/src/wgt/step/encryption/step_encrypt_resources.cc +++ b/src/wgt/step/encryption/step_encrypt_resources.cc @@ -22,12 +22,16 @@ #include #include +namespace bf = boost::filesystem; +namespace bs = boost::system; +namespace ci = common_installer; + namespace { const std::size_t kEncryptionChunkMaxSize = 8_kB; // bytes const std::set encryptSet { ".html", ".htm", ".css", ".js"}; -FILE* OpenFile(const std::string& path, const std::string& mode) { +FILE* OpenFile(const bf::path& path, const std::string& mode) { FILE* result = nullptr; do { @@ -77,14 +81,11 @@ void WriteBytes(unsigned char* buffer, std::size_t count, FILE* stream) { namespace wgt { namespace encryption { -namespace bf = boost::filesystem; -namespace bs = boost::system; - -common_installer::Step::Status StepEncryptResources::precheck() { +ci::Step::Status StepEncryptResources::precheck() { backend_data_ = static_cast(context_->backend_data.get()); if (!backend_data_) { LOG(ERROR) << "no backend data"; - return common_installer::Step::Status::ERROR; + return ci::Step::Status::ERROR; } SetEncryptionRoot(); @@ -98,22 +99,22 @@ common_installer::Step::Status StepEncryptResources::precheck() { return Step::Status::INVALID_VALUE; } - return common_installer::Step::Status::OK; + return ci::Step::Status::OK; } -common_installer::Step::Status StepEncryptResources::process() { +ci::Step::Status StepEncryptResources::process() { if (!backend_data_->settings.get().encryption_enabled()) { LOG(DEBUG) << "no encryption"; - return common_installer::Step::Status::OK; + return ci::Step::Status::OK; } LOG(DEBUG) << "Encrypting"; if (!Encrypt(input_)) { LOG(ERROR) << "Error during encryption"; - return common_installer::Step::Status::ERROR; + return ci::Step::Status::ERROR; } - return common_installer::Step::Status::OK; + return ci::Step::Status::OK; } bool StepEncryptResources::Encrypt(const bf::path &src) { @@ -124,21 +125,25 @@ bool StepEncryptResources::Encrypt(const bf::path &src) { for (bf::directory_iterator file(src); file != bf::directory_iterator(); ++file) { - bs::error_code error_code; + bs::error_code error; bf::path current(file->path()); - bool is_dir = bf::is_directory(current, error_code); - if (error_code) + bool is_dir = bf::is_directory(current, error); + if (error) { + LOG(ERROR) << "Failed to check directory status: " << error.message(); return false; + } if (is_dir) { if (!Encrypt(current)) return false; continue; } - bool is_sym = bf::is_symlink(symlink_status(current, error_code)); - if (error_code) + bool is_sym = bf::is_symlink(symlink_status(current, error)); + if (error) { + LOG(ERROR) << "Failed to check symlink status: " << error.message(); return false; + } if (is_sym) continue; @@ -153,51 +158,49 @@ bool StepEncryptResources::Encrypt(const bf::path &src) { } bool StepEncryptResources::EncryptFile(const bf::path &src) { - bf::path encFile(src.string() + ".enc"); struct stat info; memset(&info, 0, sizeof(info)); - if (stat(src.string().c_str(), &info) != 0) { - LOG(ERROR) << "Could not access file " << src.string(); + if (stat(src.c_str(), &info) != 0) { + LOG(ERROR) << "Could not access file " << src; return false; } const std::size_t fileSize = info.st_size; - if (0 == fileSize) { - LOG(ERROR) << src.string().c_str() << " size is 0, so encryption is skiped"; + if (!fileSize) { + LOG(ERROR) << src << " size is 0, so encryption will be skipped"; return true; } - FILE *input = OpenFile(src.string().c_str(), "rb"); - if (input == nullptr) { - LOG(ERROR) << "Cannot open file for encryption: " << src.string(); + FILE *input = OpenFile(src, "rb"); + if (!input) { + LOG(ERROR) << "Cannot open file for encryption: " << src; return false; } - FILE *output = OpenFile(encFile.string().c_str(), "wb"); - if (output == nullptr) { - LOG(ERROR) << "Cannot create encrypted file: " << encFile.string(); + bf::path encFile(src.string() + ".enc"); + FILE *output = OpenFile(encFile, "wb"); + if (!output) { + LOG(ERROR) << "Cannot create encrypted file: " << encFile; fclose(input); return false; } - std::size_t chunkSize = (fileSize > kEncryptionChunkMaxSize - ? kEncryptionChunkMaxSize : fileSize); + std::size_t chunkSize = (fileSize > kEncryptionChunkMaxSize ? + kEncryptionChunkMaxSize : fileSize); std::unique_ptr inChunk(new unsigned char[chunkSize]); std::size_t bytesRead = 0; do { bytesRead = ReadBytes(inChunk.get(), chunkSize, input); - if (0 != bytesRead) { + if (!bytesRead) { unsigned char* encrypted_data = nullptr; size_t encrypted_size = 0; // TODO(p.sikorski) check if it is Preloaded int ret; - if (context_->request_mode.get() - == common_installer::RequestMode::GLOBAL) { + if (context_->request_mode.get() == ci::RequestMode::GLOBAL) { ret = wae_encrypt_global_web_application( context_->pkgid.get().c_str(), - context_->is_readonly_package.get() ? - true : false, + context_->is_readonly_package.get() ? true : false, inChunk.get(), (size_t)bytesRead, &encrypted_data, @@ -263,14 +266,12 @@ bool StepEncryptResources::EncryptFile(const bf::path &src) { fclose(input); LOG(DEBUG) << "File encrypted successfully"; - if (0 != unlink(src.string().c_str())) { + if (!unlink(src.c_str())) return false; - } LOG(DEBUG) << "Rename encrypted file"; - if (0 != std::rename(encFile.c_str(), src.string().c_str())) { + if (!std::rename(encFile.c_str(), src.c_str())) return false; - } return true; } -- 2.7.4 From 4a234479feb4c92a93ae1a96b752c0a945080cd0 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 10 Dec 2019 15:35:10 +0900 Subject: [PATCH 07/16] Fix step name of StepCreateWgtSymbolicLink Change-Id: I557498b3cfd06c9455c5583a592292e983d06e08 Signed-off-by: Sangyoon Jang --- src/wgt/step/filesystem/step_create_wgt_symbolic_link.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8f8e326..a91cbf1 100644 --- a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h @@ -55,7 +55,7 @@ class StepCreateWgtSymbolicLink : public common_installer::Step { private: bool CreateSymlinksForApps(); - STEP_NAME(CreateSymbolicLink) + STEP_NAME(CreateWgtSymbolicLink) }; } // namespace filesystem -- 2.7.4 From 1a76d94f421d7c2bd6838dc4a6d70b12b5f8adfd Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Fri, 13 Dec 2019 16:03:05 +0900 Subject: [PATCH 08/16] Release version 0.12.15 Changes: - Apply early return policy on StepCopyPreviewIcons - Fix smoke-test functions for rollback cases - Change duplicated step name - Change default value of nodisplay - Fix StepEncryptResources - Fix step name of StepCreateWgtSymbolicLink Change-Id: Iaadd1a3bfb056b88bf3816766005e8b8ab63c1ca 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 fed4d3f..81f10bc 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.12.14 +Version: 0.12.15 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 19a7d556d898fb2b587285c353caa49f490e106a Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Thu, 30 May 2019 19:16:36 +0900 Subject: [PATCH 09/16] Fix adding steps using default steps Requires: - https://review.tizen.org/gerrit/c/platform/core/appfw/app-installers/+/207215 Change-Id: Ic7ebf33c40b9899b3e71d6307bd3249b31ed3900 Signed-off-by: Sangyoon Jang --- src/hybrid/hybrid_installer.cc | 927 +++++++++++++---------------------------- src/wgt/wgt_installer.cc | 842 +++++++++++-------------------------- 2 files changed, 534 insertions(+), 1235 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 4d18750..d3accd7 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -5,79 +5,11 @@ #include "hybrid/hybrid_installer.h" #include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include @@ -119,142 +51,74 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) } void HybridInstaller::InstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( + AppInstaller::InstallSteps(); + AddStepAfter("CheckInstallable"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(false); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AddStepAfter("Signature"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter( + "CheckWgtImePrivilege"); + AddStepAfter("CreateIcons"); + AddStepAfter("TpkPatchIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CreateTpkSymbolicLink"); + AddStepAfter("GenerateXml"); + AddStepAfter("MergeXml"); + AddStepAfter("ManifestAdjustment"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Install); - AddStep(); - AddStep( - ci::Plugin::ActionType::Install); - AddStep( + ReplaceStep( + "CreateStorageDirectories", wgt::filesystem::HybridAdditionalSharedDirs); - AddStep(); - AddStep(); + AddStepAfter( + "CreateStorageDirectories"); } void HybridInstaller::UpdateSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( + AppInstaller::UpdateSteps(); + AddStepAfter("CheckUpgradable"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AddStepAfter("CheckOldCertificate"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter( + "CheckWgtImePrivilege"); + AddStepAfter("CreateIcons"); + AddStepAfter("TpkPatchIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CreateTpkSymbolicLink"); + AddStepAfter("GenerateXml"); + AddStepAfter("MergeXml"); + AddStepAfter("ManifestAdjustment"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter( + "CopyStorageDirectories"); } void HybridInstaller::UninstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep( - ci::Plugin::ActionType::Uninstall); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Uninstall); - AddStep(); - AddStep(); - AddStep(); + AppInstaller::UninstallSteps(); + AddStepAfter( + "RemovePerUserStorageDirectories"); } void HybridInstaller::ReinstallSteps() { @@ -263,507 +127,304 @@ void HybridInstaller::ReinstallSteps() { } void HybridInstaller::DeltaSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep( - wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AppInstaller::DeltaSteps(); + AddStepAfter("CheckUpgradable"); + AddStepAfter( + "EnableExternalMount"); + AddStepAfter("StashTpkConfig", + wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, false); + AddStepAfter("CheckOldCertificate"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter( + "CheckWgtImePrivilege"); + AddStepAfter("CreateIcons"); + AddStepAfter("TpkPatchIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CreateTpkSymbolicLink"); + AddStepAfter("GenerateXml"); + AddStepAfter("MergeXml"); + AddStepAfter("ManifestAdjustment"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter( + "CopyStorageDirectories"); } void HybridInstaller::RecoverySteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::RECOVERY, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AppInstaller::RecoverySteps(); + AddStepAfter("MountRecover"); + AddStepAfter( + "TpkRecoverSignature", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep(); } void HybridInstaller::MountInstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( + AppInstaller::MountInstallSteps(); + AddStepAfter("CheckInstallable"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AddStepAfter("Signature"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter( + "CheckWgtImePrivilege"); + AddStepAfter("MountInstall"); + AddStepAfter("CreateIcons"); + AddStepAfter("TpkPatchIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CreateTpkSymbolicLink"); + AddStepAfter("GenerateXml"); + AddStepAfter("MergeXml"); + AddStepAfter("ManifestAdjustment"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Install); - AddStep(); - AddStep( - ci::Plugin::ActionType::Install); - AddStep( + ReplaceStep( + "CreateStorageDirectories", wgt::filesystem::HybridAdditionalSharedDirs); - AddStep(true); - AddStep(); + AddStepAfter( + "CreateStorageDirectories"); } void HybridInstaller::MountUpdateSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( + AppInstaller::MountUpdateSteps(); + AddStepAfter("CheckUpgradable"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AddStepAfter("CheckOldCertificate"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter( + "CheckWgtImePrivilege"); + AddStepAfter("MountUpdate"); + AddStepAfter("CreateIcons"); + AddStepAfter("TpkPatchIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CreateTpkSymbolicLink"); + AddStepAfter("GenerateXml"); + AddStepAfter("MergeXml"); + AddStepAfter("ManifestAdjustment"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(true); - AddStep(); + AddStepAfter( + "UpdateStorageDirectories"); } void HybridInstaller::ManifestDirectInstallSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( + AppInstaller::ManifestDirectInstallSteps(); + AddStepAfter("CheckInstallable"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AddStepAfter("Signature"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter( + "RemoveGlobalAppSymlinks"); + AddStepAfter("TpkPatchIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CreateTpkSymbolicLink"); + AddStepAfter("GenerateXml"); + AddStepAfter("MergeXml"); + AddStepAfter("ManifestAdjustment"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Install); - AddStep(); - AddStep( - ci::Plugin::ActionType::Install); - AddStep( + AddStepAfter("PrivilegeCompatibility"); + ReplaceStep( + "CreateStorageDirectories", wgt::filesystem::HybridAdditionalSharedDirs); - AddStep(); - AddStep(); } void HybridInstaller::ManifestDirectUpdateSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( + AppInstaller::ManifestDirectUpdateSteps(); + AddStepAfter("CheckUpgradable"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AddStepAfter("CheckOldCertificate"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter( + "RemoveGlobalAppSymlinks"); + AddStepAfter("TpkPatchIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CreateTpkSymbolicLink"); + AddStepAfter("GenerateXml"); + AddStepAfter("MergeXml"); + AddStepAfter("ManifestAdjustment"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); } void HybridInstaller::ManifestPartialInstallSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep( + AppInstaller::ManifestPartialInstallSteps(); + AddStepAfter("ParseManifest"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(false); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(false); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Install); - AddStep(); - AddStep( - ci::Plugin::ActionType::Install); - AddStep( + AddStepAfter("Signature"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("RemoveGlobalAppSymlinks", + false); + ReplaceStep( + "CreateStorageDirectories", wgt::filesystem::HybridAdditionalSharedDirs); - AddStep(); + AddStepBefore( + "RegisterApplication"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); + AddStepAfter("PrivilegeCompatibility"); } void HybridInstaller::ManifestPartialUpdateSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep( + AppInstaller::ManifestPartialUpdateSteps(); + AddStepAfter("ParseManifest"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(false); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep( + AddStepAfter("CheckOldCertificate"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("RemoveGlobalAppSymlinks", + false); + AddStepBefore("UpdateApplication"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep(false); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); } void HybridInstaller::PartialUninstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep( - ci::Plugin::ActionType::Uninstall); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Uninstall); - AddStep(); + AppInstaller::PartialUninstallSteps(); + AddStepAfter( + "RemovePerUserStorageDirectories"); } void HybridInstaller::ReadonlyUpdateInstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::PACKAGE, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( + AppInstaller::ReadonlyUpdateInstallSteps(); + AddStepAfter("CheckUpgradable"); + AddStepAfter("StashTpkConfig", wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AddStepAfter("CheckOldCertificate"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter( + "CheckWgtImePrivilege"); + AddStepAfter("CreateIcons"); + AddStepAfter("TpkPatchIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CreateTpkSymbolicLink"); + AddStepAfter("GenerateXml"); + AddStepAfter("MergeXml"); + AddStepAfter("ManifestAdjustment"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter( + "CreateStorageDirectories"); } void HybridInstaller::ReadonlyUpdateUninstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep(); - AddStep(false); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep(); - AddStep(ci::Plugin::ActionType::Upgrade); + AppInstaller::ReadonlyUpdateUninstallSteps(); + AddStepAfter("CheckUpgradable"); + AddStepAfter("StashTpkConfig", + wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); + AddStepAfter("Signature"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepBefore("UpdateApplication"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); + AddStepAfter("PrivilegeCompatibility"); } void HybridInstaller::EnablePkgSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep( - ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Enable); - AddStep( - ci::Plugin::ActionType::Install); + AppInstaller::EnablePkgSteps(); } void HybridInstaller::DisablePkgSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep( - ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Disable); - AddStep( - ci::Plugin::ActionType::Uninstall); + AppInstaller::DisablePkgSteps(); } void HybridInstaller::MigrateExtImgSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); + AppInstaller::MigrateExtImgSteps(); } void HybridInstaller::RecoverDBSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( - wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AppInstaller::RecoverDBSteps(); + AddStepAfter("CheckInstallable"); + AddStepAfter("StashTpkConfig", + wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); + AddStepAfter("GetPrivilegeLevel"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepBefore( + "RegisterApplication"); + AddStepAfter("MergeTpkConfig"); + AddStepAfter("MergeTpkPrivileges", ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); } } // namespace hybrid diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 2187656..f74e37a 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -7,87 +7,10 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include @@ -126,617 +49,332 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) } void WgtInstaller::InstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( + AppInstaller::InstallSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep( + AddStepAfter("Signature", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(false); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Install); - AddStep(); - AddStep( - ci::Plugin::ActionType::Install); - AddStep( + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("CheckWgtImePrivilege"); + AddStepAfter("EncryptResources"); + AddStepAfter("CreateIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CheckExtensionPrivileges"); + ReplaceStep( + "CreateStorageDirectories", wgt::filesystem::WgtAdditionalSharedDirs); - AddStep(); - AddStep(); + AddStepAfter( + "CreateStorageDirectories"); } void WgtInstaller::UpdateSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( + AppInstaller::UpdateSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep( + AddStepAfter("CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("CheckWgtImePrivilege"); + AddStepAfter("EncryptResources"); + AddStepAfter("CreateIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CheckExtensionPrivileges"); + AddStepAfter( + "CopyStorageDirectories"); } void WgtInstaller::UninstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::Plugin::ActionType::Uninstall); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Uninstall); - AddStep(); - AddStep(); - AddStep(); + AppInstaller::UninstallSteps(); + AddStepAfter( + "RemovePerUserStorageDirectories"); } void WgtInstaller::ReinstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep( + AppInstaller::ReinstallSteps(); + AddStepAfter("Configure"); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, false); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep(); - AddStep(); + // Unlike reinstall mode (RDS) of tpk-backend, the RDS package of wgt does not + // contain signature files. This may can be changed differently later. + RemoveStep("Signature"); + RemoveStep("CheckOldCertificate"); + AddStepAfter("CreateIcons"); } void WgtInstaller::DeltaSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( + AppInstaller::DeltaSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, false); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep("res/wgt/"); - AddStep(); - AddStep(); - AddStep(true); - AddStep( + AddStepAfter( + "EnableExternalMount"); + ReplaceStep("DeltaPatch", "res/wgt/"); + AddStepAfter("DisableExternalMount"); + AddStepAfter("CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("CheckWgtImePrivilege"); + AddStepAfter("EncryptResources"); + AddStepAfter("CreateIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter("CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CheckExtensionPrivileges"); + AddStepAfter( + "CopyStorageDirectories"); } void WgtInstaller::RecoverySteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::RECOVERY, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AppInstaller::RecoverySteps(); + AddStepAfter("MountRecover"); + AddStepAfter( + "WgtRecoverSignature", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); } void WgtInstaller::MountInstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( + AppInstaller::MountInstallSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep( + AddStepAfter("Signature", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Install); - AddStep(); - AddStep( - ci::Plugin::ActionType::Install); - AddStep( + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("CheckWgtImePrivilege"); + AddStepAfter("MountInstall"); + AddStepAfter("CreateIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter( + "CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CheckExtensionPrivileges"); + ReplaceStep( + "CreateStorageDirectories", wgt::filesystem::WgtAdditionalSharedDirs); - AddStep(true); - AddStep(); + AddStepAfter( + "CreateStorageDirectories"); } void WgtInstaller::MountUpdateSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( + AppInstaller::MountUpdateSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep( + AddStepAfter("CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(true); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("CheckWgtImePrivilege"); + AddStepAfter("MountUpdate"); + AddStepAfter("CreateIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter( + "CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CheckExtensionPrivileges"); + AddStepAfter( + "UpdateStorageDirectories"); } void WgtInstaller::ManifestDirectInstallSteps() { - AddStep(pkgmgr_); - AddStep( + AppInstaller::ManifestDirectInstallSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep( + ReplaceStep("Signature", true); + AddStepAfter( + "DirectManifestSignature", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Install); - AddStep(); - AddStep(ci::Plugin::ActionType::Install); - AddStep( + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("RemoveGlobalAppSymlinks", + true); + AddStepAfter( + "WgtPatchIcons"); + AddStepAfter("CreateWgtSymbolicLink"); + ReplaceStep( + "CreateStorageDirectories", wgt::filesystem::WgtAdditionalSharedDirs); - AddStep(); - AddStep(); } void WgtInstaller::ManifestDirectUpdateSteps() { - AddStep(pkgmgr_); - AddStep( + AppInstaller::ManifestDirectUpdateSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep( + ReplaceStep("Signature", true); + AddStepAfter( + "CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("RemoveGlobalAppSymlinks", + true); + AddStepAfter( + "WgtPatchIcons"); + AddStepAfter("CreateWgtSymbolicLink"); } void WgtInstaller::ReadonlyUpdateInstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( + AppInstaller::ReadonlyUpdateInstallSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep( + AddStepAfter("CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep(ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("CheckWgtImePrivilege"); + AddStepAfter("EncryptResources"); + AddStepAfter("CreateIcons", true); + AddStepAfter("WgtPatchIcons"); + AddStepAfter( + "CopyPreviewIcons"); + AddStepAfter( + "CreateWgtSymbolicLink"); + AddStepAfter("CheckExtensionPrivileges"); + AddStepAfter( + "CreateStorageDirectories"); } void WgtInstaller::ReadonlyUpdateUninstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep(); - AddStep(false); - AddStep( + AppInstaller::ReadonlyUpdateUninstallSteps(); + AddStepBefore( + "Signature"); + AddStepAfter("Signature", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep(); - AddStep(ci::Plugin::ActionType::Upgrade); + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); } void WgtInstaller::ManifestPartialInstallSteps() { - AddStep(pkgmgr_); - AddStep( + AppInstaller::ManifestPartialInstallSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(false); - AddStep( + ReplaceStep("Signature", false); + AddStepAfter( + "DirectManifestSignature", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(false); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Install); - AddStep(); - AddStep(ci::Plugin::ActionType::Install); - AddStep( + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("RemoveGlobalAppSymlinks", + false); + ReplaceStep( + "CreateStorageDirectories", wgt::filesystem::WgtAdditionalSharedDirs); - AddStep(); } void WgtInstaller::ManifestPartialUpdateSteps() { - AddStep(pkgmgr_); - AddStep( + AppInstaller::ManifestPartialUpdateSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::BACKUP); - AddStep(false); - AddStep( + ReplaceStep("Signature", false); + AddStepAfter( + "CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); - AddStep(false); - AddStep(); - AddStep( - ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Update); - AddStep(); - AddStep( - ci::Plugin::ActionType::Upgrade); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); + AddStepAfter("RemoveGlobalAppSymlinks", + false); } void WgtInstaller::PartialUninstallSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep( - ci::Plugin::ActionType::Uninstall); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( - ci::security::StepPrivacyPrivilege::ActionType::Uninstall); - AddStep(); + AppInstaller::PartialUninstallSteps(); + AddStepAfter( + "RemovePerUserStorageDirectories"); } void WgtInstaller::MoveSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep(); - AddStep(); - AddStep(); + AppInstaller::MoveSteps(); } void WgtInstaller::EnablePkgSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep( - ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Enable); - AddStep( - ci::Plugin::ActionType::Install); + AppInstaller::EnablePkgSteps(); } void WgtInstaller::DisablePkgSteps() { - AddStep(pkgmgr_); - AddStep( - ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, - ci::configuration::StepParseManifest::StoreLocation::NORMAL); - AddStep(); - AddStep( - ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Disable); - AddStep( - ci::Plugin::ActionType::Uninstall); + AppInstaller::DisablePkgSteps(); } void WgtInstaller::MigrateExtImgSteps() { - AddStep(pkgmgr_); - AddStep(); - AddStep(); + AppInstaller::MigrateExtImgSteps(); } void WgtInstaller::RecoverDBSteps() { - AddStep(pkgmgr_); - AddStep( + AppInstaller::RecoverDBSteps(); + ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); - AddStep(); - AddStep(); - AddStep(); - AddStep( + AddStepAfter("GetPrivilegeLevel", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); - AddStep(); - AddStep(); - AddStep(); + AddStepAfter("PrivilegeCompatibility"); + AddStepAfter( + "CheckSettingsLevel"); + AddStepAfter( + "CheckWgtBackgroundCategory"); + AddStepAfter( + "CheckWgtNotificationCategory"); } } // namespace wgt -- 2.7.4 From 73f795782362c4c651a74eb7759d831eb4fd43a7 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 7 Jan 2020 18:00:03 +0900 Subject: [PATCH 10/16] Release version 0.13.0 Changes: - Fix adding steps using default steps Change-Id: Ia6d51c5d8f084943176f344158a61336361d8ded 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 81f10bc..b72199f 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.12.15 +Version: 0.13.0 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 809b4fa12b835dfc3aed838ef7601997cb4ab14e Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Wed, 4 Dec 2019 13:52:13 +0900 Subject: [PATCH 11/16] Move utility files into newly created directory Move it to reduce module circular dependency. Change-Id: Iffed47db7a38950afe961ea4ebdc9b5fd643e57f Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_backend_data.h | 2 +- src/unit_tests/manifest_test.cc | 2 +- src/unit_tests/smoke_test_helper.cc | 2 +- src/unit_tests/smoke_utils.h | 2 +- src/wgt/CMakeLists.txt | 4 +++- 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 | 2 +- src/wgt/step/encryption/step_encrypt_resources.h | 2 +- src/wgt/step/filesystem/step_copy_preview_icons.cc | 2 +- src/wgt/step/pkgmgr/step_generate_xml.cc | 2 +- src/wgt/step/security/step_check_extension_privileges.cc | 2 +- src/wgt/step/security/step_check_settings_level.cc | 2 +- src/wgt/step/security/step_check_wgt_background_category.cc | 2 +- src/wgt/{ => utils}/extension_config_parser.cc | 2 +- src/wgt/{ => utils}/extension_config_parser.h | 0 src/wgt/{ => utils}/shared_dirs.h | 0 src/wgt/{ => utils}/wgt_app_query_interface.cc | 2 +- src/wgt/{ => utils}/wgt_app_query_interface.h | 0 src/wgt/{ => utils}/wgt_backend_data.h | 0 src/wgt/wgt_installer.cc | 2 +- src/wgt_backend/wgt_backend.cc | 2 +- 22 files changed, 20 insertions(+), 18 deletions(-) rename src/wgt/{ => utils}/extension_config_parser.cc (99%) mode change 100755 => 100644 rename src/wgt/{ => utils}/extension_config_parser.h (100%) mode change 100755 => 100644 rename src/wgt/{ => utils}/shared_dirs.h (100%) rename src/wgt/{ => utils}/wgt_app_query_interface.cc (98%) rename src/wgt/{ => utils}/wgt_app_query_interface.h (100%) rename src/wgt/{ => utils}/wgt_backend_data.h (100%) diff --git a/src/hybrid/hybrid_backend_data.h b/src/hybrid/hybrid_backend_data.h index 9cc98c9..de0e9a0 100644 --- a/src/hybrid/hybrid_backend_data.h +++ b/src/hybrid/hybrid_backend_data.h @@ -13,7 +13,7 @@ #include #include -#include "wgt/wgt_backend_data.h" +#include "wgt/utils/wgt_backend_data.h" namespace hybrid { diff --git a/src/unit_tests/manifest_test.cc b/src/unit_tests/manifest_test.cc index 051d2f3..e195ff0 100644 --- a/src/unit_tests/manifest_test.cc +++ b/src/unit_tests/manifest_test.cc @@ -19,7 +19,7 @@ #include #include "wgt/step/configuration/step_parse.h" -#include "wgt/wgt_backend_data.h" +#include "wgt/utils/wgt_backend_data.h" #define ASSERT_CSTR_EQ(STR1, STR2) \ ASSERT_EQ(strcmp(STR1, STR2), 0) \ diff --git a/src/unit_tests/smoke_test_helper.cc b/src/unit_tests/smoke_test_helper.cc index 3549d84..9d666b2 100644 --- a/src/unit_tests/smoke_test_helper.cc +++ b/src/unit_tests/smoke_test_helper.cc @@ -5,7 +5,7 @@ #include #include -#include "wgt/wgt_app_query_interface.h" +#include "wgt/utils/wgt_app_query_interface.h" #include "wgt/wgt_installer.h" namespace ci = common_installer; diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/smoke_utils.h index 7b22263..14e0994 100644 --- a/src/unit_tests/smoke_utils.h +++ b/src/unit_tests/smoke_utils.h @@ -16,7 +16,7 @@ #include "hybrid/hybrid_installer.h" #include "wgt/wgt_installer.h" -#include "wgt/wgt_app_query_interface.h" +#include "wgt/utils/wgt_app_query_interface.h" namespace smoke_test { diff --git a/src/wgt/CMakeLists.txt b/src/wgt/CMakeLists.txt index a9baf9b..e2456c7 100755 --- a/src/wgt/CMakeLists.txt +++ b/src/wgt/CMakeLists.txt @@ -5,6 +5,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/encryption WGT_STEP_ENCRYP AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/filesystem WGT_STEP_FILESYSTEM_SRCS) 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) # Target - definition ADD_LIBRARY(${TARGET_LIBNAME_WGT} STATIC @@ -13,7 +14,8 @@ ADD_LIBRARY(${TARGET_LIBNAME_WGT} STATIC ${WGT_STEP_ENCRYPTION_SRCS} ${WGT_STEP_FILESYSTEM_SRCS} ${WGT_STEP_PKGMGR_SRCS} - ${WGT_STEP_SECURITY_SRCS}) + ${WGT_STEP_SECURITY_SRCS} + ${WGT_UTILS_SRCS}) # Target - includes TARGET_INCLUDE_DIRECTORIES(${TARGET_LIBNAME_WGT} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../") # Target - deps diff --git a/src/wgt/step/configuration/step_check_start_files.cc b/src/wgt/step/configuration/step_check_start_files.cc index 6db5b8e..c39474b 100644 --- a/src/wgt/step/configuration/step_check_start_files.cc +++ b/src/wgt/step/configuration/step_check_start_files.cc @@ -10,7 +10,7 @@ #include #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 7fc7025..31f42d5 100644 --- a/src/wgt/step/configuration/step_check_start_files.h +++ b/src/wgt/step/configuration/step_check_start_files.h @@ -12,7 +12,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 9cbf0fb..be1e09c 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -47,7 +47,7 @@ #include #include -#include "wgt/wgt_backend_data.h" +#include "wgt/utils/wgt_backend_data.h" namespace bf = boost::filesystem; namespace ci = common_installer; diff --git a/src/wgt/step/encryption/step_encrypt_resources.h b/src/wgt/step/encryption/step_encrypt_resources.h index 6b420fd..b66db68 100644 --- a/src/wgt/step/encryption/step_encrypt_resources.h +++ b/src/wgt/step/encryption/step_encrypt_resources.h @@ -10,7 +10,7 @@ #include #include -#include "wgt/wgt_backend_data.h" +#include "wgt/utils/wgt_backend_data.h" namespace wgt { namespace encryption { diff --git a/src/wgt/step/filesystem/step_copy_preview_icons.cc b/src/wgt/step/filesystem/step_copy_preview_icons.cc index 2cdf5cc..b706345 100644 --- a/src/wgt/step/filesystem/step_copy_preview_icons.cc +++ b/src/wgt/step/filesystem/step_copy_preview_icons.cc @@ -10,7 +10,7 @@ #include -#include "wgt/wgt_backend_data.h" +#include "wgt/utils/wgt_backend_data.h" namespace bf = boost::filesystem; namespace ci = common_installer; diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index f6537f9..7294e17 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -23,7 +23,7 @@ #include #include -#include "wgt/wgt_backend_data.h" +#include "wgt/utils/wgt_backend_data.h" namespace bs = boost::system; namespace bf = boost::filesystem; diff --git a/src/wgt/step/security/step_check_extension_privileges.cc b/src/wgt/step/security/step_check_extension_privileges.cc index b5330bd..affeb47 100755 --- a/src/wgt/step/security/step_check_extension_privileges.cc +++ b/src/wgt/step/security/step_check_extension_privileges.cc @@ -22,7 +22,7 @@ #include #include -#include "wgt/extension_config_parser.h" +#include "wgt/utils/extension_config_parser.h" namespace { diff --git a/src/wgt/step/security/step_check_settings_level.cc b/src/wgt/step/security/step_check_settings_level.cc index b26f7ed..2ea5a85 100644 --- a/src/wgt/step/security/step_check_settings_level.cc +++ b/src/wgt/step/security/step_check_settings_level.cc @@ -12,7 +12,7 @@ #include -#include "wgt/wgt_backend_data.h" +#include "wgt/utils/wgt_backend_data.h" namespace wgt { namespace security { diff --git a/src/wgt/step/security/step_check_wgt_background_category.cc b/src/wgt/step/security/step_check_wgt_background_category.cc index b3d6a2c..a245545 100644 --- a/src/wgt/step/security/step_check_wgt_background_category.cc +++ b/src/wgt/step/security/step_check_wgt_background_category.cc @@ -7,7 +7,7 @@ #include #include -#include "wgt/wgt_backend_data.h" +#include "wgt/utils/wgt_backend_data.h" namespace { diff --git a/src/wgt/extension_config_parser.cc b/src/wgt/utils/extension_config_parser.cc old mode 100755 new mode 100644 similarity index 99% rename from src/wgt/extension_config_parser.cc rename to src/wgt/utils/extension_config_parser.cc index 2409389..7a448a4 --- a/src/wgt/extension_config_parser.cc +++ b/src/wgt/utils/extension_config_parser.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a apache 2.0 license that can be // found in the LICENSE file. -#include "wgt/extension_config_parser.h" +#include "wgt/utils/extension_config_parser.h" #include #include diff --git a/src/wgt/extension_config_parser.h b/src/wgt/utils/extension_config_parser.h old mode 100755 new mode 100644 similarity index 100% rename from src/wgt/extension_config_parser.h rename to src/wgt/utils/extension_config_parser.h diff --git a/src/wgt/shared_dirs.h b/src/wgt/utils/shared_dirs.h similarity index 100% rename from src/wgt/shared_dirs.h rename to src/wgt/utils/shared_dirs.h diff --git a/src/wgt/wgt_app_query_interface.cc b/src/wgt/utils/wgt_app_query_interface.cc similarity index 98% rename from src/wgt/wgt_app_query_interface.cc rename to src/wgt/utils/wgt_app_query_interface.cc index 736982c..3c9131e 100644 --- a/src/wgt/wgt_app_query_interface.cc +++ b/src/wgt/utils/wgt_app_query_interface.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by an apache 2.0 license that can be // found in the LICENSE file. -#include "wgt/wgt_app_query_interface.h" +#include "wgt/utils/wgt_app_query_interface.h" #include #include diff --git a/src/wgt/wgt_app_query_interface.h b/src/wgt/utils/wgt_app_query_interface.h similarity index 100% rename from src/wgt/wgt_app_query_interface.h rename to src/wgt/utils/wgt_app_query_interface.h diff --git a/src/wgt/wgt_backend_data.h b/src/wgt/utils/wgt_backend_data.h similarity index 100% rename from src/wgt/wgt_backend_data.h rename to src/wgt/utils/wgt_backend_data.h diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index f74e37a..76d0a00 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -14,7 +14,7 @@ #include -#include "wgt/shared_dirs.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" #include "wgt/step/configuration/step_parse.h" diff --git a/src/wgt_backend/wgt_backend.cc b/src/wgt_backend/wgt_backend.cc index f0633b4..9f003e3 100644 --- a/src/wgt_backend/wgt_backend.cc +++ b/src/wgt_backend/wgt_backend.cc @@ -7,7 +7,7 @@ #include #include "hybrid/hybrid_installer.h" -#include "wgt/wgt_app_query_interface.h" +#include "wgt/utils/wgt_app_query_interface.h" #include "wgt/wgt_installer.h" namespace ci = common_installer; -- 2.7.4 From 7d5895abb99e19a2b9a5482489c034a58d73b413 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 17 Jan 2020 10:33:50 +0900 Subject: [PATCH 12/16] Resolve static analysis issue Change-Id: I97616611b142e81b8457e653a0a8218b7419a442 Signed-off-by: Junghyun Yeon --- src/hybrid/step/pkgmgr/step_merge_xml.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hybrid/step/pkgmgr/step_merge_xml.cc b/src/hybrid/step/pkgmgr/step_merge_xml.cc index e36e542..529545c 100644 --- a/src/hybrid/step/pkgmgr/step_merge_xml.cc +++ b/src/hybrid/step/pkgmgr/step_merge_xml.cc @@ -90,6 +90,8 @@ xmlNodePtr StepMergeXml::GetXmlNode(const xmlDocPtr doc, xmlXPathObjectPtr obj = xmlXPathEvalExpression((const xmlChar*)expr.c_str(), ctxt); if (!obj || !obj->nodesetval || !obj->nodesetval->nodeNr) { + if (obj) + xmlXPathFreeObject(obj); xmlXPathFreeContext(ctxt); return nullptr; } @@ -140,7 +142,7 @@ bool StepMergeXml::SetTpkPrivilegeType() { xmlSetProp(node, kPrivilegeTypeAttributeKey, (const xmlChar*)"tpk"); } } - + xmlXPathFreeObject(xpath_obj); xmlXPathFreeContext(xpath_ctx); return true; -- 2.7.4 From e1cdfec8f7057b50e6a0a9a13b308cffbe951e6c Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Fri, 17 Jan 2020 17:43:08 +0900 Subject: [PATCH 13/16] Release version 0.13.1 Changes: - Move utility files into newly created directory - Resolve static analysis issue Change-Id: I27ce0fac37328ea066bf1fffb2bb9f65d89b3e50 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 b72199f..7553347 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.13.0 +Version: 0.13.1 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 0b9dfe6e0c68cac273a3d844702734480daf4480 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Mon, 10 Feb 2020 16:33:29 +0900 Subject: [PATCH 14/16] Add return value checking routine Change-Id: Ibc4b9ed32dd5c908e3ec5976a1e364ba11fed87e Signed-off-by: Junghyun Yeon --- src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc | 3 ++- 1 file changed, 2 insertions(+), 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 d234494..8581504 100644 --- a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc @@ -40,7 +40,8 @@ bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() { continue; // binary is a symbolic link named and is located in / bf::path exec_path = context_->GetPkgPath() / bf::path("bin"); - common_installer::CreateDir(exec_path); + if (!common_installer::CreateDir(exec_path)) + return false; exec_path /= bf::path(app->appid); common_installer::RemoveAll(exec_path); -- 2.7.4 From 3a8f13bcfd4131ede02e2826b06e08a8021ca731 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Thu, 23 Jan 2020 10:41:39 +0900 Subject: [PATCH 15/16] Change clean operations not to return failure Change-Id: Ica687fe9393e7adff0bed3107b597df9472a2fab Signed-off-by: Ilho Kim --- src/wgt/step/filesystem/step_wgt_update_package_directory.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) 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 76396db..efe6be8 100644 --- a/src/wgt/step/filesystem/step_wgt_update_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_update_package_directory.cc @@ -108,14 +108,8 @@ ci::Step::Status StepWgtUpdatePackageDirectory::process() { ci::Step::Status StepWgtUpdatePackageDirectory::clean() { bf::path backup_path = ci::GetBackupPathForPackagePath(context_->GetPkgPath()); - if (bf::exists(backup_path)) { - bs::error_code error; - bf::remove_all(backup_path, error); - if (error) { - LOG(ERROR) << "Failed to remove backup directories"; - return Status::APP_DIR_ERROR; - } - } + if (bf::exists(backup_path)) + ci::RemoveAll(backup_path); return Status::OK; } -- 2.7.4 From 9d752830b7a5b0d71c14ee115f1bc6465aa507a7 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Fri, 14 Feb 2020 16:54:47 +0900 Subject: [PATCH 16/16] Release version 0.13.2 Changes: - Add return value checking routine - Change clean operations not to return failure Change-Id: Ib2903107521b3e7d71b79de34ab08af0a71fdb63 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 7553347..6f44f5f 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.13.1 +Version: 0.13.2 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4