From aead408d2d07421f2c5dc12d2c0fb317695f3b7d Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 26 Nov 2020 11:51:55 +0900 Subject: [PATCH 01/16] Add wgt package version policy If given version string is not start with allowed pattern, GetPackageVersion() will return empty string. This patch will check its result and fails entire install procedure if so. Change-Id: I14ebc962f0dd7167b9d166a4844960744216fc9b Signed-off-by: Junghyun Yeon --- src/wgt/step/configuration/step_parse.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 8c97c72..d4c677b 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -249,7 +249,12 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { const std::string& version = wgt_info->version(); manifest->ns = strdup(kTizenPackageXmlNamespace); - manifest->version = strdup(GetPackageVersion(version).c_str()); + std::string version_tmp = GetPackageVersion(version); + if (version_tmp.empty()) { + LOG(ERROR) << "Invalid version format : " << version; + return false; + } + manifest->version = strdup(version_tmp.c_str()); for (auto& item : wgt_info->description_set()) { description_x* description = reinterpret_cast -- 2.7.4 From 4be17abaca68af2eb3f0f2fd3236925505d6db1e Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 1 Dec 2020 09:19:02 +0900 Subject: [PATCH 02/16] Release version 0.15.12 Changes: - Add wgt package version policy Change-Id: I791c6908ad855d1a74845cd7a7884b96c89d9797 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 643dac2..e2c839d 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.11 +Version: 0.15.12 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 6f384a8587ca00337baf0889901c79cdf6d7d91c Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Mon, 4 Jan 2021 16:37:39 +0900 Subject: [PATCH 03/16] Fix wgt version checking logic WGT version string could contain non UTF-8 characters. Now version checking logic will skip validation if given character is non UTF-8. Change-Id: I869fab0b8f12ece90735e71a71ec62b0e84c806c Signed-off-by: Junghyun Yeon --- src/wgt/step/configuration/step_parse.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index d4c677b..3b46e7e 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -171,14 +171,22 @@ std::set StepParse::ExtractPrivileges( } std::string StepParse::GetPackageVersion( - const std::string& manifest_version) { - if (manifest_version.empty()) { + const std::string& manifest_version) { + if (manifest_version.empty()) return kManifestVersion; - } - std::string version = manifest_version.substr(0, - manifest_version.find_first_not_of("1234567890.")); - return version; + for (const char& c : manifest_version) { + // first bit of 1 byte utf-8 character is always 0 + if (c >> 7 == 1) + continue; + + if (std::string(1, c).find_first_not_of("1234567890.") != + std::string::npos) { + LOG(ERROR) << "Invalid version format"; + return nullptr; + } + } + return manifest_version; } bool StepParse::FillInstallationInfo(manifest_x* manifest) { -- 2.7.4 From b9c9fb56d5199ac3e53eb15a4692b87b391187fa Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Thu, 7 Jan 2021 14:14:48 +0900 Subject: [PATCH 04/16] Release version 0.15.13 Changes: - Fix wgt version checking logic Change-Id: I50da224ce2e0666cf9ee145c06906c7a8d845cf5 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 e2c839d..416f4f3 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.12 +Version: 0.15.13 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 9042be6419320211c4c4d73067ed0db8a84083a0 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 12 Jan 2021 13:57:19 +0900 Subject: [PATCH 05/16] Fix memory leak Related changes: [app-installers] : https://review.tizen.org/gerrit/251120 Change-Id: I965336477aeec7dd2dae2dd274514c1fbc9c5199 Signed-off-by: Junghyun Yeon --- src/hybrid/hybrid_installer_factory.cc | 3 ++- src/wgt/wgt_installer_factory.cc | 2 +- src/wgt_backend/wgt_backend.cc | 7 ++++--- test/smoke_tests/smoke_test_helper.cc | 5 +++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/hybrid/hybrid_installer_factory.cc b/src/hybrid/hybrid_installer_factory.cc index ed9cf2a..1716765 100644 --- a/src/hybrid/hybrid_installer_factory.cc +++ b/src/hybrid/hybrid_installer_factory.cc @@ -25,7 +25,8 @@ namespace hybrid { std::unique_ptr HybridInstallerFactory::CreateInstaller( ci::PkgMgrPtr pkgmgr, int idx) { std::unique_ptr installer; - wgt::WgtAppQueryInterface* wgt_aqi = new wgt::WgtAppQueryInterface(); + std::shared_ptr wgt_aqi( + new wgt::WgtAppQueryInterface()); pkgmgr->AddAppQueryInterface(idx, wgt_aqi); installer.reset(new hybrid::HybridInstaller(pkgmgr)); diff --git a/src/wgt/wgt_installer_factory.cc b/src/wgt/wgt_installer_factory.cc index 54d191e..f260647 100644 --- a/src/wgt/wgt_installer_factory.cc +++ b/src/wgt/wgt_installer_factory.cc @@ -25,7 +25,7 @@ namespace wgt { std::unique_ptr WgtInstallerFactory::CreateInstaller( ci::PkgMgrPtr pkgmgr, int idx) { std::unique_ptr installer; - WgtAppQueryInterface* wgt_aqi = new WgtAppQueryInterface(); + std::shared_ptr wgt_aqi(new WgtAppQueryInterface()); pkgmgr->AddAppQueryInterface(idx, wgt_aqi); installer.reset(new wgt::WgtInstaller(pkgmgr)); diff --git a/src/wgt_backend/wgt_backend.cc b/src/wgt_backend/wgt_backend.cc index 3286b08..54c070f 100644 --- a/src/wgt_backend/wgt_backend.cc +++ b/src/wgt_backend/wgt_backend.cc @@ -28,10 +28,11 @@ std::unique_ptr make_unique(Args&&... args) { int main(int argc, char** argv) { ci::PkgmgrInstaller pkgmgr_installer; - wgt::WgtAppQueryInterface query_interface; + std::shared_ptr query_interface( + new wgt::WgtAppQueryInterface()); try { auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer, - &query_interface); + query_interface); std::unique_ptr installer_factory; if (!pkgmgr) { LOG(ERROR) << "Options of pkgmgr installer cannot be parsed"; @@ -43,7 +44,7 @@ int main(int argc, char** argv) { #endif // This is workaround for hybrid apps as they requires much different flow // but installer does not branch at all in current design - if (query_interface.IsHybridApplication( + if (query_interface->IsHybridApplication( pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) { LOG(INFO) << "Hybrid package detected"; ci::InstallerRunner runner( diff --git a/test/smoke_tests/smoke_test_helper.cc b/test/smoke_tests/smoke_test_helper.cc index a52afa2..45dbacc 100644 --- a/test/smoke_tests/smoke_test_helper.cc +++ b/test/smoke_tests/smoke_test_helper.cc @@ -38,9 +38,10 @@ int main(int argc, char** argv) { } ci::PkgmgrInstaller pkgmgr_installer; - wgt::WgtAppQueryInterface query_interface; + std::shared_ptr query_interface( + new wgt::WgtAppQueryInterface()); auto pkgmgr = ci::PkgMgrInterface::Create(backend_argc, argv, - &pkgmgr_installer, &query_interface); + &pkgmgr_installer, query_interface); if (!pkgmgr) { LOG(ERROR) << "Options of pkgmgr installer cannot be parsed"; return EINVAL; -- 2.7.4 From 2365dc0731f1e1ea799b6f10023066f795ea0f29 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 15 Jan 2021 10:06:09 +0900 Subject: [PATCH 06/16] Release version 0.15.14 Changes: - Fix memory leak Change-Id: Ifc43e4fb049dffd6b4cbed1bb46e4b4ce779d346 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 416f4f3..9b6ff12 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.13 +Version: 0.15.14 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From d17845057ff85ec9264e6ec892d60a136ac9e9c5 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 15 Jan 2021 12:46:55 +0900 Subject: [PATCH 07/16] Fix step name Related changes: [app-installers] : https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/251363/ Change-Id: Ia5add48927e9b50e2124f1a37b262f4298156aaf Signed-off-by: Junghyun Yeon --- src/wgt/wgt_installer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 12f151c..5b023ae 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -73,7 +73,7 @@ void WgtInstaller::InstallSteps() { AddStepAfter("EncryptResources"); RemoveStep("CreateIcons"); AddStepAfter( - "CopyTEP"); + "CopyTep"); AddStepAfter( "WgtPatchStorageDirectories"); AddStepAfter( -- 2.7.4 From 43e55169ecb7ebdfc17fe4182fdf684a0da4891b Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 15 Jan 2021 15:22:10 +0900 Subject: [PATCH 08/16] Release version 0.15.15 Changes: - Fix step name Change-Id: If721fd85e0d70d6fc6d9967c7cd2a62d7103c0af 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 9b6ff12..761733e 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.14 +Version: 0.15.15 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 16f42633079ec7809e51a42fda00e3ae4609afcc Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 21 Jan 2021 09:10:28 +0900 Subject: [PATCH 09/16] Redefine wgt package version policy Installer will not check or parsing wgt version string unless it is empty. Change-Id: Id7604b7f8735c661d883319238526719d31180bc Signed-off-by: Junghyun Yeon --- src/wgt/step/configuration/step_parse.cc | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 3b46e7e..3b11daa 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -175,17 +175,6 @@ std::string StepParse::GetPackageVersion( if (manifest_version.empty()) return kManifestVersion; - for (const char& c : manifest_version) { - // first bit of 1 byte utf-8 character is always 0 - if (c >> 7 == 1) - continue; - - if (std::string(1, c).find_first_not_of("1234567890.") != - std::string::npos) { - LOG(ERROR) << "Invalid version format"; - return nullptr; - } - } return manifest_version; } @@ -257,12 +246,7 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { const std::string& version = wgt_info->version(); manifest->ns = strdup(kTizenPackageXmlNamespace); - std::string version_tmp = GetPackageVersion(version); - if (version_tmp.empty()) { - LOG(ERROR) << "Invalid version format : " << version; - return false; - } - manifest->version = strdup(version_tmp.c_str()); + manifest->version = strdup(GetPackageVersion(version).c_str()); for (auto& item : wgt_info->description_set()) { description_x* description = reinterpret_cast -- 2.7.4 From 8c43a95fa175e6a4fdb11f801d4b8c7e49b0e217 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 21 Jan 2021 13:53:34 +0900 Subject: [PATCH 10/16] Release version 0.15.16 Changes: - Redefine wgt package version policy Change-Id: I9d497c386e13d5c8c909d1d030faa072de971e35 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 761733e..9dffcf4 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.15 +Version: 0.15.16 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 1da9ad4b9bcae8141a75f9a6a94e53ade32ae682 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Tue, 9 Mar 2021 21:17:37 -0800 Subject: [PATCH 11/16] Support legacy web service apps This creates symlink to wrt-service only if service type is not defined to support legacy web service apps. Change-Id: I6d406b7a5e670b1c0690250183417438147e6eda Signed-off-by: Youngsoo Choi --- src/wgt/step/configuration/step_parse.cc | 10 +++++----- src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 3b11daa..c7d17e6 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -344,7 +344,7 @@ bool StepParse::AllServiceAppGlobal() { } bool all_service_app_global = true; for (const auto& service_info : service_list->services) { - if (service_info.type() != "global") { + if (service_info.type() == "ui") { all_service_app_global = false; break; } @@ -991,6 +991,10 @@ common_installer::Step::Status StepParse::process() { WgtBackendData* backend_data = static_cast(context_->backend_data.get()); + auto service_list = GetManifestDataForKey( + app_keys::kTizenServiceKey); + if (service_list) + backend_data->service_list.set(*service_list); if (check_start_file_) { if (!ui_app_not_exists_ && !parser_->CheckValidStartFile()) { @@ -1007,12 +1011,8 @@ common_installer::Step::Status StepParse::process() { // making backup of content data and services content data auto content_info = GetManifestDataForKey( app_keys::kTizenContentKey); - auto service_list = GetManifestDataForKey( - app_keys::kTizenServiceKey); if (content_info) backend_data->content.set(*content_info); - if (service_list) - backend_data->service_list.set(*service_list); } context_->pkgid.set(manifest->package); 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 c6ea4fd..3b9f132 100644 --- a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -17,12 +18,15 @@ #include #include +#include "wgt/utils/wgt_backend_data.h" + namespace bf = boost::filesystem; namespace bs = boost::system; namespace { -const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service-launcher"; +const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service"; +const char kWrtServiceLauncherBinaryPath[] = "/usr/bin/wrt-service-launcher"; const char kWebWidgetRuntimeBinaryPath[] = "/usr/bin/web-widget-runtime"; const char kWRTPath[] = "/usr/bin/wrt"; @@ -32,6 +36,13 @@ namespace wgt { namespace filesystem { bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() { + std::unordered_map service_app_type; + WgtBackendData* backend_data = + static_cast(context_->backend_data.get()); + for (auto& service_info : backend_data->service_list.get().services) { + service_app_type[service_info.id()] = service_info.type(); + } + boost::system::error_code error; for (application_x* app : GListRange(context_->manifest_data.get()->application)) { @@ -52,6 +63,8 @@ bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() { bf::create_symlink(bf::path(kWRTPath), exec_path, error); } else if (strcmp(app->component_type, "widgetapp") == 0) { bf::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error); + } else if (!service_app_type[app->appid].empty()) { + bf::create_symlink(kWrtServiceLauncherBinaryPath, exec_path, error); } else { bf::create_symlink(kWrtServiceBinaryPath, exec_path, error); } -- 2.7.4 From 0c60cc0235d14ec5438b1c107ccab866cf1b83e3 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Wed, 31 Mar 2021 13:42:39 +0900 Subject: [PATCH 12/16] Export wgt_archive_info.h for further usage Change-Id: I47417ec1e508008ebb0ab4b18e9e717eb540f4dd Signed-off-by: Junghyun Yeon --- src/lib/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index a14aaae..8fa61d5 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -13,3 +13,4 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_WGT_ARCHIVE_INFO} PUBLIC ) INSTALL(TARGETS ${TARGET_LIBNAME_WGT_ARCHIVE_INFO} DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/backendlib) +INSTALL(FILES wgt_archive_info.h DESTINATION ${INCLUDEDIR}/app-installers/wgt/) \ No newline at end of file -- 2.7.4 From e9da737559086ef615337d349d2c4838f20606d6 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Fri, 28 May 2021 16:05:24 +0900 Subject: [PATCH 13/16] Release version 0.15.17 Changes: - Support legacy web service apps - Export wgt_archive_info.h for further usage Change-Id: I3a8c981bae0c0b8d98771cf530ecc108730c237e 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 9dffcf4..a2fffb8 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -1,6 +1,6 @@ Name: wgt-backend Summary: Application installer backend for WGT -Version: 0.15.16 +Version: 0.15.17 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 2896ca169285792457a673e3cab791fc8f7a52a5 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 6 Apr 2021 17:37:14 +0900 Subject: [PATCH 14/16] Change wgt archive info implementation - Implement ExtractPackageArchive(). - Use RemoveTmpDir() to remove temporary directory. Related changes: [app-installers] : https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/256526 Change-Id: Ia314458b708b728a9542a4a18715e93616f5ce6c Signed-off-by: Junghyun Yeon --- src/lib/wgt_archive_info.cc | 30 ++++++++++++++++-------------- src/lib/wgt_archive_info.h | 2 ++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/lib/wgt_archive_info.cc b/src/lib/wgt_archive_info.cc index 7552812..edc7d77 100644 --- a/src/lib/wgt_archive_info.cc +++ b/src/lib/wgt_archive_info.cc @@ -32,17 +32,18 @@ const char kVconfLanguageKey[] = VCONFKEY_LANGSET; const char kConfigFileName[] = "config.xml"; const char kHybridConfigFileName[] = "res/wgt/config.xml"; -bool ExtractPackageArchive(const std::string& file_path, - const std::string& file, const bf::path& tmp_dir) { - if (!ci::ExtractToTmpDir(file_path.c_str(), tmp_dir, file.c_str())) { +} // namespace + +bool WgtArchiveInfo::ExtractPackageArchive(const std::string& file_path, + const std::string& file, const std::string& tmp_dir) { + if (!ci::ExtractToTmpDir(file_path.c_str(), + bf::path(tmp_dir), file.c_str())) { LOG(ERROR) << "Failed to extract"; return false; } return true; } -} // namespace - bool WgtArchiveInfo::GetPackageInfo( const wgt::parse::WidgetConfigParser& parser) { auto widget_info = @@ -202,12 +203,12 @@ bool WgtArchiveInfo::LoadArchiveInfo() { return false; LOG(DEBUG) << "Unpack at temporary dir: " << tmp_dir; bool is_hybrid = false; - if (!ExtractPackageArchive(path_, kHybridConfigFileName, tmp_dir)) + if (!ExtractPackageArchive(path_, kHybridConfigFileName, tmp_dir.string())) return false; if (bf::exists(tmp_dir / kHybridConfigFileName)) { is_hybrid = true; } else { - if (!ExtractPackageArchive(path_, kConfigFileName, tmp_dir)) + if (!ExtractPackageArchive(path_, kConfigFileName, tmp_dir.string())) return false; } @@ -219,20 +220,20 @@ bool WgtArchiveInfo::LoadArchiveInfo() { manifest_path = tmp_dir / kConfigFileName; if (!parser.ParseManifest(manifest_path)) { LOG(ERROR) << "Failed to parse"; - bf::remove_all(tmp_dir); + RemoveTmpDir(tmp_dir.string()); return false; } if (!GetPackageInfo(parser)) { LOG(ERROR) << "Failed to get package info"; - bf::remove_all(tmp_dir); + RemoveTmpDir(tmp_dir.string()); return false; } if (!GetApplicationInfo(parser)) { if (!GetAddonInfo(parser)) { LOG(ERROR) << "Failed to get application info nor addon info. " << "At least one of them must exist"; - bf::remove_all(tmp_dir); + RemoveTmpDir(tmp_dir.string()); return false; } } @@ -247,13 +248,13 @@ bool WgtArchiveInfo::LoadArchiveInfo() { icon_path = "res/wgt/" + icon_; else icon_path = icon_; - if (!ExtractPackageArchive(path_, icon_path, tmp_dir)) { - bf::remove_all(tmp_dir); + if (!ExtractPackageArchive(path_, icon_path, tmp_dir.string())) { + RemoveTmpDir(tmp_dir.string()); return false; } if (!ReadIcon(icon_path, tmp_dir)) { LOG(WARNING) << "Failed to get icon info"; - bf::remove_all(tmp_dir); + RemoveTmpDir(tmp_dir.string()); return false; } } @@ -267,7 +268,8 @@ bool WgtArchiveInfo::LoadArchiveInfo() { LOG(WARNING) << "Failed to get description info"; free(locale); - bf::remove_all(tmp_dir); + RemoveTmpDir(tmp_dir.string()); + return true; } diff --git a/src/lib/wgt_archive_info.h b/src/lib/wgt_archive_info.h index debc32c..0f7a5a2 100644 --- a/src/lib/wgt_archive_info.h +++ b/src/lib/wgt_archive_info.h @@ -20,6 +20,8 @@ class WgtArchiveInfo : public common_installer::ArchiveInfo { explicit WgtArchiveInfo(std::string path) : common_installer::ArchiveInfo(path) { } bool LoadArchiveInfo() override; + bool ExtractPackageArchive(const std::string& archive_path, + const std::string& file, const std::string& tmp_dir) override; private: bool GetPackageInfo(const wgt::parse::WidgetConfigParser& parser); -- 2.7.4 From 5eed37df15d1e0a409fc8f3c23dc339cefe05d73 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Wed, 7 Apr 2021 16:23:23 +0900 Subject: [PATCH 15/16] Call db create functions before starting smoke test Database will not be created automatically. Related changes: [app-installers] : https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/256566/ Change-Id: I40b4542b06c69ce3b80f37c81660dfdbe43c3eed Signed-off-by: Junghyun Yeon --- test/smoke_tests/smoke_test.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/test/smoke_tests/smoke_test.cc b/test/smoke_tests/smoke_test.cc index ec82d92..53377a8 100644 --- a/test/smoke_tests/smoke_test.cc +++ b/test/smoke_tests/smoke_test.cc @@ -32,6 +32,7 @@ class SmokeEnvironment : public testing::Environment { backups_ = SetupBackupDirectories(test_user.uid); for (auto& path : backups_) ASSERT_TRUE(BackupPath(path)); + CreateDatabase(); } void TearDown() override { ASSERT_TRUE(request_mode_ == ci::RequestMode::GLOBAL || -- 2.7.4 From dc66759ed720859ded7f57c24d408597351975e2 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 3 Jun 2021 14:15:55 +0900 Subject: [PATCH 16/16] Change class declaration - Change private enum class to protected one. - Declare GenerateApplicationCommonXml to virtual one. Change-Id: I90aa8f537567106e8915f621cba17031fb9618fe Signed-off-by: Junghyun Yeon --- src/wgt/step/pkgmgr/step_generate_xml.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wgt/step/pkgmgr/step_generate_xml.h b/src/wgt/step/pkgmgr/step_generate_xml.h index d531226..3e24994 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.h +++ b/src/wgt/step/pkgmgr/step_generate_xml.h @@ -25,7 +25,7 @@ class StepGenerateXml : public common_installer::Step { Status undo() override; Status precheck() override; - private: + protected: enum class AppCompType { UIAPP, SVCAPP, @@ -33,7 +33,7 @@ class StepGenerateXml : public common_installer::Step { WATCHAPP }; - Step::Status GenerateApplicationCommonXml(application_x* app, + virtual Step::Status GenerateApplicationCommonXml(application_x* app, xmlTextWriterPtr writer, AppCompType type); -- 2.7.4