From 71f6fe2fbe94e8e883d1c6d044159ecb824a3445 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 21 Jun 2018 19:46:06 +0900 Subject: [PATCH] Fix codes for Manifest installation - Operations like ManifestDirectInstall will parse merged manifest so it does not have to merge configurations for hybrid pkg, so add options to determine merge or overwrites configurations. Change-Id: I14af1674769daea48499ae7ce4856cb5dc00a671 Signed-off-by: Ilho Kim --- src/hybrid/hybrid_installer.cc | 30 ++++++++++++++-------- .../step/configuration/step_merge_tpk_config.cc | 14 +++++++--- .../step/configuration/step_merge_tpk_config.h | 11 ++++++++ 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index d238400..01266aa 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -152,7 +152,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); AddStep(); AddStep(); AddStep(); @@ -210,7 +211,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); AddStep(); AddStep(); AddStep(); @@ -302,7 +304,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); AddStep(); AddStep(); AddStep( @@ -375,7 +378,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); AddStep(); AddStep(); AddStep(); @@ -432,7 +436,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); AddStep(); AddStep(); AddStep(); @@ -472,7 +477,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); @@ -513,7 +519,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); @@ -535,7 +542,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep( wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); AddStep(); AddStep(); AddStep(); @@ -564,7 +572,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep( wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); AddStep(); AddStep(); AddStep(); @@ -647,7 +656,8 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); AddStep(); AddStep(); AddStep(); diff --git a/src/hybrid/step/configuration/step_merge_tpk_config.cc b/src/hybrid/step/configuration/step_merge_tpk_config.cc index 15d59c3..d63d003 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.cc +++ b/src/hybrid/step/configuration/step_merge_tpk_config.cc @@ -11,16 +11,24 @@ namespace hybrid { namespace configuration { +StepMergeTpkConfig::StepMergeTpkConfig( + common_installer::InstallerContext* context, + MergeType type) : Step(context), merge_type_(type) { +} + common_installer::Step::Status StepMergeTpkConfig::process() { HybridBackendData* data = static_cast(context_->backend_data.get()); manifest_x* tpk_data = data->tpk_manifest_data.get(); manifest_x* wgt_data = context_->manifest_data.get(); - wgt_data->application = - g_list_concat(wgt_data->application, tpk_data->application); - tpk_data->application = nullptr; + if (merge_type_ == MergeType::CONCAT) + wgt_data->application = + g_list_concat(wgt_data->application, tpk_data->application); + else + wgt_data->application = tpk_data->application; + tpk_data->application = nullptr; return Status::OK; } diff --git a/src/hybrid/step/configuration/step_merge_tpk_config.h b/src/hybrid/step/configuration/step_merge_tpk_config.h index 2171d59..6491d34 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.h +++ b/src/hybrid/step/configuration/step_merge_tpk_config.h @@ -18,6 +18,14 @@ namespace configuration { */ class StepMergeTpkConfig : public common_installer::Step { public: + enum class MergeType { + CONCAT, // Concatenate configurations + OVERWRITE // Overwrite one with others + }; + + explicit StepMergeTpkConfig(common_installer::InstallerContext* context, + MergeType type); + using Step::Step; Status process() override; @@ -25,6 +33,9 @@ class StepMergeTpkConfig : public common_installer::Step { Status undo() override { return Status::OK; } Status precheck() override { return Status::OK; } + private: + MergeType merge_type_; + STEP_NAME(MergeTpkConfig) }; -- 2.7.4