From ce4b265558925fa44566eed0763ba0b5802c8293 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Wed, 4 Sep 2019 15:30:29 +0900 Subject: [PATCH 01/16] Fix static analysis issue Remove unnecessary null checking. Change-Id: I7c86b64e0cfe496c6b361f696b546a7ac7707438 Signed-off-by: Sangyoon Jang --- src/wgt/step/filesystem/step_wgt_patch_icons.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wgt/step/filesystem/step_wgt_patch_icons.cc b/src/wgt/step/filesystem/step_wgt_patch_icons.cc index 89c5b35..1522b1b 100644 --- a/src/wgt/step/filesystem/step_wgt_patch_icons.cc +++ b/src/wgt/step/filesystem/step_wgt_patch_icons.cc @@ -45,8 +45,7 @@ bool PatchIcon(icon_x* icon, const bf::path& dst_path, bool make_copy) { return false; } } - if (icon->text) - free(const_cast(icon->text)); + free(const_cast(icon->text)); icon->text = strdup(icon_path.c_str()); return true; -- 2.7.4 From 6375f258df99df2b71b0c800c3f20da7cb1989d9 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Thu, 5 Sep 2019 16:31:36 +0900 Subject: [PATCH 02/16] Release version 0.12.10 Changes: - Add recover test for crash after unzip - Fix static analysis issue Change-Id: I57de64914b46fc66e820100b323c5d5916dd63ef 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 4c8eb81..7e06255 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.9 +Version: 0.12.10 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 8916816b9b382d4ca878b9a67b5a054bd8eb0a04 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 9 Aug 2019 17:30:55 +0900 Subject: [PATCH 03/16] Fix StepMergeTpkConfig for application attribute Mainapp attribute should be modified at here to set mainapp as true for webapp. Change-Id: I94aa9e482a2550fefa1378f1fa3e961f0636ad0c Signed-off-by: Junghyun Yeon --- .../step/configuration/step_merge_tpk_config.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/hybrid/step/configuration/step_merge_tpk_config.cc b/src/hybrid/step/configuration/step_merge_tpk_config.cc index d63d003..eb2619f 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.cc +++ b/src/hybrid/step/configuration/step_merge_tpk_config.cc @@ -6,6 +6,8 @@ #include +#include + #include "hybrid/hybrid_backend_data.h" namespace hybrid { @@ -22,11 +24,27 @@ common_installer::Step::Status StepMergeTpkConfig::process() { manifest_x* tpk_data = data->tpk_manifest_data.get(); manifest_x* wgt_data = context_->manifest_data.get(); - if (merge_type_ == MergeType::CONCAT) + if (merge_type_ == MergeType::CONCAT) { wgt_data->application = g_list_concat(wgt_data->application, tpk_data->application); - else + } else { + // mainappid should be webapp for hybrid pkg + for (application_x* app : + GListRange(tpk_data->application)) { + if (app->type && strcmp(app->type, "webapp") != 0) + continue; + + if (app->mainapp) + free(app->mainapp); + app->mainapp = strdup("true"); + if (!app->mainapp) { + LOG(ERROR) << "Out of memoery"; + return Status::ERROR; + } + break; + } wgt_data->application = tpk_data->application; + } tpk_data->application = nullptr; return Status::OK; -- 2.7.4 From f815c11aff4bda44a57023bac5adaa021b4a792a Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Fri, 20 Sep 2019 10:38:15 +0900 Subject: [PATCH 04/16] Release version 0.12.11 Changes: - Fix StepMergeTpkConfig for application attribute Change-Id: I99d9ea3a3a30d21a17b1c2ee71e7e7650df4a5f7 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 7e06255..e631fab 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.10 +Version: 0.12.11 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 9da7384f9b49669ab861363b73babe2f2ad0d17b Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 15 Oct 2019 16:02:04 +0900 Subject: [PATCH 05/16] Fix installing privileges of hybrid package Change-Id: Ic8db846e8ffd2b09327f81778036e62c751584be Signed-off-by: Sangyoon Jang --- src/hybrid/hybrid_installer.cc | 58 ++++++++++++++++---------------- src/hybrid/step/pkgmgr/step_merge_xml.cc | 31 +++++++++++++++-- src/hybrid/step/pkgmgr/step_merge_xml.h | 1 + 3 files changed, 59 insertions(+), 31 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 2e0efe3..31028d0 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -132,9 +132,6 @@ void HybridInstaller::InstallSteps() { AddStep(); AddStep(); AddStep(true); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -155,6 +152,9 @@ void HybridInstaller::InstallSteps() { AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); + AddStep( + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -185,9 +185,6 @@ void HybridInstaller::UpdateSteps() { AddStep(); AddStep(); AddStep(true); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -215,6 +212,9 @@ void HybridInstaller::UpdateSteps() { AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); + AddStep( + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -284,9 +284,6 @@ void HybridInstaller::DeltaSteps() { AddStep(); AddStep(); AddStep(true); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -311,6 +308,9 @@ void HybridInstaller::DeltaSteps() { AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); + AddStep( + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep( @@ -363,9 +363,6 @@ void HybridInstaller::MountInstallSteps() { AddStep(); AddStep(); AddStep(true); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -386,6 +383,9 @@ void HybridInstaller::MountInstallSteps() { AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); + AddStep( + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -416,9 +416,6 @@ void HybridInstaller::MountUpdateSteps() { AddStep(); AddStep(); AddStep(true); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -445,6 +442,9 @@ void HybridInstaller::MountUpdateSteps() { AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); + AddStep( + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -472,9 +472,6 @@ void HybridInstaller::ManifestDirectInstallSteps() { AddStep(); AddStep(); AddStep(true); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -486,6 +483,9 @@ void HybridInstaller::ManifestDirectInstallSteps() { AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); + AddStep( + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); @@ -512,9 +512,6 @@ void HybridInstaller::ManifestDirectUpdateSteps() { AddStep(); AddStep(); AddStep(true); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep( @@ -529,6 +526,9 @@ void HybridInstaller::ManifestDirectUpdateSteps() { AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); + AddStep( + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); @@ -550,11 +550,11 @@ void HybridInstaller::ManifestPartialInstallSteps() { AddStep(); AddStep( wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); AddStep(); AddStep(false); + AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); @@ -580,7 +580,6 @@ void HybridInstaller::ManifestPartialUpdateSteps() { AddStep(); AddStep( wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); AddStep(); @@ -588,6 +587,7 @@ void HybridInstaller::ManifestPartialUpdateSteps() { AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::BACKUP); + AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); @@ -640,9 +640,6 @@ void HybridInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep(); AddStep(true); - AddStep(); - AddStep( - ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -668,6 +665,9 @@ void HybridInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); + AddStep( + ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); AddStep(); AddStep(); AddStep(); @@ -759,13 +759,13 @@ void HybridInstaller::RecoverDBSteps() { AddStep( wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); AddStep(); + AddStep(); + AddStep( + hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); AddStep(); } diff --git a/src/hybrid/step/pkgmgr/step_merge_xml.cc b/src/hybrid/step/pkgmgr/step_merge_xml.cc index 0c87c0d..e36e542 100644 --- a/src/hybrid/step/pkgmgr/step_merge_xml.cc +++ b/src/hybrid/step/pkgmgr/step_merge_xml.cc @@ -32,12 +32,12 @@ const std::vector kBlackListNodes = { {"author"}, {"description"}, {"profile"}, - {"privileges"}, - {"provides-appdefined-privileges"}, {"trust-anchor"}, }; const std::vector kNeedMergeNodes = { {"manifest"}, + {"privileges"}, + {"provides-appdefined-privileges"}, }; const std::vector> kApplicationNodeNames = { {"ui-application", "uiapp"}, @@ -46,6 +46,9 @@ const std::vector> kApplicationNodeNames = { {"watch-application", "watchapp"}, }; +const xmlChar kPrivilegeTypeAttributeKey[] = "type"; +const char kXmlXPrivilegeExpr[] = "//*[local-name()='privilege']"; + } // namespace namespace hybrid { @@ -122,6 +125,27 @@ void StepMergeXml::SetXmlNodeAttribute(xmlNodePtr node, reinterpret_cast(attr_val.c_str())); } +bool StepMergeXml::SetTpkPrivilegeType() { + xmlXPathContextPtr xpath_ctx = xmlXPathNewContext(tpk_doc_); + if (!xpath_ctx) { + LOG(ERROR) << "Failed to create XPath context"; + return false; + } + + xmlXPathObjectPtr xpath_obj = xmlXPathEvalExpression( + (const xmlChar*)kXmlXPrivilegeExpr, xpath_ctx); + if (xpath_obj && !xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)) { + for (int i = 0; i < xpath_obj->nodesetval->nodeNr; i++) { + xmlNodePtr node = xpath_obj->nodesetval->nodeTab[i]; + xmlSetProp(node, kPrivilegeTypeAttributeKey, (const xmlChar*)"tpk"); + } + } + + xmlXPathFreeContext(xpath_ctx); + + return true; +} + ci::Step::Status StepMergeXml::process() { bf::path wgt_xml_path = context_->xml_path.get(); bf::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml"; @@ -129,6 +153,9 @@ ci::Step::Status StepMergeXml::process() { if (!LoadXmlDocument(wgt_xml_path, tpk_xml_path)) return Step::Status::MANIFEST_ERROR; + if (!SetTpkPrivilegeType()) + return Step::Status::MANIFEST_ERROR; + for (auto& entry : kNeedMergeNodes) { xmlNodePtr tpk_node = GetXmlNode(tpk_doc_, entry); if (tpk_node == nullptr) diff --git a/src/hybrid/step/pkgmgr/step_merge_xml.h b/src/hybrid/step/pkgmgr/step_merge_xml.h index 7f75295..a373bcf 100644 --- a/src/hybrid/step/pkgmgr/step_merge_xml.h +++ b/src/hybrid/step/pkgmgr/step_merge_xml.h @@ -34,6 +34,7 @@ class StepMergeXml : public common_installer::Step { void MergeXmlNode(xmlNodePtr node1, xmlNodePtr node2); void SetXmlNodeAttribute(xmlNodePtr node, const std::string& attr, const std::string& attr_val); + bool SetTpkPrivilegeType(); xmlDocPtr wgt_doc_; xmlDocPtr tpk_doc_; -- 2.7.4 From 4c55c3cd441df99406e7c0a5a60e221ad43cdc46 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 1 Oct 2019 15:54:24 +0900 Subject: [PATCH 06/16] Add StepSetMainapp Add StepSetMainapp for some request types to set mainapp attribute properly. Change-Id: I23717ba8edc9da81ce2c33ddfcd432dcfabcbc29 Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_installer.cc | 8 +++++ .../step/configuration/step_merge_tpk_config.cc | 22 ++----------- src/hybrid/step/configuration/step_set_mainapp.cc | 36 ++++++++++++++++++++++ src/hybrid/step/configuration/step_set_mainapp.h | 33 ++++++++++++++++++++ 4 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 src/hybrid/step/configuration/step_set_mainapp.cc create mode 100644 src/hybrid/step/configuration/step_set_mainapp.h diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 31028d0..079754f 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -90,6 +90,7 @@ #include "hybrid/shared_dirs.h" #include "hybrid/step/configuration/step_merge_tpk_config.h" #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/pkgmgr/step_merge_xml.h" @@ -486,6 +487,7 @@ void HybridInstaller::ManifestDirectInstallSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); @@ -529,6 +531,7 @@ void HybridInstaller::ManifestDirectUpdateSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); @@ -552,6 +555,7 @@ void HybridInstaller::ManifestPartialInstallSteps() { wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); AddStep(); AddStep(false); AddStep(); @@ -582,6 +586,7 @@ void HybridInstaller::ManifestPartialUpdateSteps() { wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); AddStep( hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); AddStep(); AddStep(false); AddStep( @@ -706,6 +711,7 @@ void HybridInstaller::ReadonlyUpdateUninstallSteps() { AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -766,6 +772,8 @@ void HybridInstaller::RecoverDBSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); + 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 eb2619f..d63d003 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.cc +++ b/src/hybrid/step/configuration/step_merge_tpk_config.cc @@ -6,8 +6,6 @@ #include -#include - #include "hybrid/hybrid_backend_data.h" namespace hybrid { @@ -24,27 +22,11 @@ common_installer::Step::Status StepMergeTpkConfig::process() { manifest_x* tpk_data = data->tpk_manifest_data.get(); manifest_x* wgt_data = context_->manifest_data.get(); - if (merge_type_ == MergeType::CONCAT) { + if (merge_type_ == MergeType::CONCAT) wgt_data->application = g_list_concat(wgt_data->application, tpk_data->application); - } else { - // mainappid should be webapp for hybrid pkg - for (application_x* app : - GListRange(tpk_data->application)) { - if (app->type && strcmp(app->type, "webapp") != 0) - continue; - - if (app->mainapp) - free(app->mainapp); - app->mainapp = strdup("true"); - if (!app->mainapp) { - LOG(ERROR) << "Out of memoery"; - return Status::ERROR; - } - break; - } + else wgt_data->application = tpk_data->application; - } tpk_data->application = nullptr; return Status::OK; diff --git a/src/hybrid/step/configuration/step_set_mainapp.cc b/src/hybrid/step/configuration/step_set_mainapp.cc new file mode 100644 index 0000000..5d8958d --- /dev/null +++ b/src/hybrid/step/configuration/step_set_mainapp.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by an apache-2.0 license that can be +// found in the LICENSE file. + +#include "hybrid/step/configuration/step_set_mainapp.h" + +#include + +#include + +#include "hybrid/hybrid_backend_data.h" + +namespace hybrid { +namespace configuration { + +common_installer::Step::Status StepSetMainapp::process() { + manifest_x* manifest_data = context_->manifest_data.get(); + for (application_x* app : + GListRange(manifest_data->application)) { + if (app->type && strcmp(app->type, "webapp") != 0) + continue; + + if (app->mainapp) + free(app->mainapp); + app->mainapp = strdup("true"); + if (!app->mainapp) { + LOG(ERROR) << "Out of memoery"; + return Status::ERROR; + } + break; + } + return Status::OK; +} + +} // namespace configuration +} // namespace hybrid diff --git a/src/hybrid/step/configuration/step_set_mainapp.h b/src/hybrid/step/configuration/step_set_mainapp.h new file mode 100644 index 0000000..2b287fb --- /dev/null +++ b/src/hybrid/step/configuration/step_set_mainapp.h @@ -0,0 +1,33 @@ +// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by an apache-2.0 license that can be +// found in the LICENSE file. + +#ifndef HYBRID_STEP_CONFIGURATION_STEP_SET_MAINAPP_H_ +#define HYBRID_STEP_CONFIGURATION_STEP_SET_MAINAPP_H_ + +#include +#include + +namespace hybrid { +namespace configuration { + +/** + * \brief StepSetMainapp + * Sets main application information + */ +class StepSetMainapp : public common_installer::Step { + public: + using Step::Step; + + Status process() override; + Status clean() override { return Status::OK; } + Status undo() override { return Status::OK; } + Status precheck() override { return Status::OK; } + + STEP_NAME(SetMainapp) +}; + +} // namespace configuration +} // namespace hybrid + +#endif // HYBRID_STEP_CONFIGURATION_STEP_SET_MAINAPP_H_ -- 2.7.4 From e7b478f789b4ddc35e78125f9a50da6eab3269d2 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Mon, 21 Oct 2019 17:31:45 +0900 Subject: [PATCH 07/16] Adjust order of steps Revert from '192eddd5a83d207a760c025c328e3096f8debdca' Change-Id: I81c2d69752e2734d53b15bfe8bb851a9a5014b51 Signed-off-by: Ilho Kim --- src/hybrid/hybrid_installer.cc | 4 ++-- src/wgt/wgt_installer.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 079754f..d25264d 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -239,6 +239,8 @@ void HybridInstaller::UninstallSteps() { AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::NORMAL); + AddStep( + ci::Plugin::ActionType::Uninstall); AddStep(); AddStep(); AddStep(); @@ -254,8 +256,6 @@ void HybridInstaller::UninstallSteps() { ci::security::StepPrivacyPrivilege::ActionType::Uninstall); AddStep(); AddStep(); - AddStep( - ci::Plugin::ActionType::Uninstall); AddStep(); } diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 840bd81..2031f14 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -236,6 +236,8 @@ void WgtInstaller::UninstallSteps() { AddStep(); AddStep(); AddStep(); + AddStep( + ci::Plugin::ActionType::Uninstall); AddStep(); AddStep(); AddStep(); @@ -248,8 +250,6 @@ void WgtInstaller::UninstallSteps() { ci::security::StepPrivacyPrivilege::ActionType::Uninstall); AddStep(); AddStep(); - AddStep( - ci::Plugin::ActionType::Uninstall); AddStep(); } -- 2.7.4 From 463b9e4e09a0b88688b49ff1eccf00baee47b48a Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 12 Nov 2019 13:28:49 +0900 Subject: [PATCH 08/16] Release version 0.12.12 Changes: - Fix installing privileges of hybrid package - Add StepSetMainapp - Adjust order of steps Change-Id: I5363d57c62a442862fdfb1788b017502117fb9d9 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 e631fab..71b7e9d 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.11 +Version: 0.12.12 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 8024ea8d1735377be09891f3dd1b5142366a5c4a Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Wed, 13 Nov 2019 14:33:39 +0900 Subject: [PATCH 09/16] Fix ManifestDirectInstall/Update on Hybrid pkg Previous implementation did not consider if modified manifest has deleted. Merging WGT and TPK configs with "OVERWRITE" option will remove WGT application data so fixing it by merge it and to consider modified manifest's existance, CONCAT works as merge, not direct concat to remove duplication. Change-Id: I5ae4f085b0e33dde2a8408fa4a525806e9321b09 Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_installer.cc | 33 +++++++------------ .../step/configuration/step_merge_tpk_config.cc | 37 +++++++++++++++------- .../step/configuration/step_merge_tpk_config.h | 11 ------- 3 files changed, 36 insertions(+), 45 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index d25264d..fc7824f 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -151,8 +151,7 @@ void HybridInstaller::InstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); @@ -211,8 +210,7 @@ void HybridInstaller::UpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); @@ -307,8 +305,7 @@ void HybridInstaller::DeltaSteps() { AddStep(); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); @@ -382,8 +379,7 @@ void HybridInstaller::MountInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); @@ -441,8 +437,7 @@ void HybridInstaller::MountUpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); @@ -482,8 +477,7 @@ void HybridInstaller::ManifestDirectInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); @@ -526,8 +520,7 @@ void HybridInstaller::ManifestDirectUpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); @@ -553,8 +546,7 @@ void HybridInstaller::ManifestPartialInstallSteps() { AddStep(); AddStep( wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); AddStep(); AddStep(); AddStep(false); @@ -584,8 +576,7 @@ void HybridInstaller::ManifestPartialUpdateSteps() { AddStep(); AddStep( wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); AddStep(); AddStep(); AddStep(false); @@ -668,8 +659,7 @@ void HybridInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::CONCAT); + AddStep(); AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); @@ -766,8 +756,7 @@ void HybridInstaller::RecoverDBSteps() { wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); AddStep(); AddStep(); - AddStep( - hybrid::configuration::StepMergeTpkConfig::MergeType::OVERWRITE); + AddStep(); 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 d63d003..504f557 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.cc +++ b/src/hybrid/step/configuration/step_merge_tpk_config.cc @@ -4,31 +4,44 @@ #include "hybrid/step/configuration/step_merge_tpk_config.h" +#include +#include + #include +#include "common/utils/glist_range.h" + #include "hybrid/hybrid_backend_data.h" 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(); + // FIXME:api-version of tpk app will have wgt's if modified manifest exists. + for (GList* tpk_list = tpk_data->application; + tpk_list != nullptr; tpk_list = g_list_next(tpk_list)) { + application_x* tpk_app = static_cast(tpk_list->data); + bool is_found = false; + for (GList* wgt_list = wgt_data->application; + wgt_list != nullptr; wgt_list = g_list_next(wgt_list)) { + application_x* wgt_app = static_cast(wgt_list->data); + if (!strcmp(tpk_app->appid, wgt_app->appid)) { + is_found = true; + break; + } + } + if (is_found) + continue; + wgt_data->application = g_list_append( + wgt_data->application, tpk_list->data); + tpk_data->application = g_list_delete_link( + tpk_data->application, tpk_list); + } - 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 6491d34..2171d59 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.h +++ b/src/hybrid/step/configuration/step_merge_tpk_config.h @@ -18,14 +18,6 @@ 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; @@ -33,9 +25,6 @@ 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 From c5d864592443afe574c7791de93af8ab1de04772 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Thu, 14 Nov 2019 21:01:29 +0900 Subject: [PATCH 10/16] Release version 0.12.13 Changes: - Fix ManifestDirectInstall/Update on Hybrid pkg Change-Id: Idcb2344459d620c6dadda786ac7aa71bf6076543 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 71b7e9d..8ddec31 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.12 +Version: 0.12.13 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 82c419c08d2f2be1fa4b42214343c51d3c3e1ba4 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 22 Nov 2019 11:12:48 +0900 Subject: [PATCH 11/16] Fix static analysis issue Change-Id: I4d81482d873169e2839537dc69f8bac9d6a826cc Signed-off-by: Junghyun Yeon --- src/hybrid/step/configuration/step_merge_tpk_config.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hybrid/step/configuration/step_merge_tpk_config.cc b/src/hybrid/step/configuration/step_merge_tpk_config.cc index 504f557..7caa7b7 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.cc +++ b/src/hybrid/step/configuration/step_merge_tpk_config.cc @@ -22,8 +22,9 @@ common_installer::Step::Status StepMergeTpkConfig::process() { manifest_x* tpk_data = data->tpk_manifest_data.get(); manifest_x* wgt_data = context_->manifest_data.get(); // FIXME:api-version of tpk app will have wgt's if modified manifest exists. - for (GList* tpk_list = tpk_data->application; - tpk_list != nullptr; tpk_list = g_list_next(tpk_list)) { + GList* tpk_list = tpk_data->application; + while (tpk_list != nullptr) { + GList *next_list = g_list_next(tpk_list); application_x* tpk_app = static_cast(tpk_list->data); bool is_found = false; for (GList* wgt_list = wgt_data->application; @@ -34,12 +35,16 @@ common_installer::Step::Status StepMergeTpkConfig::process() { break; } } - if (is_found) + if (is_found) { + tpk_list = next_list; continue; + } wgt_data->application = g_list_append( wgt_data->application, tpk_list->data); tpk_data->application = g_list_delete_link( tpk_data->application, tpk_list); + + tpk_list = next_list; } return Status::OK; -- 2.7.4 From 3363d275e172a0c1235a36f7bc30adeca9528ebb Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 22 Nov 2019 13:25:36 +0900 Subject: [PATCH 12/16] Release version 0.12.14 Changes: - Fix static analysis issue Change-Id: I8489d7691b59361c1a388cde6b105a2795fdc47c Signed-off-by: Junghyun Yeon --- packaging/wgt-backend.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 8ddec31..fed4d3f 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.12.13 +Version: 0.12.14 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From b6d6b153631dff98fd8ca9392bfb83ac87096b11 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 28 Nov 2019 20:21:51 +0900 Subject: [PATCH 13/16] Apply early return policy on StepCopyPreviewIcons Change-Id: I4ae9087fa4e149459df982e8311e471f19a732ee Signed-off-by: Junghyun Yeon --- src/wgt/step/filesystem/step_copy_preview_icons.cc | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/wgt/step/filesystem/step_copy_preview_icons.cc b/src/wgt/step/filesystem/step_copy_preview_icons.cc index 95710f8..2cdf5cc 100644 --- a/src/wgt/step/filesystem/step_copy_preview_icons.cc +++ b/src/wgt/step/filesystem/step_copy_preview_icons.cc @@ -5,6 +5,7 @@ #include "wgt/step/filesystem/step_copy_preview_icons.h" #include + #include #include @@ -29,22 +30,22 @@ ci::Step::Status StepCopyPreviewIcons::process() { static_cast(context_->backend_data.get()); for (auto& appwidget : backend_data->appwidgets.get().app_widgets()) { for (auto& size : appwidget.content_size) { - if (!size.preview.empty()) { - bf::path icon_path = - context_->GetPkgPath() / kResWgt / size.preview; - std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type); - std::string icon_name = appwidget.id + "." + type + "." + "preview" + - bf::path(size.preview).extension().string(); - bf::path preview_icon = - context_->GetPkgPath() / kSharedRes / icon_name; - if (!ci::CopyFile(icon_path, preview_icon)) { - LOG(ERROR) << "Cannot create preview icon: " << preview_icon; - return Status::ICON_ERROR; - } + if (size.preview.empty()) + continue; + + bf::path icon_path = context_->GetPkgPath() / kResWgt / size.preview; + std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type); + std::string icon_name = appwidget.id + "." + type + "." + "preview" + + bf::path(size.preview).extension().string(); + bf::path preview_icon = context_->GetPkgPath() / kSharedRes / icon_name; + if (!ci::CopyFile(icon_path, preview_icon)) { + LOG(ERROR) << "Cannot create preview icon: " << preview_icon; + return Status::ICON_ERROR; } } } LOG(DEBUG) << "Preview icons created"; + return Status::OK; } -- 2.7.4 From 08d91e262044fd9ee82018db71b48373834317cb Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 19 Nov 2019 18:35:50 +0900 Subject: [PATCH 14/16] Fix smoke-test functions for rollback cases The custom step cannot be added outside of installer, because steps are initialized when Run() invoked. (If some step added outside of installer, that step will be executed at first, ignoring original steps) This patch defines a new virtual function creating overridden installer object which is fail at the end of steps or specific stage. Requires: - https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/218093 Change-Id: I99de606909e5a673d45545dd05095ee0f4111a51 Signed-off-by: Sangyoon Jang --- src/unit_tests/smoke_utils.cc | 16 +++++++-- src/unit_tests/smoke_utils.h | 80 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index 817cdbc..14965f9 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -61,14 +61,26 @@ WgtBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const { return AppInstallerPtr(new wgt::WgtInstaller(pkgmgr)); } -WgtBackendInterface::AppQueryInterfacePtr +WgtBackendInterface::AppInstallerPtr +WgtBackendInterface::CreateFailExpectedInstaller( + ci::PkgMgrPtr pkgmgr, int fail_at) const { + return AppInstallerPtr(new FailExpectedWgtInstaller(pkgmgr, fail_at)); +} + +HybridBackendInterface::AppQueryInterfacePtr HybridBackendInterface::CreateQueryInterface() const { return AppQueryInterfacePtr(new wgt::WgtAppQueryInterface()); } -WgtBackendInterface::AppInstallerPtr +HybridBackendInterface::AppInstallerPtr HybridBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const { return AppInstallerPtr(new hybrid::HybridInstaller(pkgmgr)); } +HybridBackendInterface::AppInstallerPtr +HybridBackendInterface::CreateFailExpectedInstaller( + ci::PkgMgrPtr pkgmgr, int fail_at) const { + return AppInstallerPtr(new FailExpectedHybridInstaller(pkgmgr, fail_at)); +} + } // namespace smoke_test diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/smoke_utils.h index e6ecbae..7b22263 100644 --- a/src/unit_tests/smoke_utils.h +++ b/src/unit_tests/smoke_utils.h @@ -5,14 +5,17 @@ #ifndef UNIT_TESTS_SMOKE_UTILS_H_ #define UNIT_TESTS_SMOKE_UTILS_H_ -#include #include +#include +#include #include #include #include #include +#include "hybrid/hybrid_installer.h" +#include "wgt/wgt_installer.h" #include "wgt/wgt_app_query_interface.h" namespace smoke_test { @@ -39,6 +42,8 @@ class WgtBackendInterface: public BackendInterface { AppQueryInterfacePtr CreateQueryInterface() const override; AppInstallerPtr CreateInstaller( common_installer::PkgMgrPtr pkgmgr) const override; + AppInstallerPtr CreateFailExpectedInstaller( + common_installer::PkgMgrPtr pkgmgr, int fail_at) const override; }; class HybridBackendInterface: public BackendInterface { @@ -49,6 +54,79 @@ class HybridBackendInterface: public BackendInterface { AppQueryInterfacePtr CreateQueryInterface() const override; AppInstallerPtr CreateInstaller( common_installer::PkgMgrPtr pkgmgr) const override; + AppInstallerPtr CreateFailExpectedInstaller( + common_installer::PkgMgrPtr pkgmgr, int fail_at) const override; +}; + +#define OVERRIDE_STEPS_BLOCK(TYPE, STEPS) \ + void STEPS() override { \ + TYPE::STEPS(); \ + if (fail_at_ > -1) \ + AddStepAtIndex(fail_at_); \ + else \ + AddStep(); \ + } \ + +class FailExpectedWgtInstaller : public wgt::WgtInstaller { + public: + explicit FailExpectedWgtInstaller( + common_installer::PkgMgrPtr pkgmgr, int fail_at) + : wgt::WgtInstaller(pkgmgr), fail_at_(fail_at) { } + + private: + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, InstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, UpdateSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, UninstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReinstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, DeltaSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MoveSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, RecoverySteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MountInstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MountUpdateSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestDirectInstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestDirectUpdateSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestPartialInstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestPartialUpdateSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, PartialUninstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReadonlyUpdateInstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReadonlyUpdateUninstallSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, DisablePkgSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, EnablePkgSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MigrateExtImgSteps) + OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, RecoverDBSteps) + + int fail_at_; +}; + +class FailExpectedHybridInstaller : public hybrid::HybridInstaller { + public: + explicit FailExpectedHybridInstaller( + common_installer::PkgMgrPtr pkgmgr, int fail_at) + : hybrid::HybridInstaller(pkgmgr), fail_at_(fail_at) { } + + private: + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, InstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, UpdateSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, UninstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReinstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, DeltaSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MoveSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, RecoverySteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MountInstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MountUpdateSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestDirectInstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestDirectUpdateSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestPartialInstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestPartialUpdateSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, PartialUninstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReadonlyUpdateInstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReadonlyUpdateUninstallSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, DisablePkgSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, EnablePkgSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MigrateExtImgSteps) + OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, RecoverDBSteps) + + int fail_at_; }; } // namespace smoke_test -- 2.7.4 From 5382bd989e0a34e8d3fbe9a3072e914ca0d26df7 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 28 Nov 2019 20:14:24 +0900 Subject: [PATCH 15/16] Change duplicated step name Same step name exists on tpk-backend Change-Id: Ia96de025c403f19af3deca55f9ff669a863d0092 Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_installer.cc | 28 +++++++++++----------- ...ic_link.cc => step_create_wgt_symbolic_link.cc} | 21 +++++++++++----- ...olic_link.h => step_create_wgt_symbolic_link.h} | 12 +++++----- src/wgt/wgt_installer.cc | 14 +++++------ 4 files changed, 42 insertions(+), 33 deletions(-) rename src/wgt/step/filesystem/{step_create_symbolic_link.cc => step_create_wgt_symbolic_link.cc} (79%) rename src/wgt/step/filesystem/{step_create_symbolic_link.h => step_create_wgt_symbolic_link.h} (75%) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index fc7824f..2f00998 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -79,7 +79,7 @@ #include #include -#include +#include #include #include #include @@ -98,7 +98,7 @@ #include "wgt/step/configuration/step_set_old_signature_files_location.h" #include "wgt/step/encryption/step_remove_encryption_data.h" #include "wgt/step/filesystem/step_copy_preview_icons.h" -#include "wgt/step/filesystem/step_create_symbolic_link.h" +#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h" #include "wgt/step/filesystem/step_wgt_patch_icons.h" #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h" #include "wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h" @@ -155,8 +155,8 @@ void HybridInstaller::InstallSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); @@ -214,8 +214,8 @@ void HybridInstaller::UpdateSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); @@ -309,8 +309,8 @@ void HybridInstaller::DeltaSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); AddStep( @@ -383,8 +383,8 @@ void HybridInstaller::MountInstallSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL); @@ -441,8 +441,8 @@ void HybridInstaller::MountUpdateSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); @@ -663,8 +663,8 @@ void HybridInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH); - AddStep(); - AddStep(); + AddStep(); + AddStep(); AddStep(); AddStep( ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE); diff --git a/src/wgt/step/filesystem/step_create_symbolic_link.cc b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc similarity index 79% rename from src/wgt/step/filesystem/step_create_symbolic_link.cc rename to src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc index c1091d0..d234494 100644 --- a/src/wgt/step/filesystem/step_create_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc @@ -3,7 +3,7 @@ // Use of this source code is governed by a apache 2.0 license that can be // found in the LICENSE file. -#include "wgt/step/filesystem/step_create_symbolic_link.h" +#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h" #include #include @@ -31,10 +31,10 @@ const char kWRTPath[] = "/usr/bin/wrt"; namespace wgt { namespace filesystem { -bool StepCreateSymbolicLink::CreateSymlinksForApps() { +bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() { boost::system::error_code error; for (application_x* app : - GListRange(context_->manifest_data.get()->application)) { + GListRange(context_->manifest_data.get()->application)) { // filter out non-wgt apps as this step is run for hybrid backend too if (strcmp("webapp", app->type) != 0) continue; @@ -63,7 +63,16 @@ bool StepCreateSymbolicLink::CreateSymlinksForApps() { return true; } -common_installer::Step::Status StepCreateSymbolicLink::process() { +common_installer::Step::Status StepCreateWgtSymbolicLink::precheck() { + if (!context_->manifest_data.get()) { + LOG(ERROR) << "Manifest data empty"; + return Status::ERROR; + } + + return Status::OK; +} + +common_installer::Step::Status StepCreateWgtSymbolicLink::process() { assert(context_->manifest_data.get()); if (!CreateSymlinksForApps()) @@ -73,9 +82,9 @@ common_installer::Step::Status StepCreateSymbolicLink::process() { return Status::OK; } -common_installer::Step::Status StepCreateSymbolicLink::undo() { +common_installer::Step::Status StepCreateWgtSymbolicLink::undo() { for (application_x* app : - GListRange(context_->manifest_data.get()->application)) { + GListRange(context_->manifest_data.get()->application)) { bf::path exec_path = context_->GetPkgPath() / "bin" / app->appid; common_installer::RemoveAll(exec_path); } diff --git a/src/wgt/step/filesystem/step_create_symbolic_link.h b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h similarity index 75% rename from src/wgt/step/filesystem/step_create_symbolic_link.h rename to src/wgt/step/filesystem/step_create_wgt_symbolic_link.h index c1129e7..8f8e326 100644 --- a/src/wgt/step/filesystem/step_create_symbolic_link.h +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a apache 2.0 license that can be // found in the LICENSE file. -#ifndef WGT_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ -#define WGT_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ +#ifndef WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_ +#define WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_ #include @@ -19,7 +19,7 @@ namespace filesystem { /** * \brief Step that create symbolic link to application */ -class StepCreateSymbolicLink : public common_installer::Step { +class StepCreateWgtSymbolicLink : public common_installer::Step { public: using Step::Step; @@ -46,11 +46,11 @@ class StepCreateSymbolicLink : public common_installer::Step { Status undo() override; /** - * \brief Empty method + * \brief Check weather manifest data is empty or not * * \return Status::OK */ - Status precheck() override { return Status::OK; } + Status precheck() override; private: bool CreateSymlinksForApps(); @@ -61,4 +61,4 @@ class StepCreateSymbolicLink : public common_installer::Step { } // namespace filesystem } // namespace wgt -#endif // WGT_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ +#endif // WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_ diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 2031f14..2187656 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -99,7 +99,7 @@ #include "wgt/step/encryption/step_encrypt_resources.h" #include "wgt/step/encryption/step_remove_encryption_data.h" #include "wgt/step/filesystem/step_copy_preview_icons.h" -#include "wgt/step/filesystem/step_create_symbolic_link.h" +#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h" #include "wgt/step/filesystem/step_wgt_patch_icons.h" #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h" #include "wgt/step/filesystem/step_wgt_prepare_package_directory.h" @@ -151,7 +151,7 @@ void WgtInstaller::InstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -204,7 +204,7 @@ void WgtInstaller::UpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -322,7 +322,7 @@ void WgtInstaller::DeltaSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -391,7 +391,7 @@ void WgtInstaller::MountInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -442,7 +442,7 @@ void WgtInstaller::MountUpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); @@ -560,7 +560,7 @@ void WgtInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(true); AddStep(); AddStep(); -- 2.7.4 From 989a3134534199af2ab4626597ae3dbe9ec038d9 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 28 Nov 2019 18:50:52 +0900 Subject: [PATCH 16/16] Change default value of nodisplay Change it to true in order to hide it from app drawer. Change-Id: I93f92f127be05686968f8de2b3034ab0345af9f0 Signed-off-by: Junghyun Yeon --- src/wgt/step/configuration/step_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 9799b3e..9cbf0fb 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -470,7 +470,7 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { service_info.on_boot() ? strdup("true") : strdup("false"); application->autorestart = service_info.auto_restart() ? strdup("true") : strdup("false"); - application->nodisplay = strdup("false"); + application->nodisplay = strdup("true"); application->taskmanage = strdup("true"); SetApplicationXDefaults(application); application->support_ambient = strdup("false"); -- 2.7.4