From af489d9d75a35ab926b56d436df01d05a3c4aee2 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 28 Nov 2019 09:18:02 +0900 Subject: [PATCH 01/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 02/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 03/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 04/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 05/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 06/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 07/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 08/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 09/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 10/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 11/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 From f54fe6ed3c2c7ab91b154ef60387d06ac09b0ce8 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Mon, 14 Oct 2019 10:59:07 +0900 Subject: [PATCH 12/16] Split rpm packaging into library part and backend part Change-Id: Icdf2ae772b047ae521a5cfbceb7586c1df946ed5 Signed-off-by: Sangyoon Jang --- packaging/wgt-backend-tests.manifest | 10 ------ packaging/wgt-backend.spec | 59 ++++++++++++++++++++++++++-------- packaging/wgt-installer-tests.manifest | 10 ++++++ packaging/wgt-installer.manifest | 5 +++ src/hybrid/CMakeLists.txt | 6 +++- src/unit_tests/CMakeLists.txt | 2 +- src/unit_tests/manifest_test.cc | 2 +- src/unit_tests/smoke_test.cc | 12 +++---- src/unit_tests/smoke_utils.cc | 2 +- src/wgt/CMakeLists.txt | 10 +++++- src/wgt/wgt-installer.pc.in | 11 +++++++ 11 files changed, 94 insertions(+), 35 deletions(-) delete mode 100644 packaging/wgt-backend-tests.manifest create mode 100644 packaging/wgt-installer-tests.manifest create mode 100644 packaging/wgt-installer.manifest create mode 100644 src/wgt/wgt-installer.pc.in diff --git a/packaging/wgt-backend-tests.manifest b/packaging/wgt-backend-tests.manifest deleted file mode 100644 index 8ea34c3..0000000 --- a/packaging/wgt-backend-tests.manifest +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 6f44f5f..7c933b4 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -7,8 +7,10 @@ License: Apache-2.0 Source0: %{name}-%{version}.tar.gz Source1000: wgt-backend.manifest -Source1001: wgt-backend-tests.manifest +Source1001: wgt-installer.manifest +Source1002: wgt-installer-tests.manifest +Requires: wgt-installer = %{version} BuildRequires: boost-devel BuildRequires: cmake BuildRequires: gtest-devel @@ -26,18 +28,34 @@ BuildRequires: pkgconfig(libgum) %description This is a package that installs the WGT backend of pkgmgr. -%package tests -Summary: Unit tests for wgt-backend -Requires: %{name} = %{version} +%package -n wgt-installer +Summary: Wgt-installer library +Group: Application Framework/Package Management -%description tests -Unit tests for wgt-backend +%description -n wgt-installer +This package contains wgt-installer library + +%package -n wgt-installer-devel +Summary: Wgt-installer development files +Group: Application Framework/Package Management +Requires: wgt-installer = %{version} + +%description -n wgt-installer-devel +This package contains header files of wgt-installer library + +%package -n wgt-installer-tests +Summary: Unit tests for wgt-installer +Requires: wgt-installer = %{version} + +%description -n wgt-installer-tests +Unit tests for wgt-installer %prep %setup -q cp %{SOURCE1000} . cp %{SOURCE1001} . +cp %{SOURCE1002} . %build %cmake . -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} @@ -48,22 +66,35 @@ make %{?_smp_mflags} mkdir -p %{buildroot}/etc/package-manager/backend ln -s %{_bindir}/wgt-backend %{buildroot}%{_sysconfdir}/package-manager/backend/wgt -%post tests -/usr/sbin/setcap cap_chown,cap_dac_override,cap_fowner=eip %{_bindir}/wgt-backend-ut/smoke-test -/usr/sbin/setcap cap_chown,cap_dac_override,cap_fowner=eip %{_bindir}/wgt-backend-ut/smoke-test-helper +%post -n wgt-installer-tests +/usr/sbin/setcap cap_chown,cap_dac_override,cap_fowner=eip %{_bindir}/wgt-installer-ut/smoke-test +/usr/sbin/setcap cap_chown,cap_dac_override,cap_fowner=eip %{_bindir}/wgt-installer-ut/smoke-test-helper %files %manifest wgt-backend.manifest %license LICENSE %{_sysconfdir}/package-manager/backend/wgt -%{_sysconfdir}/package-manager/backendlib/libwgt.so %{_bindir}/wgt-backend %{_datadir}/wgt-backend/default.png -%files tests -%manifest wgt-backend-tests.manifest -%{_bindir}/wgt-backend-ut/* -%{_datadir}/wgt-backend-ut/* +%files -n wgt-installer +%manifest wgt-installer.manifest +%{_sysconfdir}/package-manager/backendlib/libwgt.so +%{_libdir}/libwgt-installer.so* +%{_libdir}/libhybrid-installer.so* + +%files -n wgt-installer-devel +%{_includedir}/app-installers/wgt/*.h +%{_includedir}/app-installers/wgt/*/*.h +%{_includedir}/app-installers/wgt/*/*/*.h +%{_includedir}/app-installers/hybrid/*.h +%{_includedir}/app-installers/hybrid/*/*/*.h +%{_libdir}/pkgconfig/wgt-installer.pc + +%files -n wgt-installer-tests +%manifest wgt-installer-tests.manifest +%{_bindir}/wgt-installer-ut/* +%{_datadir}/wgt-installer-ut/* %changelog * Thu Dec 18 2015 Pawel Sikorski 0.1-1 diff --git a/packaging/wgt-installer-tests.manifest b/packaging/wgt-installer-tests.manifest new file mode 100644 index 0000000..f5159f3 --- /dev/null +++ b/packaging/wgt-installer-tests.manifest @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packaging/wgt-installer.manifest b/packaging/wgt-installer.manifest new file mode 100644 index 0000000..c00c25b --- /dev/null +++ b/packaging/wgt-installer.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/src/hybrid/CMakeLists.txt b/src/hybrid/CMakeLists.txt index 016c783..9d11bd9 100644 --- a/src/hybrid/CMakeLists.txt +++ b/src/hybrid/CMakeLists.txt @@ -2,7 +2,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} HYBRID_SRCS) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/configuration HYBRID_STEP_CONFIGURATION_SRCS) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/encryption HYBRID_STEP_ENCRYPTION_SRCS) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/pkgmgr HYBRID_STEP_PKGMGR_SRCS) -ADD_LIBRARY(${TARGET_LIBNAME_HYBRID} STATIC +ADD_LIBRARY(${TARGET_LIBNAME_HYBRID} SHARED ${HYBRID_SRCS} ${HYBRID_STEP_CONFIGURATION_SRCS} ${HYBRID_STEP_ENCRYPTION_SRCS} @@ -19,3 +19,7 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_HYBRID} PUBLIC # Target - in-package deps TARGET_LINK_LIBRARIES(${TARGET_LIBNAME_HYBRID} PRIVATE ${TARGET_LIBNAME_WGT}) SET_TARGET_PROPERTIES(${TARGET_LIBNAME_HYBRID} PROPERTIES COMPILE_FLAGS "-fPIC") + +INSTALL(TARGETS ${TARGET_LIBNAME_HYBRID} DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(DIRECTORY ./ DESTINATION ${INCLUDEDIR}/app-installers/hybrid/ + FILES_MATCHING PATTERN "*.h") diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt index 5e98bc3..380ad2d 100644 --- a/src/unit_tests/CMakeLists.txt +++ b/src/unit_tests/CMakeLists.txt @@ -1,4 +1,4 @@ -SET(DESTINATION_DIR wgt-backend-ut) +SET(DESTINATION_DIR wgt-installer-ut) SET(TARGET_SMOKE_UTILS smoke-utils) # Executables diff --git a/src/unit_tests/manifest_test.cc b/src/unit_tests/manifest_test.cc index e195ff0..ca90c26 100644 --- a/src/unit_tests/manifest_test.cc +++ b/src/unit_tests/manifest_test.cc @@ -30,7 +30,7 @@ namespace ci = common_installer; namespace { const char kManifestTestcaseData[] = - "/usr/share/wgt-backend-ut/test_samples/manifest/"; + "/usr/share/wgt-installer-ut/test_samples/manifest/"; template gint Size(GListRange* range) { diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 4ceba21..581908a 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -235,7 +235,7 @@ TEST_F(SmokeTest, DeltaMode) { TEST_F(SmokeTest, RecoveryMode_ForInstallation) { bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt"; - ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper"); + ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper"); std::string test_uid_str = std::to_string(params.test_user.uid); backend_crash.Run("-i", path.string(), "-u", test_uid_str.c_str()); ASSERT_NE(backend_crash.Wait(), 0); @@ -256,7 +256,7 @@ TEST_F(SmokeTest, RecoveryMode_ForUpdate) { std::string pkgid = "smokewgt10"; std::string appid = "smokewgt10.RecoveryModeForUpdate"; AddDataFiles(pkgid, params.test_user.uid); - ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper"); + ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper"); std::string test_uid_str = std::to_string(params.test_user.uid); backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str()); ASSERT_NE(backend_crash.Wait(), 0); @@ -277,7 +277,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK); - ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper"); + ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper"); std::string test_uid_str = std::to_string(params.test_user.uid); backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str()); ASSERT_NE(backend_crash.Wait(), 0); @@ -297,7 +297,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); - ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper"); + ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper"); std::string test_uid_str = std::to_string(params.test_user.uid); backend_crash.Run("-w", path.string(), "-u", test_uid_str.c_str()); ASSERT_NE(backend_crash.Wait(), 0); @@ -321,7 +321,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { ASSERT_EQ(backend.MountInstallSuccess(path_old), ci::AppInstaller::Result::OK); AddDataFiles(pkgid, params.test_user.uid); - ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper"); + ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper"); std::string test_uid_str = std::to_string(params.test_user.uid); backend_crash.Run("-w", path_new.string(), "-u", test_uid_str.c_str()); ASSERT_NE(backend_crash.Wait(), 0); @@ -867,7 +867,7 @@ TEST_F(SmokeTest, InstallExtendedMode) { TEST_F(SmokeTest, RecoveryMode_CrashAfterUnzip) { bf::path path = kSmokePackagesDirectory / "RecoveryMode_CrashAfterUnzip.wgt"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); - ci::Subprocess backend_crash("/usr/bin/wgt-backend-ut/smoke-test-helper"); + ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper"); std::string test_uid_str = std::to_string(params.test_user.uid); backend_crash.Run("-i", path.string(), "-u", test_uid_str.c_str(), "-step_name", "Unzip"); diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index 14965f9..44c8158 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -19,7 +19,7 @@ namespace st = smoke_test; namespace smoke_test { const bf::path kSmokePackagesDirectory = - "/usr/share/wgt-backend-ut/test_samples/smoke/"; + "/usr/share/wgt-installer-ut/test_samples/smoke/"; bool ValidatePackage(const std::string& pkgid, const std::vector& appids, diff --git a/src/wgt/CMakeLists.txt b/src/wgt/CMakeLists.txt index e2456c7..9aa1b7b 100755 --- a/src/wgt/CMakeLists.txt +++ b/src/wgt/CMakeLists.txt @@ -8,7 +8,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/step/security WGT_STEP_SECURITY AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/utils WGT_UTILS_SRCS) # Target - definition -ADD_LIBRARY(${TARGET_LIBNAME_WGT} STATIC +ADD_LIBRARY(${TARGET_LIBNAME_WGT} SHARED ${WGT_SRCS} ${WGT_STEP_CONFIGURATION_SRCS} ${WGT_STEP_ENCRYPTION_SRCS} @@ -28,3 +28,11 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_WGT} PUBLIC Boost ) SET_TARGET_PROPERTIES(${TARGET_LIBNAME_WGT} PROPERTIES COMPILE_FLAGS "-fPIC") + +INSTALL(TARGETS ${TARGET_LIBNAME_WGT} DESTINATION ${LIB_INSTALL_DIR}) + +# Export devel package +CONFIGURE_FILE(wgt-installer.pc.in wgt-installer.pc @ONLY) +INSTALL(FILES wgt-installer.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(DIRECTORY ./ DESTINATION ${INCLUDEDIR}/app-installers/wgt/ + FILES_MATCHING PATTERN "*.h") diff --git a/src/wgt/wgt-installer.pc.in b/src/wgt/wgt-installer.pc.in new file mode 100644 index 0000000..ec397c2 --- /dev/null +++ b/src/wgt/wgt-installer.pc.in @@ -0,0 +1,11 @@ +prefix=@PREFIX@ +exec_prefix=@PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: wgt-installer +Description: Wgt-installer library +Version: @FULLVER@ +Requires: app-installers pkgmgr wgt-manifest-handlers manifest-parser +Libs: -L${libdir} -lwgt-installer -lhybrid-installer +Cflags: -I${includedir}/app-installers/ -- 2.7.4 From a9deda311ddc7ed79ab18c4ac107c1c01bcd6277 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 18 Feb 2020 09:16:38 +0900 Subject: [PATCH 13/16] Fix smoke test Recovery check routine changed after the recovery file is created Change-Id: Ic2aa91853301c704d78cbc1a928b3a725c21f578 Signed-off-by: Ilho Kim --- src/unit_tests/extensive_smoke_test.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/unit_tests/extensive_smoke_test.cc b/src/unit_tests/extensive_smoke_test.cc index 1f0a8ab..92abb49 100644 --- a/src/unit_tests/extensive_smoke_test.cc +++ b/src/unit_tests/extensive_smoke_test.cc @@ -93,7 +93,7 @@ TEST_F(SmokeTest, RecoveryMode_ForInstallation) { std::vector args = {"", "-i", path.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { - if (step >= 1) { + if (step >= 2) { bf::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); @@ -118,7 +118,7 @@ TEST_F(SmokeTest, RecoveryMode_ForUpdate) { std::vector args = {"", "-i", path_new.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { - if (step >= 1) { + if (step >= 2) { bf::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); @@ -146,7 +146,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { std::vector args = {"", "-i", path_new.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { - if (step >= 1) { + if (step >= 2) { bf::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); @@ -171,7 +171,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { std::vector args = {"", "-w", path.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { - if (step >= 1) { + if (step >= 2) { bf::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); @@ -197,7 +197,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { std::vector args = {"", "-w", path_new.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { - if (step >= 1) { + if (step >= 2) { // Filesystem may be mounted after crash ScopedTzipInterface poweroff_unmount_interface(pkgid, params.test_user.uid); -- 2.7.4 From dc3d02324f7d161c92d86f459544c72561c71ade Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Wed, 26 Feb 2020 15:36:01 +0900 Subject: [PATCH 14/16] Fix StepEncryptResources Revert if statement expression. Change-Id: Ie147d0952ce8f3dec67fe00760baf9194e22c216 Signed-off-by: Junghyun Yeon --- src/wgt/step/encryption/step_encrypt_resources.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wgt/step/encryption/step_encrypt_resources.cc b/src/wgt/step/encryption/step_encrypt_resources.cc index dffaa89..c5bbb9b 100644 --- a/src/wgt/step/encryption/step_encrypt_resources.cc +++ b/src/wgt/step/encryption/step_encrypt_resources.cc @@ -165,7 +165,7 @@ bool StepEncryptResources::EncryptFile(const bf::path &src) { return false; } const std::size_t fileSize = info.st_size; - if (!fileSize) { + if (0 == fileSize) { LOG(ERROR) << src << " size is 0, so encryption will be skipped"; return true; } @@ -192,7 +192,7 @@ bool StepEncryptResources::EncryptFile(const bf::path &src) { do { bytesRead = ReadBytes(inChunk.get(), chunkSize, input); - if (!bytesRead) { + if (0 != bytesRead) { unsigned char* encrypted_data = nullptr; size_t encrypted_size = 0; // TODO(p.sikorski) check if it is Preloaded @@ -266,11 +266,11 @@ bool StepEncryptResources::EncryptFile(const bf::path &src) { fclose(input); LOG(DEBUG) << "File encrypted successfully"; - if (!unlink(src.c_str())) + if (0 != unlink(src.c_str())) return false; LOG(DEBUG) << "Rename encrypted file"; - if (!std::rename(encFile.c_str(), src.c_str())) + if (0 != std::rename(encFile.c_str(), src.c_str())) return false; return true; -- 2.7.4 From 74d7eb833c58dfef070170f000a8ea37cd0d19f7 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Thu, 27 Feb 2020 12:32:05 +0900 Subject: [PATCH 15/16] Release version 0.14.0 Changes: - Split rpm packaging into library part and backend part - Fix smoke test - Fix StepEncryptResources Change-Id: Ic0313967106bdf0d8069afe7235fadfbeb17721a Signed-off-by: Sangyoon Jang --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 7c933b4..8b9514b 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.2 +Version: 0.14.0 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 832271df62d44a92ebb4cd06927799a34e3b4d46 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Thu, 27 Feb 2020 10:50:03 +0900 Subject: [PATCH 16/16] Add StepCrash's clean operation This patch can be used to test the installation termination in a clean operation Change-Id: I9b5cc0e991d84196d4738d360d106b55c8e352ff Signed-off-by: Ilho Kim --- src/unit_tests/smoke_test_helper.cc | 54 +++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/unit_tests/smoke_test_helper.cc b/src/unit_tests/smoke_test_helper.cc index 9d666b2..6e8643c 100644 --- a/src/unit_tests/smoke_test_helper.cc +++ b/src/unit_tests/smoke_test_helper.cc @@ -12,37 +12,54 @@ namespace ci = common_installer; namespace { +enum class CrashStepType { + PROCESS, + CLEAN +}; + class StepCrash : public ci::Step { public: using Step::Step; + explicit StepCrash(ci::InstallerContext* context, CrashStepType type) : + ci::Step::Step(context), type_(type) {} + ci::Step::Status process() override { - raise(SIGSEGV); + if (type_ == CrashStepType::PROCESS) + raise(SIGSEGV); + return Status::OK; + } + ci::Step::Status clean() override { + if (type_ == CrashStepType::CLEAN) + raise(SIGSEGV); return Status::OK; } - ci::Step::Status clean() override { return ci::Step::Status::OK; } ci::Step::Status undo() override { return ci::Step::Status::OK; } ci::Step::Status precheck() override { return ci::Step::Status::OK; } STEP_NAME(Crash) + + private: + CrashStepType type_; }; #define OVERRIDE_STEPS_BLOCK(STEPS) \ void STEPS() override { \ wgt::WgtInstaller::STEPS(); \ if (crash_at_ > -1) \ - AddStepAtIndex(crash_at_); \ + AddStepAtIndex(crash_at_, type_); \ else if (step_name_.size()) \ - AddStepAfter(step_name_); \ + AddStepAfter(step_name_, type_); \ else \ - AddStep(); \ + AddStep(type_); \ } \ class CrashWgtInstaller : public wgt::WgtInstaller { public: explicit CrashWgtInstaller(ci::PkgMgrPtr pkgmgr, int crash_at, - std::string step_name) : wgt::WgtInstaller(pkgmgr), crash_at_(crash_at), - step_name_(step_name) { } + std::string step_name, CrashStepType type) : + wgt::WgtInstaller(pkgmgr), crash_at_(crash_at), + step_name_(step_name), type_(type) { } private: OVERRIDE_STEPS_BLOCK(InstallSteps) @@ -68,6 +85,7 @@ class CrashWgtInstaller : public wgt::WgtInstaller { int crash_at_; std::string step_name_; + CrashStepType type_; }; } // namespace @@ -77,18 +95,26 @@ int main(int argc, char** argv) { int index = -1; int backend_argc = argc; std::string step_name; - if (!strcmp(argv[argc-2], "-idx")) { - index = atoi(argv[argc-1]); - backend_argc = argc - 2; + CrashStepType type = CrashStepType::PROCESS; + + if (!strcmp(argv[backend_argc - 2], "-idx")) { + index = atoi(argv[argc - 1]); + backend_argc -= 2; LOG(DEBUG) << "Step crash after " << index << " step."; } - if (!strcmp(argv[argc-2], "-step_name")) { - step_name = argv[argc-1]; - backend_argc = argc-2; + if (!strcmp(argv[backend_argc - 2], "-step_name")) { + step_name = argv[backend_argc - 1]; + backend_argc -= 2; LOG(DEBUG) << "Step crash after " << step_name << " step."; } + if (!strcmp(argv[backend_argc - 1], "-type_clean")) { + backend_argc--; + type = CrashStepType::CLEAN; + LOG(DEBUG) << "step will be crashed in clean operation"; + } + ci::PkgmgrInstaller pkgmgr_installer; wgt::WgtAppQueryInterface query_interface; auto pkgmgr = ci::PkgMgrInterface::Create(backend_argc, argv, @@ -98,7 +124,7 @@ int main(int argc, char** argv) { return EINVAL; } - ::CrashWgtInstaller installer(pkgmgr, index, step_name); + ::CrashWgtInstaller installer(pkgmgr, index, step_name, type); return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } -- 2.7.4