From 23590201874048fac5336c4062c631d2629dc44b Mon Sep 17 00:00:00 2001 From: ilho kim Date: Fri, 4 Aug 2023 13:17:27 +0900 Subject: [PATCH 01/16] Release version 0.15.32 Changes: - Fix static analysis issue Change-Id: I30a2dcd1b07b10b3f40afe012fbb4adc3bd51b40 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 8bd3e83..563323a 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.31 +Version: 0.15.32 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 083cf65383b8d6f5935679ff4d0e7293ffa15526 Mon Sep 17 00:00:00 2001 From: ilho kim Date: Thu, 10 Aug 2023 14:30:20 +0900 Subject: [PATCH 02/16] Fix static analysis issue Check the return value of glob() Change-Id: I7f526ca453ccdde105d44193914833f0ec512868 Signed-off-by: ilho kim --- src/wgt/step/security/step_check_extension_privileges.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/wgt/step/security/step_check_extension_privileges.cc b/src/wgt/step/security/step_check_extension_privileges.cc index 796022d..e40fc6b 100755 --- a/src/wgt/step/security/step_check_extension_privileges.cc +++ b/src/wgt/step/security/step_check_extension_privileges.cc @@ -56,11 +56,16 @@ common_installer::Step::Status StepCheckExtensionPrivileges::process() { std::set xmlFiles; { glob_t glob_result; - glob(app_ext_config_pattern.c_str(), GLOB_TILDE, NULL, &glob_result); - for (unsigned int i = 0; i < glob_result.gl_pathc; ++i) { - xmlFiles.insert(glob_result.gl_pathv[i]); + int ret = glob(app_ext_config_pattern.c_str(), + GLOB_TILDE, NULL, &glob_result); + if (ret == 0) { + for (unsigned int i = 0; i < glob_result.gl_pathc; ++i) { + xmlFiles.insert(glob_result.gl_pathv[i]); + } + globfree(&glob_result); + } else { + LOG(ERROR) << "Fail to get extension paths, error code : " << ret; } - globfree(&glob_result); } GList* privileges = nullptr; BOOST_SCOPE_EXIT_ALL(privileges) { -- 2.7.4 From 698d89be978169d7f659b6dcd7a61b0d33c604f3 Mon Sep 17 00:00:00 2001 From: ilho kim Date: Fri, 11 Aug 2023 11:10:12 +0900 Subject: [PATCH 03/16] Release version 0.15.33 Changes: - Fix static analysis issue Change-Id: Ida3aaecd1dcc0206fc80ea31a9fcf23534011f43 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 563323a..ce4ab7a 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.32 +Version: 0.15.33 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 53b146f1502b64a31c098025eb3f54ea8f9e1574 Mon Sep 17 00:00:00 2001 From: ilho kim Date: Fri, 20 Oct 2023 15:24:46 +0900 Subject: [PATCH 04/16] Remove code that may fall info infinite loop Change-Id: I8ebbac18e15ec68c0dc215ec619527b5aa93fbca Signed-off-by: ilho kim --- src/wgt/step/encryption/step_encrypt_resources.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wgt/step/encryption/step_encrypt_resources.cc b/src/wgt/step/encryption/step_encrypt_resources.cc index 40b6781..448d2f4 100644 --- a/src/wgt/step/encryption/step_encrypt_resources.cc +++ b/src/wgt/step/encryption/step_encrypt_resources.cc @@ -36,9 +36,9 @@ const std::set encryptSet { ".html", ".htm", ".css", ".js"}; FILE* OpenFile(const bf::path& path, const std::string& mode) { FILE* result = nullptr; - do { - result = fopen(path.c_str(), mode.c_str()); - } while ((nullptr == result)); + result = fopen(path.c_str(), mode.c_str()); + if (result == nullptr) + LOG(ERROR) << "open [" << path << "] fail, errno : " << errno; return result; } -- 2.7.4 From 8c7721c11e1cf5ec655c6d0b9b24375bb3a60ac9 Mon Sep 17 00:00:00 2001 From: ilho kim Date: Fri, 20 Oct 2023 19:18:59 +0900 Subject: [PATCH 05/16] Release version 0.15.34 Changes: - Remove code that may fall info infinite loop Change-Id: I3167436182fdadf1f6f4f431c1abc38472d0f49b 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 ce4ab7a..859c239 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.33 +Version: 0.15.34 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 378e7df01071c7a199f4bf6b1fd18170b47c42a5 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Mon, 29 Jan 2024 19:34:55 +0900 Subject: [PATCH 06/16] Fix static analysis issue Avoid sign extension Use of auto that causes a copy Change-Id: Ieaa6d37d8cdc0f7c8e9d2f793b32372c0cf2934e Signed-off-by: Ilho Kim --- src/lib/wgt_archive_info.cc | 2 +- src/wgt/step/pkgmgr/step_generate_xml.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/wgt_archive_info.cc b/src/lib/wgt_archive_info.cc index edc7d77..0fd5307 100644 --- a/src/lib/wgt_archive_info.cc +++ b/src/lib/wgt_archive_info.cc @@ -140,7 +140,7 @@ bool WgtArchiveInfo::ReadIcon(const bf::path& icon, const bf::path& tmp_dir) { icon_buf_.resize(len / sizeof(unsigned char)); ifs.read(reinterpret_cast(icon_buf_.data()), len); - if (len != icon_buf_.size()) { + if (static_cast(len) != icon_buf_.size()) { LOG(ERROR) << "Reading icon failed, icon size is: " << len << ", but read size is: " << icon_buf_.size(); return false; diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 7294e17..abae81c 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -595,8 +595,8 @@ void StepGenerateXml::GenerateAccount(xmlTextWriterPtr writer) { } void StepGenerateXml::GenerateIme(xmlTextWriterPtr writer) { - const auto &ime = context_->manifest_plugins_data.get().ime_info.get(); - const auto ime_uuid = ime.uuid(); + const auto& ime = context_->manifest_plugins_data.get().ime_info.get(); + const auto& ime_uuid = ime.uuid(); if (!ime_uuid.empty()) { xmlTextWriterStartElement(writer, BAD_CAST "ime"); -- 2.7.4 From 59c0d516a451c630fccd806585f5f77dcda87797 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 30 Jan 2024 14:23:11 +0900 Subject: [PATCH 07/16] Release version 0.15.35 Changes: - Fix static analysis issue Change-Id: Ie7243b7ead7efe60d82c3542164f925be0ec9b4c 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 859c239..a85906d 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.34 +Version: 0.15.35 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 78f9165139885bbe74d284c2bdbacaa347ff0e9a Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Wed, 31 Jan 2024 10:06:23 +0900 Subject: [PATCH 08/16] Fix std=c++14 for gtest 1.14.0 version upgrade Change-Id: I0e25ddf941cea4018733d76518ef4c8b9ed3a54e Signed-off-by: Sangyoon Jang --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1435dc..57192e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,12 +13,12 @@ ENDIF(NOT CMAKE_BUILD_TYPE) # Compiler flags SET(EXTRA_FLAGS "-Wall -Wextra") SET(CMAKE_C_FLAGS_PROFILING "-O2 ${EXTRA_FLAGS}") -SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++11 ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++14 ${EXTRA_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g ${EXTRA_FLAGS}") -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++11 -g ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++14 -g ${EXTRA_FLAGS}") SET(CMAKE_C_FLAGS_RELEASE "-O2 -g ${EXTRA_FLAGS}") -SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++11 -g ${EXTRA_FLAGS}") -SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++11 -g --coverage ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++14 -g ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++14 -g --coverage ${EXTRA_FLAGS}") # Linker flags SET(EXTRA_LINKER_FLAGS "-Wl,--as-needed") -- 2.7.4 From 50032536ef68f71d2205dfa7ca67e3668587e9d5 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Wed, 31 Jan 2024 10:39:36 +0900 Subject: [PATCH 09/16] Release version 0.15.36 Changes: - Fix std=c++14 for gtest 1.14.0 version upgrade Change-Id: Icaacbb7854b20e3db939d39f5aa09a1e92dd1c92 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 a85906d..6649f99 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.35 +Version: 0.15.36 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From e5c054240bbf15e8840e719c095e8107468bf4cc Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Mon, 5 Feb 2024 13:18:55 +0900 Subject: [PATCH 10/16] Fix build error Change-Id: I6e23fe8404c71bbc0f920bcb30004fb7e0dfcf0c Signed-off-by: Sangyoon Jang --- src/wgt_backend/wgt_backend.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/wgt_backend/wgt_backend.cc b/src/wgt_backend/wgt_backend.cc index 54c070f..ba42bca 100644 --- a/src/wgt_backend/wgt_backend.cc +++ b/src/wgt_backend/wgt_backend.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include "hybrid/hybrid_installer.h" #include "hybrid/hybrid_installer_factory.h" @@ -15,17 +16,6 @@ namespace ci = common_installer; -#if __cplusplus < 201300L -namespace { - -template -std::unique_ptr make_unique(Args&&... args) { - return std::unique_ptr(new T(std::forward(args)...)); -} - -} // namespace -#endif - int main(int argc, char** argv) { ci::PkgmgrInstaller pkgmgr_installer; std::shared_ptr query_interface( @@ -39,20 +29,17 @@ int main(int argc, char** argv) { return EINVAL; } -#if __cplusplus >= 201300L - using std; -#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( pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) { LOG(INFO) << "Hybrid package detected"; ci::InstallerRunner runner( - make_unique(), pkgmgr); + std::make_unique(), pkgmgr); return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } else { ci::InstallerRunner runner( - make_unique(), pkgmgr); + std::make_unique(), pkgmgr); return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } } catch(...) { -- 2.7.4 From 8801f960e4f4025f3312d24ad8a8604650fca134 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Mon, 5 Feb 2024 13:19:14 +0900 Subject: [PATCH 11/16] Release version 0.15.37 Changes: - Fix build error Change-Id: I97ad9081a89749565cb1130a44dde8822007e4ac 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 6649f99..30f5094 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.36 +Version: 0.15.37 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From cfb0713f06cabe6d8e04e8da07e3e3c2dd691a7a Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Wed, 3 Jan 2024 16:31:26 +0900 Subject: [PATCH 12/16] Remove boost dependency Requires: - https://review.tizen.org/gerrit/c/platform/core/appfw/app-installers/+/303330 Change-Id: I69a618bcdd2a6981bf9e260de6385cb952a12761 Signed-off-by: Sangyoon Jang --- CMakeLists.txt | 10 +- packaging/wgt-backend.spec | 1 - src/hybrid/CMakeLists.txt | 1 - src/hybrid/step/pkgmgr/step_merge_xml.cc | 29 +-- src/hybrid/step/pkgmgr/step_merge_xml.h | 5 +- src/lib/CMakeLists.txt | 1 - src/lib/wgt_archive_info.cc | 19 +- src/lib/wgt_archive_info.h | 7 +- src/wgt/CMakeLists.txt | 1 - .../step/configuration/step_check_rds_manifest.cc | 22 +- .../step/configuration/step_check_start_files.cc | 4 - .../step/configuration/step_check_start_files.h | 2 - src/wgt/step/configuration/step_parse.cc | 19 +- src/wgt/step/configuration/step_parse.h | 7 +- .../step_set_old_signature_files_location.cc | 10 +- src/wgt/step/encryption/step_encrypt_resources.cc | 32 ++- src/wgt/step/encryption/step_encrypt_resources.h | 10 +- src/wgt/step/filesystem/step_copy_preview_icons.cc | 11 +- .../filesystem/step_create_wgt_symbolic_link.cc | 27 +- .../filesystem/step_create_wgt_symbolic_link.h | 2 - .../filesystem/step_restore_wgt_symbolic_link.cc | 3 - src/wgt/step/filesystem/step_wgt_patch_icons.cc | 43 ++-- .../step_wgt_patch_storage_directories.cc | 56 ++--- .../step_wgt_prepare_package_directory.cc | 44 ++-- .../step_wgt_prepare_package_directory.h | 4 +- .../step/filesystem/step_wgt_resource_directory.cc | 16 +- .../step_wgt_undo_patch_storage_directories.cc | 45 ++-- .../step_wgt_undo_patch_storage_directories.h | 4 +- .../step_wgt_update_package_directory.cc | 45 ++-- src/wgt/step/pkgmgr/step_generate_xml.cc | 29 ++- .../security/step_check_extension_privileges.cc | 13 +- .../security/step_direct_manifest_signature.cc | 4 +- .../step/security/step_direct_manifest_signature.h | 4 +- .../step/security/step_wgt_recover_signature.cc | 4 +- src/wgt/step/security/step_wgt_recover_signature.h | 4 +- src/wgt/utils/wgt_app_query_interface.cc | 24 +- src/wgt_backend/wgt_backend.cc | 2 +- test/smoke_tests/CMakeLists.txt | 3 - test/smoke_tests/extensive_smoke_test.cc | 100 ++++---- test/smoke_tests/manifest_test.cc | 15 +- test/smoke_tests/smoke_test.cc | 273 ++++++++++----------- test/smoke_tests/wgt_smoke_utils.cc | 2 +- test/smoke_tests/wgt_smoke_utils.h | 2 +- 43 files changed, 456 insertions(+), 503 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57192e1..77e2858 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,12 +13,12 @@ ENDIF(NOT CMAKE_BUILD_TYPE) # Compiler flags SET(EXTRA_FLAGS "-Wall -Wextra") SET(CMAKE_C_FLAGS_PROFILING "-O2 ${EXTRA_FLAGS}") -SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++14 ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++17 ${EXTRA_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g ${EXTRA_FLAGS}") -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++14 -g ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++17 -g ${EXTRA_FLAGS}") SET(CMAKE_C_FLAGS_RELEASE "-O2 -g ${EXTRA_FLAGS}") -SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++14 -g ${EXTRA_FLAGS}") -SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++14 -g --coverage ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++17 -g ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++17 -g --coverage ${EXTRA_FLAGS}") # Linker flags SET(EXTRA_LINKER_FLAGS "-Wl,--as-needed") @@ -55,8 +55,6 @@ PKG_CHECK_MODULES(VCONF_DEPS REQUIRED vconf) PKG_CHECK_MODULES(GUM_DEPS REQUIRED libgum) PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock) -FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem regex program_options) - ADD_SUBDIRECTORY(data) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(test) diff --git a/packaging/wgt-backend.spec b/packaging/wgt-backend.spec index 30f5094..a254c7e 100644 --- a/packaging/wgt-backend.spec +++ b/packaging/wgt-backend.spec @@ -11,7 +11,6 @@ Source1001: wgt-installer.manifest Source1002: wgt-installer-tests.manifest Requires: wgt-installer = %{version} -BuildRequires: boost-devel BuildRequires: cmake BuildRequires: app-installers-tests BuildRequires: pkgconfig(app-installers) diff --git a/src/hybrid/CMakeLists.txt b/src/hybrid/CMakeLists.txt index 9d11bd9..9733947 100644 --- a/src/hybrid/CMakeLists.txt +++ b/src/hybrid/CMakeLists.txt @@ -13,7 +13,6 @@ TARGET_INCLUDE_DIRECTORIES(${TARGET_LIBNAME_HYBRID} PUBLIC "${CMAKE_CURRENT_SOUR # Target - deps APPLY_PKG_CONFIG(${TARGET_LIBNAME_HYBRID} PUBLIC TPK_INSTALLER_DEPS - Boost ) # Target - in-package deps diff --git a/src/hybrid/step/pkgmgr/step_merge_xml.cc b/src/hybrid/step/pkgmgr/step_merge_xml.cc index 4a3cd7d..a9f3ac4 100644 --- a/src/hybrid/step/pkgmgr/step_merge_xml.cc +++ b/src/hybrid/step/pkgmgr/step_merge_xml.cc @@ -4,10 +4,6 @@ #include "hybrid/step/pkgmgr/step_merge_xml.h" -#include -#include -#include - #include #include #include @@ -16,6 +12,8 @@ #include #include +#include +#include #include #include #include @@ -23,8 +21,7 @@ #include "hybrid/hybrid_backend_data.h" namespace ci = common_installer; -namespace bf = boost::filesystem; -namespace bs = boost::system; +namespace fs = std::filesystem; namespace { @@ -54,10 +51,10 @@ const char kXmlXPrivilegeExpr[] = "//*[local-name()='privilege']"; namespace hybrid { namespace pkgmgr { -xmlDocPtr StepMergeXml::LoadXmlDocument(const bf::path& xml_path) { +xmlDocPtr StepMergeXml::LoadXmlDocument(const fs::path& xml_path) { // trim blanks int keep_blanks = xmlKeepBlanksDefault(0); - xmlDocPtr doc_ptr = xmlParseFile(xml_path.string().c_str()); + xmlDocPtr doc_ptr = xmlParseFile(xml_path.c_str()); if (!doc_ptr) { LOG(ERROR) << "Failed to parse file: " << xml_path; xmlKeepBlanksDefault(keep_blanks); @@ -146,8 +143,8 @@ bool StepMergeXml::SetTpkPrivilegeType(xmlDocPtr tpk_doc) { } ci::Step::Status StepMergeXml::process() { - bf::path wgt_xml_path = context_->xml_path.get(); - bf::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml"; + fs::path wgt_xml_path = context_->xml_path.get(); + fs::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml"; xmlDocPtr wgt_doc = LoadXmlDocument(wgt_xml_path); if (wgt_doc == nullptr) @@ -195,13 +192,13 @@ ci::Step::Status StepMergeXml::process() { SetXmlNodeAttribute(node, "exec", app->exec); } - if (xmlSaveFormatFile(wgt_xml_path.string().c_str(), wgt_doc, 1) == -1) { + if (xmlSaveFormatFile(wgt_xml_path.c_str(), wgt_doc, 1) == -1) { LOG(ERROR) << "Cannot write xml file"; return Step::Status::MANIFEST_ERROR; } if (pkgmgr_parser_check_manifest_validation( - wgt_xml_path.string().c_str()) != 0) { + wgt_xml_path.c_str()) != 0) { LOG(ERROR) << "Merged manifest is not valid"; return Step::Status::MANIFEST_ERROR; } @@ -210,14 +207,14 @@ ci::Step::Status StepMergeXml::process() { } ci::Step::Status StepMergeXml::precheck() { - bf::path wgt_xml_path = context_->xml_path.get(); - if (!bf::exists(wgt_xml_path)) { + fs::path wgt_xml_path = context_->xml_path.get(); + if (!fs::exists(wgt_xml_path)) { LOG(ERROR) << "Converted config file not found: " << wgt_xml_path; return Step::Status::MANIFEST_ERROR; } - bf::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml"; - if (!bf::exists(tpk_xml_path)) { + fs::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml"; + if (!fs::exists(tpk_xml_path)) { LOG(ERROR) << "Native manifest file not found: " << tpk_xml_path; return Step::Status::MANIFEST_ERROR; } diff --git a/src/hybrid/step/pkgmgr/step_merge_xml.h b/src/hybrid/step/pkgmgr/step_merge_xml.h index e9e606b..c89729f 100644 --- a/src/hybrid/step/pkgmgr/step_merge_xml.h +++ b/src/hybrid/step/pkgmgr/step_merge_xml.h @@ -5,12 +5,11 @@ #ifndef HYBRID_STEP_PKGMGR_STEP_MERGE_XML_H_ #define HYBRID_STEP_PKGMGR_STEP_MERGE_XML_H_ -#include - #include #include #include +#include #include namespace hybrid { @@ -27,7 +26,7 @@ class StepMergeXml : public common_installer::Step { Status precheck() override; private: - xmlDocPtr LoadXmlDocument(const boost::filesystem::path& xml_path); + xmlDocPtr LoadXmlDocument(const std::filesystem::path& xml_path); xmlNodePtr GetXmlNode(const xmlDocPtr doc, const std::string& name, const std::string& attr = {}, const std::string& attr_val = {}); void MergeXmlNode(xmlNodePtr node1, xmlNodePtr node2); diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 8fa61d5..3b3febb 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -9,7 +9,6 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_WGT_ARCHIVE_INFO} PUBLIC MANIFEST_PARSER_DEPS WGT_MANIFEST_HANDLERS_DEPS VCONF_DEPS - Boost ) INSTALL(TARGETS ${TARGET_LIBNAME_WGT_ARCHIVE_INFO} DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/backendlib) diff --git a/src/lib/wgt_archive_info.cc b/src/lib/wgt_archive_info.cc index 0fd5307..8f8b4a2 100644 --- a/src/lib/wgt_archive_info.cc +++ b/src/lib/wgt_archive_info.cc @@ -6,8 +6,6 @@ #include -#include - #include #include #include @@ -19,12 +17,13 @@ #include #include +#include #include #include #include -namespace bf = boost::filesystem; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -37,7 +36,7 @@ const char kHybridConfigFileName[] = "res/wgt/config.xml"; 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())) { + fs::path(tmp_dir), file.c_str())) { LOG(ERROR) << "Failed to extract"; return false; } @@ -119,12 +118,12 @@ bool WgtArchiveInfo::GetIconInfo( return true; } -bool WgtArchiveInfo::ReadIcon(const bf::path& icon, const bf::path& tmp_dir) { - bf::path icon_path = tmp_dir / icon; +bool WgtArchiveInfo::ReadIcon(const fs::path& icon, const fs::path& tmp_dir) { + fs::path icon_path = tmp_dir / icon; LOG(INFO) << "Icon file path: " << icon_path; - if (!bf::exists(icon_path)) { + if (!fs::exists(icon_path)) { LOG(WARNING) << "Icon file doesn't actually exist, skip reading icon"; return true; } @@ -198,14 +197,14 @@ bool WgtArchiveInfo::GetDescriptionInfo( } bool WgtArchiveInfo::LoadArchiveInfo() { - bf::path tmp_dir = ci::GenerateTmpDir("/tmp"); + fs::path tmp_dir = ci::GenerateTmpDir("/tmp"); if (!ci::CreateDir(tmp_dir)) return false; LOG(DEBUG) << "Unpack at temporary dir: " << tmp_dir; bool is_hybrid = false; if (!ExtractPackageArchive(path_, kHybridConfigFileName, tmp_dir.string())) return false; - if (bf::exists(tmp_dir / kHybridConfigFileName)) { + if (fs::exists(tmp_dir / kHybridConfigFileName)) { is_hybrid = true; } else { if (!ExtractPackageArchive(path_, kConfigFileName, tmp_dir.string())) @@ -213,7 +212,7 @@ bool WgtArchiveInfo::LoadArchiveInfo() { } wgt::parse::WidgetConfigParser parser; - bf::path manifest_path; + fs::path manifest_path; if (is_hybrid) manifest_path = tmp_dir / kHybridConfigFileName; else diff --git a/src/lib/wgt_archive_info.h b/src/lib/wgt_archive_info.h index 0f7a5a2..776fd05 100644 --- a/src/lib/wgt_archive_info.h +++ b/src/lib/wgt_archive_info.h @@ -5,15 +5,14 @@ #ifndef LIB_WGT_ARCHIVE_INFO_H_ #define LIB_WGT_ARCHIVE_INFO_H_ -#include - #include #include #include +#include #include -namespace bf = boost::filesystem; +namespace fs = std::filesystem; class WgtArchiveInfo : public common_installer::ArchiveInfo { public: @@ -29,7 +28,7 @@ class WgtArchiveInfo : public common_installer::ArchiveInfo { bool GetAddonInfo(const wgt::parse::WidgetConfigParser& parser); bool GetPrivilegesInfo(const wgt::parse::WidgetConfigParser& parser); bool GetIconInfo(const wgt::parse::WidgetConfigParser& parser); - bool ReadIcon(const bf::path& icon, const bf::path& tmp_dir); + bool ReadIcon(const fs::path& icon, const fs::path& tmp_dir); bool GetLabelInfo(const wgt::parse::WidgetConfigParser& parser, const char* locale); bool GetDescriptionInfo(const wgt::parse::WidgetConfigParser& parser, diff --git a/src/wgt/CMakeLists.txt b/src/wgt/CMakeLists.txt index 4a98bc4..506ffd8 100755 --- a/src/wgt/CMakeLists.txt +++ b/src/wgt/CMakeLists.txt @@ -27,7 +27,6 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_WGT} PUBLIC MANIFEST_PARSER_DEPS PKGMGR_INSTALLER_DEPS ENCRYPTION_DEPS - Boost VCONF_DEPS ) SET_TARGET_PROPERTIES(${TARGET_LIBNAME_WGT} PROPERTIES COMPILE_FLAGS "-fPIC") diff --git a/src/wgt/step/configuration/step_check_rds_manifest.cc b/src/wgt/step/configuration/step_check_rds_manifest.cc index 560f015..551ac7b 100644 --- a/src/wgt/step/configuration/step_check_rds_manifest.cc +++ b/src/wgt/step/configuration/step_check_rds_manifest.cc @@ -4,12 +4,10 @@ #include "wgt/step/configuration/step_check_rds_manifest.h" -#include -#include -#include +#include +#include -namespace bf = boost::filesystem; -namespace bs = boost::system; +namespace fs = std::filesystem; namespace { @@ -22,21 +20,21 @@ namespace wgt { namespace configuration { common_installer::Step::Status StepCheckRDSManifest::process() { - bf::path target = context_->unpacked_dir_path.get() / kConfigDeltaDir; - if (!bf::exists(target)) { - bf::path source = context_->root_application_path.get() / + fs::path target = context_->unpacked_dir_path.get() / kConfigDeltaDir; + if (!fs::exists(target)) { + fs::path source = context_->root_application_path.get() / context_->pkgid.get() / kConfigInstalled; - if (!bf::exists(source)) { + if (!fs::exists(source)) { LOG(ERROR) << "Cannot find old manifest file"; return Status::APP_DIR_ERROR; } - bs::error_code error; - bf::create_directories(source.parent_path(), error); + std::error_code error; + fs::create_directories(source.parent_path(), error); if (error) { LOG(ERROR) << "Failed to create directories for manifest file"; return Status::APP_DIR_ERROR; } - bf::copy_file(source, target, error); + fs::copy_file(source, target, error); if (error) { LOG(ERROR) << "Failed to copy old manifest file"; return Status::APP_DIR_ERROR; diff --git a/src/wgt/step/configuration/step_check_start_files.cc b/src/wgt/step/configuration/step_check_start_files.cc index e1c2b42..cc6fd77 100644 --- a/src/wgt/step/configuration/step_check_start_files.cc +++ b/src/wgt/step/configuration/step_check_start_files.cc @@ -4,8 +4,6 @@ #include "wgt/step/configuration/step_check_start_files.h" -#include - #include #include #include @@ -15,8 +13,6 @@ #include #include -namespace bf = boost::filesystem; - namespace wgt { namespace configuration { diff --git a/src/wgt/step/configuration/step_check_start_files.h b/src/wgt/step/configuration/step_check_start_files.h index 31424c0..6b4b708 100644 --- a/src/wgt/step/configuration/step_check_start_files.h +++ b/src/wgt/step/configuration/step_check_start_files.h @@ -4,8 +4,6 @@ #ifndef WGT_STEP_CONFIGURATION_STEP_CHECK_START_FILES_H_ #define WGT_STEP_CONFIGURATION_STEP_CHECK_START_FILES_H_ -#include - #include #include #include diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 7927042..904f1f1 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -5,8 +5,6 @@ #include "wgt/step/configuration/step_parse.h" -#include - #include #include #include @@ -42,6 +40,7 @@ #include #include +#include #include #include #include @@ -50,8 +49,8 @@ #include "wgt/utils/wgt_backend_data.h" -namespace bf = boost::filesystem; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -219,7 +218,7 @@ bool StepParse::FillIconPaths(manifest_x* manifest) { LOG(ERROR) << "Out of memory"; return false; } - bf::path icon_path = context_->root_application_path.get() + fs::path icon_path = context_->root_application_path.get() / app_info->package() / "res" / "wgt" / application_icon.path(); icon->text = strdup(icon_path.c_str()); if (!locale.empty()) @@ -517,7 +516,7 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { } if (!service_info.icon().empty()) { - bf::path icon_path = context_->root_application_path.get() + fs::path icon_path = context_->root_application_path.get() / manifest->package / "res" / "wgt" / service_info.icon(); icon_x* icon = reinterpret_cast(calloc(1, sizeof(icon_x))); if (!icon) { @@ -730,7 +729,7 @@ bool StepParse::FillAppDefinedPrivileges(manifest_x* manifest) { privilege->value = strdup(priv.name().c_str()); privilege->type = strdup(common_installer::kWebPrivilegeType); if (!priv.license().empty()) { - if (bf::path(priv.license()).is_absolute()) + if (fs::path(priv.license()).is_absolute()) privilege->license = strdup(priv.license().c_str()); else privilege->license = strdup((context_->root_application_path.get() @@ -760,7 +759,7 @@ bool StepParse::FillProvidesAppDefinedPrivileges(manifest_x* manifest) { privilege->value = strdup(priv.name().c_str()); privilege->type = strdup(common_installer::kWebPrivilegeType); if (!priv.license().empty()) { - if (bf::path(priv.license()).is_absolute()) + if (fs::path(priv.license()).is_absolute()) privilege->license = strdup(priv.license().c_str()); else privilege->license = strdup((context_->root_application_path.get() @@ -1080,14 +1079,14 @@ common_installer::Step::Status StepParse::process() { return common_installer::Step::Status::OK; } -bool StepParse::Check(const boost::filesystem::path& widget_path) { +bool StepParse::Check(const fs::path& widget_path) { LOG(DEBUG) << "unpacked widget path: " << widget_path; widget_path_ = widget_path; - boost::filesystem::path config = widget_path / kConfigFileName; + fs::path config = widget_path / kConfigFileName; LOG(DEBUG) << "config.xml path: " << config; - if (!boost::filesystem::exists(config)) + if (!fs::exists(config)) return false; return true; } diff --git a/src/wgt/step/configuration/step_parse.h b/src/wgt/step/configuration/step_parse.h index ddf6b7e..bb6e13e 100644 --- a/src/wgt/step/configuration/step_parse.h +++ b/src/wgt/step/configuration/step_parse.h @@ -4,8 +4,6 @@ #ifndef WGT_STEP_CONFIGURATION_STEP_PARSE_H_ #define WGT_STEP_CONFIGURATION_STEP_PARSE_H_ -#include - #include #include #include @@ -16,6 +14,7 @@ #include #include +#include #include #include #include @@ -45,9 +44,9 @@ class StepParse : public common_installer::Step { protected: virtual bool LocateConfigFile(); - bool Check(const boost::filesystem::path& widget_path); + bool Check(const std::filesystem::path& widget_path); - boost::filesystem::path widget_path_; + std::filesystem::path widget_path_; private: std::set ExtractPrivileges( diff --git a/src/wgt/step/configuration/step_set_old_signature_files_location.cc b/src/wgt/step/configuration/step_set_old_signature_files_location.cc index 11ec209..402f68c 100644 --- a/src/wgt/step/configuration/step_set_old_signature_files_location.cc +++ b/src/wgt/step/configuration/step_set_old_signature_files_location.cc @@ -4,12 +4,12 @@ #include -#include - #include -namespace bf = boost::filesystem; +#include + namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -25,8 +25,8 @@ ci::Step::Status StepSetOldSignatureFilesLocation::process() { // StepCheckSignature gets path of signature files from unpacked_dir from // unpacked_dir, which is root directory of package, but signature files // are not at root directory. - bf::path oldpath = context_->unpacked_dir_path.get(); - bf::path newpath = oldpath / kWgtPath; + fs::path oldpath = context_->unpacked_dir_path.get(); + fs::path newpath = oldpath / kWgtPath; context_->unpacked_dir_path.set(newpath); return Status::OK; } diff --git a/src/wgt/step/encryption/step_encrypt_resources.cc b/src/wgt/step/encryption/step_encrypt_resources.cc index 448d2f4..4d90da4 100644 --- a/src/wgt/step/encryption/step_encrypt_resources.cc +++ b/src/wgt/step/encryption/step_encrypt_resources.cc @@ -6,9 +6,6 @@ #include -#include -#include - #include #include @@ -20,20 +17,21 @@ #include #include #include +#include #include #include +#include #include -namespace bf = boost::filesystem; -namespace bs = boost::system; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { const std::size_t kEncryptionChunkMaxSize = 8_kB; // bytes const std::set encryptSet { ".html", ".htm", ".css", ".js"}; -FILE* OpenFile(const bf::path& path, const std::string& mode) { +FILE* OpenFile(const fs::path& path, const std::string& mode) { FILE* result = nullptr; result = fopen(path.c_str(), mode.c_str()); @@ -96,7 +94,7 @@ ci::Step::Status StepEncryptResources::precheck() { LOG(ERROR) << "unpacked_dir_path attribute is empty"; return Step::Status::INVALID_VALUE; } - if (!bf::exists(input_)) { + if (!fs::exists(input_)) { LOG(ERROR) << "unpacked_dir_path (" << input_ << ") path does not exist"; return Step::Status::INVALID_VALUE; } @@ -119,18 +117,18 @@ ci::Step::Status StepEncryptResources::process() { return ci::Step::Status::OK; } -bool StepEncryptResources::Encrypt(const bf::path &src) { +bool StepEncryptResources::Encrypt(const fs::path &src) { // traversing through src dir (recurrence if subdir found) // for every file found, check if it should be encrypted (ToBeEncrypted) // if yes, encrypt it (and replace original one) // if not, leave it - for (bf::directory_iterator file(src); - file != bf::directory_iterator(); + for (fs::directory_iterator file(src); + file != fs::directory_iterator(); ++file) { - bs::error_code error; - bf::path current(file->path()); + std::error_code error; + fs::path current(file->path()); - bool is_dir = bf::is_directory(current, error); + bool is_dir = fs::is_directory(current, error); if (error) { LOG(ERROR) << "Failed to check directory status: " << error.message(); return false; @@ -141,7 +139,7 @@ bool StepEncryptResources::Encrypt(const bf::path &src) { continue; } - bool is_sym = bf::is_symlink(symlink_status(current, error)); + bool is_sym = fs::is_symlink(symlink_status(current, error)); if (error) { LOG(ERROR) << "Failed to check symlink status: " << error.message(); return false; @@ -159,7 +157,7 @@ bool StepEncryptResources::Encrypt(const bf::path &src) { return true; } -bool StepEncryptResources::EncryptFile(const bf::path &src) { +bool StepEncryptResources::EncryptFile(const fs::path &src) { struct stat info; memset(&info, 0, sizeof(info)); int fd; @@ -184,7 +182,7 @@ bool StepEncryptResources::EncryptFile(const bf::path &src) { return true; } - bf::path encFile(src.string() + ".enc"); + fs::path encFile(src.string() + ".enc"); FILE *output = OpenFile(encFile, "wb"); if (!output) { LOG(ERROR) << "Cannot create encrypted file: " << encFile; @@ -290,7 +288,7 @@ void StepEncryptResources::SetEncryptionRoot() { input_ = context_->unpacked_dir_path.get(); } -bool StepEncryptResources::ToBeEncrypted(const bf::path &file) { +bool StepEncryptResources::ToBeEncrypted(const fs::path &file) { size_t found_key = file.string().rfind("."); if (std::string::npos != found_key) { std::string mimeType = file.string().substr(found_key); diff --git a/src/wgt/step/encryption/step_encrypt_resources.h b/src/wgt/step/encryption/step_encrypt_resources.h index b66db68..e39dd89 100644 --- a/src/wgt/step/encryption/step_encrypt_resources.h +++ b/src/wgt/step/encryption/step_encrypt_resources.h @@ -5,8 +5,6 @@ #ifndef WGT_STEP_ENCRYPTION_STEP_ENCRYPT_RESOURCES_H_ #define WGT_STEP_ENCRYPTION_STEP_ENCRYPT_RESOURCES_H_ -#include - #include #include @@ -57,14 +55,14 @@ class StepEncryptResources : public common_installer::Step { Status precheck() override; protected: - boost::filesystem::path input_; + std::filesystem::path input_; private: virtual void SetEncryptionRoot(); - bool Encrypt(const boost::filesystem::path &src); - bool EncryptFile(const boost::filesystem::path &src); - bool ToBeEncrypted(const boost::filesystem::path &file); + bool Encrypt(const std::filesystem::path &src); + bool EncryptFile(const std::filesystem::path &src); + bool ToBeEncrypted(const std::filesystem::path &file); WgtBackendData* backend_data_; STEP_NAME(EncryptResources) }; diff --git a/src/wgt/step/filesystem/step_copy_preview_icons.cc b/src/wgt/step/filesystem/step_copy_preview_icons.cc index b706345..465b096 100644 --- a/src/wgt/step/filesystem/step_copy_preview_icons.cc +++ b/src/wgt/step/filesystem/step_copy_preview_icons.cc @@ -4,16 +4,15 @@ #include "wgt/step/filesystem/step_copy_preview_icons.h" -#include - #include +#include #include #include "wgt/utils/wgt_backend_data.h" -namespace bf = boost::filesystem; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -33,11 +32,11 @@ ci::Step::Status StepCopyPreviewIcons::process() { if (size.preview.empty()) continue; - bf::path icon_path = context_->GetPkgPath() / kResWgt / size.preview; + fs::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; + fs::path(size.preview).extension().string(); + fs::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; 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 1ddd796..b704151 100644 --- a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc @@ -9,19 +9,18 @@ #include #include -#include -#include #include #include #include #include #include +#include #include +#include #include "wgt/utils/wgt_backend_data.h" -namespace bf = boost::filesystem; -namespace bs = boost::system; +namespace fs = std::filesystem; namespace { @@ -43,34 +42,34 @@ bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() { service_app_type[service_info.id()] = service_info.type(); } - boost::system::error_code error; + std::error_code error; for (application_x* app : 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; // binary is a symbolic link named and is located in / - bf::path exec_path = context_->GetPkgPath() / bf::path("bin"); + fs::path exec_path = context_->GetPkgPath() / fs::path("bin"); if (!common_installer::CreateDir(exec_path)) return false; - exec_path /= bf::path(app->appid); + exec_path /= fs::path(app->appid); common_installer::RemoveAll(exec_path); if (strcmp(app->component_type, "uiapp") == 0) { - bf::create_symlink(bf::path(kWRTPath), exec_path, error); + fs::create_symlink(fs::path(kWRTPath), exec_path, error); } else if (strcmp(app->component_type, "watchapp") == 0) { - bf::create_symlink(bf::path(kWRTPath), exec_path, error); + fs::create_symlink(fs::path(kWRTPath), exec_path, error); } else if (strcmp(app->component_type, "widgetapp") == 0) { - bf::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error); + fs::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error); } else if (service_app_type[app->appid] == "standalone") { - bf::create_symlink(kWrtServiceBinaryPath, exec_path, error); + fs::create_symlink(kWrtServiceBinaryPath, exec_path, error); } else { - bf::create_symlink(kWrtServiceLauncherBinaryPath, exec_path, error); + fs::create_symlink(kWrtServiceLauncherBinaryPath, exec_path, error); } if (error) { LOG(ERROR) << "Failed to set symbolic link " - << boost::system::system_error(error).what(); + << error.message(); return false; } } @@ -99,7 +98,7 @@ common_installer::Step::Status StepCreateWgtSymbolicLink::process() { common_installer::Step::Status StepCreateWgtSymbolicLink::undo() { for (application_x* app : GListRange(context_->manifest_data.get()->application)) { - bf::path exec_path = context_->GetPkgPath() / "bin" / app->appid; + fs::path exec_path = context_->GetPkgPath() / "bin" / app->appid; common_installer::RemoveAll(exec_path); } return Status::OK; 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 548baab..9c411d9 100644 --- a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h +++ b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h @@ -5,8 +5,6 @@ #ifndef WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_ #define WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_ -#include - #include #include diff --git a/src/wgt/step/filesystem/step_restore_wgt_symbolic_link.cc b/src/wgt/step/filesystem/step_restore_wgt_symbolic_link.cc index 0cc2e5e..7fe2aab 100644 --- a/src/wgt/step/filesystem/step_restore_wgt_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_restore_wgt_symbolic_link.cc @@ -6,9 +6,6 @@ #include "wgt/step/filesystem/step_create_wgt_symbolic_link.h" -namespace bf = boost::filesystem; -namespace bs = boost::system; - namespace wgt { namespace filesystem { diff --git a/src/wgt/step/filesystem/step_wgt_patch_icons.cc b/src/wgt/step/filesystem/step_wgt_patch_icons.cc index 1522b1b..138ec8b 100644 --- a/src/wgt/step/filesystem/step_wgt_patch_icons.cc +++ b/src/wgt/step/filesystem/step_wgt_patch_icons.cc @@ -6,23 +6,25 @@ #include +#include +#include + #include "common/utils/file_util.h" #include "common/utils/glist_range.h" -namespace bf = boost::filesystem; -namespace bs = boost::system; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { const char kDefaultIconPath[] = "/usr/share/wgt-backend/default.png"; -bool PatchIcon(icon_x* icon, const bf::path& dst_path, bool make_copy) { +bool PatchIcon(icon_x* icon, const fs::path& dst_path, bool make_copy) { if (!icon) return false; - bs::error_code error; - bf::path icon_text(icon->text); - bf::path icon_path = dst_path; + std::error_code error; + fs::path icon_text(icon->text); + fs::path icon_path = dst_path; if (strcmp(icon->lang, DEFAULT_LOCALE)) { icon_path += "."; icon_path += icon->lang; @@ -32,15 +34,15 @@ bool PatchIcon(icon_x* icon, const bf::path& dst_path, bool make_copy) { else icon_path += ".png"; if (make_copy) { - bf::copy_file(icon->text, icon_path, - bf::copy_option::overwrite_if_exists, error); + fs::copy_file(icon->text, icon_path, + fs::copy_options::overwrite_existing, error); if (error) { LOG(ERROR) << "Failed to move icon from " << icon->text << " to " << icon_path; return false; } } else { - if (!bf::exists(icon_path)) { + if (!fs::exists(icon_path)) { LOG(ERROR) << "Can't find icon in " << icon_path; return false; } @@ -51,18 +53,18 @@ bool PatchIcon(icon_x* icon, const bf::path& dst_path, bool make_copy) { return true; } -bool GenerateDefaultIcon(const bf::path& icon_path, +bool GenerateDefaultIcon(const fs::path& icon_path, application_x* app, bool make_copy) { - bs::error_code error; + std::error_code error; if (make_copy) { - bf::copy_file(kDefaultIconPath, icon_path, - bf::copy_option::overwrite_if_exists, error); + fs::copy_file(kDefaultIconPath, icon_path, + fs::copy_options::overwrite_existing, error); if (error) { LOG(ERROR) << "Failed to create default icon for web application"; return false; } } else { - if (!bf::exists(icon_path)) { + if (!fs::exists(icon_path)) { LOG(ERROR) << "Can't find icon in " << icon_path; return false; } @@ -85,16 +87,16 @@ namespace wgt { namespace filesystem { common_installer::Step::Status StepWgtPatchIcons::process() { - bf::path common_icon_location = context_->GetPkgPath() / "shared" / "res"; - bs::error_code error; - bf::create_directories(common_icon_location, error); + fs::path common_icon_location = context_->GetPkgPath() / "shared" / "res"; + std::error_code error; + fs::create_directories(common_icon_location, error); if (error) { LOG(ERROR) << "Failed to create common icon location directory"; return Status::ICON_ERROR; } for (icon_x* icon : GListRange(context_->manifest_data.get()->icon)) { - bf::path icon_path = common_icon_location / + fs::path icon_path = common_icon_location / context_->manifest_data.get()->mainapp_id; if (!PatchIcon(icon, icon_path, make_copy_)) return Status::ICON_ERROR; @@ -106,14 +108,14 @@ common_installer::Step::Status StepWgtPatchIcons::process() { if (app->icon) { // edit icon->text and copy icons to common location for (auto& icon : GListRange(app->icon)) { - bf::path icon_path = common_icon_location / app->appid; + fs::path icon_path = common_icon_location / app->appid; if (!PatchIcon(icon, icon_path, make_copy_)) return Status::ICON_ERROR; } } else { LOG(INFO) << "Application provides no icon. Using Tizen default icon."; // create default icon if there is no icon at all - bf::path icon_path = common_icon_location / app->appid; + fs::path icon_path = common_icon_location / app->appid; icon_path += ".png"; if (!GenerateDefaultIcon(icon_path, app, make_copy_)) { LOG(ERROR) << "Failed to create default icon for web application"; @@ -126,4 +128,3 @@ common_installer::Step::Status StepWgtPatchIcons::process() { } // namespace filesystem } // namespace wgt - diff --git a/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc b/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc index ddcb9a5..1b53474 100644 --- a/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc +++ b/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc @@ -4,15 +4,13 @@ #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h" -#include -#include -#include - #include -namespace bf = boost::filesystem; -namespace bs = boost::system; +#include +#include + namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -44,24 +42,24 @@ common_installer::Step::Status StepWgtPatchStorageDirectories::process() { bool StepWgtPatchStorageDirectories::ShareDirFor3x() { // check if ${pkg_path}/res/wgt/shared/res exists - bf::path wgt_shared_res_dir = + fs::path wgt_shared_res_dir = context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation; - if (!bf::exists(wgt_shared_res_dir)) + if (!fs::exists(wgt_shared_res_dir)) return true; // create ${pkg_path}/shared/res - bf::path shared_dir = context_->GetPkgPath() / kSharedLocation; - if (!bf::exists(shared_dir)) { - bs::error_code error; - bf::create_directory(shared_dir, error); + fs::path shared_dir = context_->GetPkgPath() / kSharedLocation; + if (!fs::exists(shared_dir)) { + std::error_code error; + fs::create_directory(shared_dir, error); if (error) { LOG(ERROR) << "Failed to create directory: " << shared_dir; return false; } } - bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation; - if (!bf::exists(shared_res_dir)) { - bs::error_code error; - bf::create_directory(shared_res_dir, error); + fs::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation; + if (!fs::exists(shared_res_dir)) { + std::error_code error; + fs::create_directory(shared_res_dir, error); if (error) { LOG(ERROR) << "Failed to create directory: " << shared_res_dir; return false; @@ -70,25 +68,25 @@ bool StepWgtPatchStorageDirectories::ShareDirFor3x() { // move and link all contents of ${pkg_path}res/wgt/shared/res // to ${pkg_path}shared/res - bf::directory_iterator end_itr; - for (bf::directory_iterator itr(wgt_shared_res_dir); itr != end_itr; ++itr) { - bf::path current = itr->path(); - if (bf::is_symlink(current)) { + fs::directory_iterator end_itr; + for (fs::directory_iterator itr(wgt_shared_res_dir); itr != end_itr; ++itr) { + fs::path current = itr->path(); + if (fs::is_symlink(current)) { continue; } - bf::path dest = shared_res_dir / current.filename(); - if (bf::is_directory(current)) { + fs::path dest = shared_res_dir / current.filename(); + if (fs::is_directory(current)) { if (!ci::MoveDir(current, dest, ci::FS_MERGE_OVERWRITE)) return false; } else { if (!ci::MoveFile(current, dest, true)) return false; } - bs::error_code error; - bf::create_symlink(dest, current, error); + std::error_code error; + fs::create_symlink(dest, current, error); if (error) { LOG(ERROR) << "linking failed for " << dest - << ": " << boost::system::system_error(error).what(); + << ": " << error.message(); return false; } } @@ -96,12 +94,12 @@ bool StepWgtPatchStorageDirectories::ShareDirFor3x() { } bool StepWgtPatchStorageDirectories::CreatePrivateTmpDir() { - bf::path tmp_path = context_->GetPkgPath() / kTemporaryData; - if (bf::exists(tmp_path) && bf::is_directory(tmp_path)) { + fs::path tmp_path = context_->GetPkgPath() / kTemporaryData; + if (fs::exists(tmp_path) && fs::is_directory(tmp_path)) { return true; } - bs::error_code error; - bf::create_directory(tmp_path, error); + std::error_code error; + fs::create_directory(tmp_path, error); if (error) { LOG(ERROR) << "Failed to create private temporary directory for package"; return false; diff --git a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc index 7559f45..4e79dc2 100644 --- a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc @@ -4,18 +4,16 @@ #include "wgt/step/filesystem/step_wgt_prepare_package_directory.h" -#include -#include -#include - #include #include +#include +#include +#include #include -namespace bf = boost::filesystem; -namespace bs = boost::system; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -37,36 +35,36 @@ namespace wgt { namespace filesystem { ci::Step::Status StepWgtPreparePackageDirectory::CreateSymlinks() { - bs::error_code error; - bf::path mount_point = ci::GetMountLocation(context_->GetPkgPath()); - bf::path res_wgt_link = context_->GetPkgPath() / kResWgtDirectory; + std::error_code error; + fs::path mount_point = ci::GetMountLocation(context_->GetPkgPath()); + fs::path res_wgt_link = context_->GetPkgPath() / kResWgtDirectory; std::vector fileList; std::vector extractEntries = GetExtractEntries(); - for (bf::directory_iterator iter(mount_point); - iter != bf::directory_iterator(); ++iter) { - bf::path current(iter->path()); + for (fs::directory_iterator iter(mount_point); + iter != fs::directory_iterator(); ++iter) { + fs::path current(iter->path()); if (std::find(extractEntries.begin(), extractEntries.end(), current.filename()) != extractEntries.end()) continue; - bf::path destination = res_wgt_link / current.filename(); - if (bf::exists(destination)) { - if (!bf::is_symlink(symlink_status(destination))) { + fs::path destination = res_wgt_link / current.filename(); + if (fs::exists(destination)) { + if (!fs::is_symlink(symlink_status(destination))) { LOG(ERROR) << "Cannot proceed. " << "Location of link is used by another file"; return Status::APP_DIR_ERROR; } - bf::remove(destination, error); + fs::remove(destination, error); if (error) { LOG(ERROR) << "Failed to remove previous symlink"; return Status::APP_DIR_ERROR; } } - bf::create_symlink(iter->path(), destination, error); + fs::create_symlink(iter->path(), destination, error); if (error) { LOG(ERROR) << "Failed to create symlink to widget image :" << - boost::system::system_error(error).what(); + error.message(); return Status::APP_DIR_ERROR; } } @@ -75,13 +73,13 @@ ci::Step::Status StepWgtPreparePackageDirectory::CreateSymlinks() { } ci::Step::Status StepWgtPreparePackageDirectory::ExtractEntries() { - bf::path backup_path = + fs::path backup_path = ci::GetBackupPathForPackagePath(context_->GetPkgPath()); backupPath_ = backup_path; - bf::path resource_path = context_->GetPkgPath() / kResWgtDirectory; - bs::error_code error; - bf::create_directories(resource_path, error); + fs::path resource_path = context_->GetPkgPath() / kResWgtDirectory; + std::error_code error; + fs::create_directories(resource_path, error); if (error) { LOG(ERROR) << "Failed to create proper directory structure in widget"; return Status::APP_DIR_ERROR; @@ -128,7 +126,7 @@ ci::Step::Status StepWgtPreparePackageDirectory::undo() { for (auto& entry : GetExtractEntries()) { ci::RemoveAll(context_->GetPkgPath() / kResWgtDirectory / entry); - if (!bf::exists(backupPath_ / entry)) + if (!fs::exists(backupPath_ / entry)) continue; ci::MoveDir(backupPath_ / entry, context_->GetPkgPath() / kResWgtDirectory / entry, diff --git a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.h b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.h index 8b9f14c..59c0cd8 100644 --- a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.h +++ b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.h @@ -7,9 +7,9 @@ #include -#include #include +#include #include #include "common/installer_context.h" @@ -34,7 +34,7 @@ class StepWgtPreparePackageDirectory : public common_installer::Step { Status precheck() override; private: - boost::filesystem::path backupPath_; + std::filesystem::path backupPath_; Status ExtractEntries(); Status CreateSymlinks(); diff --git a/src/wgt/step/filesystem/step_wgt_resource_directory.cc b/src/wgt/step/filesystem/step_wgt_resource_directory.cc index cf2e57f..aa8982e 100644 --- a/src/wgt/step/filesystem/step_wgt_resource_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_resource_directory.cc @@ -4,20 +4,20 @@ #include "wgt/step/filesystem/step_wgt_resource_directory.h" -#include - #include -namespace bf = boost::filesystem; -namespace bs = boost::system; +#include +#include + +namespace fs = std::filesystem; namespace wgt { namespace filesystem { common_installer::Step::Status StepWgtResourceDirectory::process() { - bf::path temp_path = context_->unpacked_dir_path.get(); + fs::path temp_path = context_->unpacked_dir_path.get(); temp_path += ".temp"; - bf::path resource_path = context_->unpacked_dir_path.get() / "res/wgt"; + fs::path resource_path = context_->unpacked_dir_path.get() / "res/wgt"; if (!common_installer::MoveDir(context_->unpacked_dir_path.get(), temp_path)) { @@ -25,8 +25,8 @@ common_installer::Step::Status StepWgtResourceDirectory::process() { << " to: " << temp_path; return Status::APP_DIR_ERROR; } - bs::error_code error; - bf::create_directories(resource_path.parent_path(), error); + std::error_code error; + fs::create_directories(resource_path.parent_path(), error); if (error) { LOG(ERROR) << "Failed to create proper directory structure in widget"; return Status::APP_DIR_ERROR; diff --git a/src/wgt/step/filesystem/step_wgt_undo_patch_storage_directories.cc b/src/wgt/step/filesystem/step_wgt_undo_patch_storage_directories.cc index 4795137..8c2dff8 100644 --- a/src/wgt/step/filesystem/step_wgt_undo_patch_storage_directories.cc +++ b/src/wgt/step/filesystem/step_wgt_undo_patch_storage_directories.cc @@ -4,15 +4,12 @@ #include "wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h" -#include -#include -#include - #include -namespace bf = boost::filesystem; -namespace bs = boost::system; +#include + namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -48,9 +45,9 @@ ci::Step::Status StepWgtUndoPatchStorageDirectories::undo() { if (!backup_dir_.empty()) { LOG(DEBUG) << "Restore res/wgt/shared/res from backup dir"; // restore link - bf::path wgt_shared_res_dir = + fs::path wgt_shared_res_dir = context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation; - bf::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res"; + fs::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res"; if (!backup_wgt_shared_res.empty()) { if (!ci::RemoveAll(wgt_shared_res_dir)) { LOG(ERROR) << "Failed to remove res/wgt/shared/res"; @@ -63,8 +60,8 @@ ci::Step::Status StepWgtUndoPatchStorageDirectories::undo() { } } // restore original contents - bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation; - bf::path backup_shared_res = backup_dir_ / "shared_res"; + fs::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation; + fs::path backup_shared_res = backup_dir_ / "shared_res"; if (!backup_shared_res.empty()) { if (!ci::CopyDir(backup_dir_, shared_res_dir, ci::FS_MERGE_OVERWRITE, false)) { @@ -78,15 +75,15 @@ ci::Step::Status StepWgtUndoPatchStorageDirectories::undo() { bool StepWgtUndoPatchStorageDirectories::UndoShareDirFor3x() { // check if ${pkg_path}/shared/res exists - bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation; - if (!bf::exists(shared_res_dir)) + fs::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation; + if (!fs::exists(shared_res_dir)) return true; - bf::path wgt_shared_res_dir = + fs::path wgt_shared_res_dir = context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation; - if (!bf::exists(wgt_shared_res_dir)) + if (!fs::exists(wgt_shared_res_dir)) return true; - if (bf::is_symlink(wgt_shared_res_dir)) { + if (fs::is_symlink(wgt_shared_res_dir)) { LOG(ERROR) << "Can't support this step, pkg should be fully updated"; return false; } @@ -94,10 +91,10 @@ bool StepWgtUndoPatchStorageDirectories::UndoShareDirFor3x() { // backup for undo backup_dir_ = context_->unpacked_dir_path.get(); backup_dir_ += ".SharedRes"; - bf::path backup_shared_res = backup_dir_ / "shared_res"; + fs::path backup_shared_res = backup_dir_ / "shared_res"; if (!ci::CreateDir(backup_shared_res)) return false; - bf::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res"; + fs::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res"; if (!ci::CopyDir(wgt_shared_res_dir, backup_wgt_shared_res, ci::FS_MERGE_OVERWRITE, false)) { backup_dir_.clear(); @@ -106,21 +103,21 @@ bool StepWgtUndoPatchStorageDirectories::UndoShareDirFor3x() { // unlink and move all linked contents from ${pkg_path}/shared/res // to ${pkg_path}/res/wgt/shared/res - bf::directory_iterator end_itr; - for (bf::directory_iterator itr(wgt_shared_res_dir); itr != end_itr; ++itr) { - bf::path link_file = itr->path(); - if (!bf::is_symlink(link_file)) { + fs::directory_iterator end_itr; + for (fs::directory_iterator itr(wgt_shared_res_dir); itr != end_itr; ++itr) { + fs::path link_file = itr->path(); + if (!fs::is_symlink(link_file)) { continue; } - bf::path link_target = bf::read_symlink(link_file); + fs::path link_target = fs::read_symlink(link_file); if (link_target.native().substr(0, shared_res_dir.native().length()) != shared_res_dir.native()) { continue; } if (!ci::Remove(link_file)) return false; - bf::path tmp_backup = backup_shared_res / link_target.filename(); - if (bf::is_directory(link_target)) { + fs::path tmp_backup = backup_shared_res / link_target.filename(); + if (fs::is_directory(link_target)) { if (!ci::CopyDir(link_target, tmp_backup, ci::FS_MERGE_OVERWRITE, false)) return false; if (!ci::MoveDir(link_target, link_file, ci::FS_MERGE_OVERWRITE)) diff --git a/src/wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h b/src/wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h index 00c1dcd..e5c2fda 100644 --- a/src/wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h +++ b/src/wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h @@ -8,6 +8,8 @@ #include #include +#include + namespace wgt { namespace filesystem { @@ -29,7 +31,7 @@ class StepWgtUndoPatchStorageDirectories : private: bool UndoShareDirFor3x(); - boost::filesystem::path backup_dir_; + std::filesystem::path backup_dir_; STEP_NAME(WgtUndoPatchStorageDirectories) }; 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 b23378e..49c5552 100644 --- a/src/wgt/step/filesystem/step_wgt_update_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_update_package_directory.cc @@ -1,22 +1,17 @@ -// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reservedstd // Use of this source code is governed by an apache-2.0 license that can be // found in the LICENSE file. #include "wgt/step/filesystem/step_wgt_update_package_directory.h" -#include -#include -#include - #include #include #include #include -namespace bf = boost::filesystem; -namespace bs = boost::system; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -27,7 +22,7 @@ const std::vector kBackupEntries = { "res/wgt" }; -bool MoveCreateDir(const bf::path& source, const bf::path& destination) { +bool MoveCreateDir(const fs::path& source, const fs::path& destination) { if (!ci::MoveDir(source, destination)) { LOG(ERROR) << "Failed to move directory " << destination; return false; @@ -42,15 +37,15 @@ namespace filesystem { ci::Step::Status StepWgtUpdatePackageDirectory::CreateBackupOfDirectories() { - bf::path backup_path = + fs::path backup_path = ci::GetBackupPathForPackagePath(context_->GetPkgPath()); for (auto& entry : kBackupEntries) { std::string root_entry = entry.substr(0, entry.find("/")); - bf::path directory = context_->GetPkgPath() / root_entry; - if (!bf::exists(directory)) + fs::path directory = context_->GetPkgPath() / root_entry; + if (!fs::exists(directory)) continue; LOG(DEBUG) << "Backup directory entry: " << entry; - bf::path directory_backup = backup_path / root_entry; + fs::path directory_backup = backup_path / root_entry; if (!MoveCreateDir(directory, directory_backup)) { LOG(ERROR) << "Failed to create backup directory " << directory_backup; @@ -62,22 +57,22 @@ StepWgtUpdatePackageDirectory::CreateBackupOfDirectories() { ci::Step::Status StepWgtUpdatePackageDirectory::RecoverBackupOfDirectories() { - bf::path backup_path = + fs::path backup_path = ci::GetBackupPathForPackagePath(context_->GetPkgPath()); // skip if there is no backup of directories - if (!bf::exists(backup_path)) + if (!fs::exists(backup_path)) return Status::OK; for (auto& entry : kBackupEntries) { std::string root_entry = entry.substr(0, entry.find("/")); - bf::path directory = context_->GetPkgPath() / root_entry; - bf::path directory_backup = backup_path / root_entry; - if (!bf::exists(directory_backup)) + fs::path directory = context_->GetPkgPath() / root_entry; + fs::path directory_backup = backup_path / root_entry; + if (!fs::exists(directory_backup)) continue; LOG(DEBUG) << "Recover directory entry: " << entry; - bs::error_code error; - bf::remove_all(directory, error); + std::error_code error; + fs::remove_all(directory, error); if (error) { LOG(ERROR) << "Failed to remove fail-update directory: " << directory; return Status::APP_DIR_ERROR; @@ -105,9 +100,9 @@ ci::Step::Status StepWgtUpdatePackageDirectory::process() { } ci::Step::Status StepWgtUpdatePackageDirectory::clean() { - bf::path backup_path = + fs::path backup_path = ci::GetBackupPathForPackagePath(context_->GetPkgPath()); - if (bf::exists(backup_path)) + if (fs::exists(backup_path)) ci::RemoveAll(backup_path); return Status::OK; } @@ -116,11 +111,11 @@ ci::Step::Status StepWgtUpdatePackageDirectory::undo() { Status status = RecoverBackupOfDirectories(); if (status != Status::OK) return status; - bf::path backup_path = + fs::path backup_path = ci::GetBackupPathForPackagePath(context_->GetPkgPath()); - if (bf::exists(backup_path)) { - bs::error_code error; - bf::remove_all(backup_path, error); + if (fs::exists(backup_path)) { + std::error_code error; + fs::remove_all(backup_path, error); if (error) { LOG(ERROR) << "Failed to remove backup directories"; return Status::APP_DIR_ERROR; diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index abae81c..1b5fbaf 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -5,9 +5,6 @@ #include "wgt/step/pkgmgr/step_generate_xml.h" -#include -#include - #include #include #include @@ -19,14 +16,16 @@ #include #include +#include #include #include +#include #include +#include #include "wgt/utils/wgt_backend_data.h" -namespace bs = boost::system; -namespace bf = boost::filesystem; +namespace fs = std::filesystem; namespace { @@ -87,7 +86,7 @@ void WriteServiceApplicationAttributes( bool WriteWidgetApplicationAttributesAndElements( xmlTextWriterPtr writer, application_x *app, const wgt::parse::AppWidgetInfo& widget_info, - const bf::path& shared_path) { + const fs::path& shared_path) { if (app->nodisplay) xmlTextWriterWriteAttribute(writer, BAD_CAST "nodisplay", BAD_CAST app->nodisplay); @@ -123,7 +122,7 @@ bool WriteWidgetApplicationAttributesAndElements( if (!size.preview.empty()) { std::string icon_name = shared_path.string() + "/" + appwidget->id + "." + type + "." + "preview" + - bf::path(size.preview).extension().string(); + fs::path(size.preview).extension().string(); xmlTextWriterWriteAttribute(writer, BAD_CAST "preview", BAD_CAST icon_name.c_str()); // NOLINT } @@ -164,10 +163,10 @@ common_installer::Step::Status StepGenerateXml::GenerateApplicationCommonXml( xmlTextWriterWriteAttribute(writer, BAD_CAST "appid", BAD_CAST app->appid); // binary is a symbolic link named and is located in / - bf::path exec_path = context_->GetPkgPath() - / bf::path("bin") / bf::path(app->appid); + fs::path exec_path = context_->GetPkgPath() + / fs::path("bin") / fs::path(app->appid); xmlTextWriterWriteAttribute(writer, BAD_CAST "exec", - BAD_CAST exec_path.string().c_str()); + BAD_CAST exec_path.c_str()); if (app->type) xmlTextWriterWriteAttribute(writer, BAD_CAST "type", BAD_CAST app->type); else @@ -326,15 +325,15 @@ common_installer::Step::Status StepGenerateXml::precheck() { } common_installer::Step::Status StepGenerateXml::process() { - bf::path xml_path = - bf::path(getUserManifestPath(context_->uid.get(), + fs::path xml_path = + fs::path(getUserManifestPath(context_->uid.get(), context_->is_readonly_package.get())) - / bf::path(context_->pkgid.get()); + / fs::path(context_->pkgid.get()); xml_path += ".xml"; context_->xml_path.set(xml_path.string()); - bs::error_code error; - if (!bf::exists(xml_path.parent_path(), error)) { + std::error_code error; + if (!fs::exists(xml_path.parent_path(), error)) { if (!common_installer::CreateDir(xml_path.parent_path())) { LOG(ERROR) << "Directory for manifest xml is missing and cannot be created"; diff --git a/src/wgt/step/security/step_check_extension_privileges.cc b/src/wgt/step/security/step_check_extension_privileges.cc index e40fc6b..9066700 100755 --- a/src/wgt/step/security/step_check_extension_privileges.cc +++ b/src/wgt/step/security/step_check_extension_privileges.cc @@ -4,8 +4,6 @@ #include "wgt/step/security/step_check_extension_privileges.h" -#include - #include #include #include @@ -31,6 +29,10 @@ const char kArchArmv7l[] = "armv7l"; const char kArchI586[] = "i586"; const char kArchDefault[] = "default"; +void FreePrivilegeXList(GList* priv) { + g_list_free_full(priv, &common_installer::FreePrivilegeX); +} + } // namespace namespace wgt { @@ -43,6 +45,7 @@ common_installer::Step::Status StepCheckExtensionPrivileges::precheck() { } return Status::OK; } + common_installer::Step::Status StepCheckExtensionPrivileges::process() { std::string app_ext_config_pattern(GetExtensionPath()); @@ -68,9 +71,9 @@ common_installer::Step::Status StepCheckExtensionPrivileges::process() { } } GList* privileges = nullptr; - BOOST_SCOPE_EXIT_ALL(privileges) { - g_list_free_full(privileges, &common_installer::FreePrivilegeX); - }; + std::unique_ptr deleter( + privileges, &::FreePrivilegeXList); + for (auto it = xmlFiles.begin(); it != xmlFiles.end(); ++it) { LOG(DEBUG) << "start to parse extension xml : " << *it; ExtensionConfigParser extensionParser(*it); diff --git a/src/wgt/step/security/step_direct_manifest_signature.cc b/src/wgt/step/security/step_direct_manifest_signature.cc index 8d3e646..de0ddc1 100644 --- a/src/wgt/step/security/step_direct_manifest_signature.cc +++ b/src/wgt/step/security/step_direct_manifest_signature.cc @@ -4,7 +4,7 @@ #include "wgt/step/security/step_direct_manifest_signature.h" -namespace bf = boost::filesystem; +namespace fs = std::filesystem; namespace { @@ -15,7 +15,7 @@ const char kResWgt[] = "res/wgt"; namespace wgt { namespace security { -bf::path StepDirectManifestSignature::GetSignatureRoot() const { +fs::path StepDirectManifestSignature::GetSignatureRoot() const { return StepSignature::GetSignatureRoot() / kResWgt; } diff --git a/src/wgt/step/security/step_direct_manifest_signature.h b/src/wgt/step/security/step_direct_manifest_signature.h index df8c7e8..a48e024 100644 --- a/src/wgt/step/security/step_direct_manifest_signature.h +++ b/src/wgt/step/security/step_direct_manifest_signature.h @@ -8,6 +8,8 @@ #include #include +#include + namespace ci = common_installer; namespace wgt { @@ -23,7 +25,7 @@ class StepDirectManifestSignature ci::security::StepSignature(context, save_signature) {} private: - boost::filesystem::path GetSignatureRoot() const override; + std::filesystem::path GetSignatureRoot() const override; STEP_NAME(DirectManifestSignature) }; diff --git a/src/wgt/step/security/step_wgt_recover_signature.cc b/src/wgt/step/security/step_wgt_recover_signature.cc index e951b5b..b5ced0f 100644 --- a/src/wgt/step/security/step_wgt_recover_signature.cc +++ b/src/wgt/step/security/step_wgt_recover_signature.cc @@ -4,7 +4,7 @@ #include "wgt/step/security/step_wgt_recover_signature.h" -namespace bf = boost::filesystem; +namespace fs = std::filesystem; namespace { @@ -15,7 +15,7 @@ const char kResWgt[] = "res/wgt"; namespace wgt { namespace security { -bf::path StepWgtRecoverSignature::GetSignatureRoot() { +fs::path StepWgtRecoverSignature::GetSignatureRoot() { return context_->GetPkgPath() / kResWgt; } diff --git a/src/wgt/step/security/step_wgt_recover_signature.h b/src/wgt/step/security/step_wgt_recover_signature.h index 8f37c4d..2ddef09 100644 --- a/src/wgt/step/security/step_wgt_recover_signature.h +++ b/src/wgt/step/security/step_wgt_recover_signature.h @@ -7,7 +7,7 @@ #include -#include +#include namespace wgt { namespace security { @@ -18,7 +18,7 @@ class StepWgtRecoverSignature using StepRecoverSignature::StepRecoverSignature; private: - boost::filesystem::path GetSignatureRoot() override; + std::filesystem::path GetSignatureRoot() override; STEP_NAME(WgtRecoverSignature) }; diff --git a/src/wgt/utils/wgt_app_query_interface.cc b/src/wgt/utils/wgt_app_query_interface.cc index 2336a55..ddc5a90 100644 --- a/src/wgt/utils/wgt_app_query_interface.cc +++ b/src/wgt/utils/wgt_app_query_interface.cc @@ -7,10 +7,6 @@ #include #include -#include -#include -#include - #include #include #include @@ -26,14 +22,14 @@ #include +#include #include #include #include #include -namespace bf = boost::filesystem; -namespace bs = boost::system; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -61,7 +57,7 @@ std::string WgtAppQueryInterface::GetManifestFileName() const { std::string WgtAppQueryInterface::GetPkgIdFromPath( const std::string& path) const { - bf::path tmp_path = ExtractManifest(path); + fs::path tmp_path = ExtractManifest(path); if (tmp_path.empty()) return {}; std::vector> handlers = { @@ -73,7 +69,7 @@ std::string WgtAppQueryInterface::GetPkgIdFromPath( new parser::ManifestHandlerRegistry(handlers)); std::unique_ptr parser( new parser::ManifestParser(std::move(registry))); - bf::path config_path = tmp_path / GetManifestFileName(); + fs::path config_path = tmp_path / GetManifestFileName(); if (!parser->ParseManifest(config_path)) { ClearTemporaryFile(tmp_path); return {}; @@ -104,14 +100,14 @@ bool WgtAppQueryInterface::IsHybridApplication(const std::string& arg, info = ReadPkgidFromRecovery(arg); else info = arg; - bf::path rw_package_directory(ci::GetRootAppPath(false, uid)); - bf::path ro_package_directory; + fs::path rw_package_directory(ci::GetRootAppPath(false, uid)); + fs::path ro_package_directory; if (uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER) || uid == 0) ro_package_directory = ci::GetRootAppPath(true, uid); - if ((bf::exists(rw_package_directory / info / kTizenManifestLocation) && - bf::exists(rw_package_directory / info / kHybridConfigLocation)) || - (bf::exists(ro_package_directory / info / kTizenManifestLocation) && - bf::exists(ro_package_directory / info / kHybridConfigLocation))) { + if ((fs::exists(rw_package_directory / info / kTizenManifestLocation) && + fs::exists(rw_package_directory / info / kHybridConfigLocation)) || + (fs::exists(ro_package_directory / info / kTizenManifestLocation) && + fs::exists(ro_package_directory / info / kHybridConfigLocation))) { return true; } else if (!is_recovery) { bool tizen_manifest_found = false; diff --git a/src/wgt_backend/wgt_backend.cc b/src/wgt_backend/wgt_backend.cc index ba42bca..47a6c3d 100644 --- a/src/wgt_backend/wgt_backend.cc +++ b/src/wgt_backend/wgt_backend.cc @@ -39,7 +39,7 @@ int main(int argc, char** argv) { return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } else { ci::InstallerRunner runner( - std::make_unique(), pkgmgr); + std::make_unique(), pkgmgr); return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1; } } catch(...) { diff --git a/test/smoke_tests/CMakeLists.txt b/test/smoke_tests/CMakeLists.txt index fa1ad77..16f6e59 100644 --- a/test/smoke_tests/CMakeLists.txt +++ b/test/smoke_tests/CMakeLists.txt @@ -33,17 +33,14 @@ INSTALL(DIRECTORY test_samples/ DESTINATION ${SHAREDIR}/${DESTINATION_DIR}/test_ ENDIF() APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST} PUBLIC - Boost GMOCK_DEPS GUM_DEPS ) APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC - Boost GMOCK_DEPS GUM_DEPS ) APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC - Boost GMOCK_DEPS ) diff --git a/test/smoke_tests/extensive_smoke_test.cc b/test/smoke_tests/extensive_smoke_test.cc index d1bdcfc..3b25401 100644 --- a/test/smoke_tests/extensive_smoke_test.cc +++ b/test/smoke_tests/extensive_smoke_test.cc @@ -44,7 +44,7 @@ class SmokeEnvironment : public testing::Environment { private: ci::RequestMode request_mode_; - std::vector backups_; + std::vector backups_; }; } // namespace smoke_test @@ -98,7 +98,7 @@ class HybridSmokeTest : public testing::Test { }; TEST_F(SmokeTest, RecoveryMode_ForInstallation) { - bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt"; + fs::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt"; std::string pkgid = "smokewgt09"; std::string appid = "smokewgt09.RecoveryModeForInstallation"; @@ -107,7 +107,7 @@ TEST_F(SmokeTest, RecoveryMode_ForInstallation) { {"", "-i", path.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { if (step >= 2) { - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = @@ -127,14 +127,14 @@ TEST_F(SmokeTest, RecoveryMode_ForInstallation) { } TEST_F(SmokeTest, RecoveryMode_ForUpdate) { - bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForUpdate.wgt"; - bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForUpdate_2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForUpdate.wgt"; + fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForUpdate_2.wgt"; std::string pkgid = "smokewgt10"; std::string appid = "smokewgt10.RecoveryModeForUpdate"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ASSERT_EQ(backend.InstallWithSubprocess(path_old), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status_old(pkgid, params); ASSERT_TRUE(expected_file_status_old.Init()); @@ -153,7 +153,7 @@ TEST_F(SmokeTest, RecoveryMode_ForUpdate) { {"", "-i", path_new.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { if (step >= 2) { - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = @@ -187,14 +187,14 @@ TEST_F(SmokeTest, RecoveryMode_ForUpdate) { } TEST_F(SmokeTest, RecoveryMode_ForDelta) { - bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.wgt"; - bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta"; + fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.wgt"; + fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta"; std::string pkgid = "smokewgt30"; std::string appid = "smokewgt30.RecoveryModeForDelta"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ASSERT_EQ(BackendInterface::SubProcessResult::SUCCESS, backend.InstallWithSubprocess(path_old)); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status_old(pkgid, params); ASSERT_TRUE(expected_file_status_old.Init()); @@ -212,7 +212,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { {"", "-i", path_new.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { if (step >= 2) { - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = @@ -246,7 +246,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { } TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { - bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt"; + fs::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt"; std::string pkgid = "smokewgt31"; std::string appid = "smokewgt31.RecoveryModeForMountInstall"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); @@ -255,7 +255,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { {"", "-w", path.string(), "-u", test_user_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { if (step >= 2) { - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = @@ -276,16 +276,16 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { } TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { - bf::path path_old = + fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate.wgt"; - bf::path path_new = + fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate_2.wgt"; std::string pkgid = "smokewgt32"; std::string appid = "smokewgt32.RecoveryModeForMountUpdate"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ASSERT_EQ(backend.MountInstallWithSubprocess(path_old), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status_old(pkgid, params); ASSERT_TRUE(expected_file_status_old.Init()); @@ -308,7 +308,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { params.test_user.uid); poweroff_unmount_interface.Release(); - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = @@ -344,7 +344,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { TEST_F(SmokeTest, InstallationMode_Rollback) { - bf::path path = kSmokePackagesDirectory / "InstallationMode_Rollback.wgt"; + fs::path path = kSmokePackagesDirectory / "InstallationMode_Rollback.wgt"; std::string pkgid = "smokewgt06"; std::string appid = "smokewgt06.InstallationModeRollback"; @@ -357,13 +357,13 @@ TEST_F(SmokeTest, InstallationMode_Rollback) { } TEST_F(SmokeTest, UpdateMode_Rollback) { - bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback.wgt"; - bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback.wgt"; + fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_2.wgt"; std::string pkgid = "smokewgt07"; std::string appid = "smokewgt07.UpdateModeRollback"; ASSERT_EQ(backend.InstallWithSubprocess(path_old), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status(pkgid, params); ASSERT_TRUE(expected_file_status.Init()); @@ -385,13 +385,13 @@ TEST_F(SmokeTest, UpdateMode_Rollback) { } TEST_F(SmokeTest, DeltaMode_Rollback) { - bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt"; - bf::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta"; + fs::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt"; + fs::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta"; std::string pkgid = "smokewgt01"; std::string appid = "smokewgt01.DeltaMode"; ASSERT_EQ(backend.InstallWithSubprocess(path), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status(pkgid, params); ASSERT_TRUE(expected_file_status.Init()); @@ -407,16 +407,16 @@ TEST_F(SmokeTest, DeltaMode_Rollback) { EXTENDED_ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "version 1\n", params)); EXTENDED_ASSERT_TRUE(ValidateDataFiles(pkgid, params.test_user.uid)); - EXTENDED_ASSERT_TRUE(bf::exists(GetPackageRoot( + EXTENDED_ASSERT_TRUE(fs::exists(GetPackageRoot( pkgid, params.test_user.uid) / "res/wgt/DELETED")); - EXTENDED_ASSERT_FALSE(bf::exists(GetPackageRoot( + EXTENDED_ASSERT_FALSE(fs::exists(GetPackageRoot( pkgid, params.test_user.uid) / "res/wgt/ADDED")); return true; }); } TEST_F(HybridSmokeTest, InstallationMode_Rollback) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "InstallationMode_Rollback_Hybrid.wgt"; std::string pkgid = "smokehyb07"; std::string appid1 = "smokehyb07.web"; @@ -429,15 +429,15 @@ TEST_F(HybridSmokeTest, InstallationMode_Rollback) { } TEST_F(HybridSmokeTest, UpdateMode_Rollback) { - bf::path path_old = kSmokePackagesDirectory / + fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback_Hybrid.wgt"; - bf::path path_new = kSmokePackagesDirectory / + fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_Hybrid_2.wgt"; std::string pkgid = "smokehyb08"; std::string appid1 = "smokehyb08.web"; ASSERT_EQ(backend.InstallWithSubprocess(path_old), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status(pkgid, params); ASSERT_TRUE(expected_file_status.Init()); @@ -461,14 +461,14 @@ TEST_F(HybridSmokeTest, UpdateMode_Rollback) { } TEST_F(HybridSmokeTest, DeltaMode_Rollback_Hybrid) { - bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt"; - bf::path delta_package = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt"; + fs::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.delta"; std::string pkgid = "smokehyb11"; std::string appid1 = "smokehyb11.web"; ASSERT_EQ(backend.InstallWithSubprocess(path), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status(pkgid, params); ASSERT_TRUE(expected_file_status.Init()); @@ -481,11 +481,11 @@ TEST_F(HybridSmokeTest, DeltaMode_Rollback_Hybrid) { expected_file_status.IsEqual(new_file_status, &added_files)); EXTENDED_ASSERT_TRUE(ValidatePackage(pkgid, {appid1}, params)); // Check delta modifications - bf::path root_path = GetPackageRoot(pkgid, params.test_user.uid); - EXTENDED_ASSERT_TRUE(bf::exists(root_path / "res" / "wgt" / "DELETED")); - EXTENDED_ASSERT_FALSE(bf::exists(root_path / "res" / "wgt" / "ADDED")); - EXTENDED_ASSERT_TRUE(bf::exists(root_path / "lib" / "DELETED")); - EXTENDED_ASSERT_FALSE(bf::exists(root_path / "lib" / "ADDED")); + fs::path root_path = GetPackageRoot(pkgid, params.test_user.uid); + EXTENDED_ASSERT_TRUE(fs::exists(root_path / "res" / "wgt" / "DELETED")); + EXTENDED_ASSERT_FALSE(fs::exists(root_path / "res" / "wgt" / "ADDED")); + EXTENDED_ASSERT_TRUE(fs::exists(root_path / "lib" / "DELETED")); + EXTENDED_ASSERT_FALSE(fs::exists(root_path / "lib" / "ADDED")); EXTENDED_ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "version 1\n", params)); EXTENDED_ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "lib/MODIFIED", @@ -496,7 +496,7 @@ TEST_F(HybridSmokeTest, DeltaMode_Rollback_Hybrid) { } TEST_F(HybridSmokeTest, MountInstallationMode_Rollback) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "MountInstallationMode_Rollback_Hybrid.wgt"; std::string pkgid = "smokehyb09"; std::string appid1 = "smokehyb09.web"; @@ -510,15 +510,15 @@ TEST_F(HybridSmokeTest, MountInstallationMode_Rollback) { } TEST_F(HybridSmokeTest, MountUpdateMode_Rollback) { - bf::path path_old = kSmokePackagesDirectory / + fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback_Hybrid.wgt"; - bf::path path_new = kSmokePackagesDirectory / + fs::path path_new = kSmokePackagesDirectory / "MountUpdateMode_Rollback_Hybrid_2.wgt"; std::string pkgid = "smokehyb10"; std::string appid1 = "smokehyb10.web"; ASSERT_EQ(backend.MountInstallWithSubprocess(path_old), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status(pkgid, params); ASSERT_TRUE(expected_file_status.Init()); @@ -543,7 +543,7 @@ TEST_F(HybridSmokeTest, MountUpdateMode_Rollback) { } TEST_F(SmokeTest, MountInstallationMode_Rollback) { - bf::path path = + fs::path path = kSmokePackagesDirectory / "MountInstallationMode_Rollback.wgt"; std::string pkgid = "smokewgt33"; std::string appid = "smokewgt33.web"; @@ -557,14 +557,14 @@ TEST_F(SmokeTest, MountInstallationMode_Rollback) { } TEST_F(SmokeTest, MountUpdateMode_Rollback) { - bf::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback.wgt"; - bf::path path_new = + fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback.wgt"; + fs::path path_new = kSmokePackagesDirectory / "MountUpdateMode_Rollback_2.wgt"; std::string pkgid = "smokewgt34"; std::string appid = "smokewgt34.web"; ASSERT_EQ(backend.MountInstallWithSubprocess(path_old), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status(pkgid, params); ASSERT_TRUE(expected_file_status.Init()); @@ -588,16 +588,16 @@ TEST_F(SmokeTest, MountUpdateMode_Rollback) { TEST_F(PreloadSmokeTest, RecoveryMode_ForReadonlyUpdateInstall) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path path_old = kSmokePackagesDirectory / + fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForReadonlyUpdateInstall.wgt"; - bf::path path_new = kSmokePackagesDirectory / + fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForReadonlyUpdateInstall_2.wgt"; std::string pkgid = "smokewgt51"; std::string appid = "smokewgt51.RecoveryModeForReadonlyUpdateInstall"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ASSERT_EQ(backend.InstallPreloadWithSubprocess(path_old), BackendInterface::SubProcessResult::SUCCESS); - std::vector added_files; + std::vector added_files; AddDataFiles(pkgid, params.test_user.uid, &added_files); FileInfoCollector expected_file_status_old(pkgid, params); ASSERT_TRUE(expected_file_status_old.Init()); @@ -615,7 +615,7 @@ TEST_F(PreloadSmokeTest, RecoveryMode_ForReadonlyUpdateInstall) { {"", "-i", path_new.string(), "-u", test_uid_str.c_str()}; backend.CrashAfterEachStep(&args, [&](int step) -> bool { if (step >= 2) { - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); EXTENDED_ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = diff --git a/test/smoke_tests/manifest_test.cc b/test/smoke_tests/manifest_test.cc index a66b478..0f7bdf4 100644 --- a/test/smoke_tests/manifest_test.cc +++ b/test/smoke_tests/manifest_test.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by an apache-2.0 license that can be // found in the LICENSE file. -#include - #include #include #include @@ -13,6 +11,7 @@ #include #include +#include #include #include #include @@ -24,8 +23,8 @@ #define ASSERT_CSTR_EQ(STR1, STR2) \ ASSERT_EQ(strcmp(STR1, STR2), 0) \ -namespace bf = boost::filesystem; namespace ci = common_installer; +namespace fs = std::filesystem; namespace { @@ -67,7 +66,7 @@ class StepParseRunner { context_.reset(new ci::InstallerContext()); context_->root_application_path.set(ci::GetRootAppPath(false, getuid())); context_->unpacked_dir_path.set( - bf::path(kManifestTestcaseData) / dir_suffix_); + fs::path(kManifestTestcaseData) / dir_suffix_); context_->backend_data.set(new wgt::WgtBackendData()); } @@ -276,7 +275,7 @@ TEST_F(ManifestTest, AppDefinedPrivilegeElement_WithLicenseValidName) { const char* expected_name = "http://package0id/appdefined/test.read"; ASSERT_CSTR_EQ(priv_vec[0].c_str(), expected_name); ASSERT_FALSE(license_vec.empty()); - bf::path path(m->root_path); + fs::path path(m->root_path); path /= "res/cert"; ASSERT_CSTR_EQ(license_vec[0].c_str(), path.c_str()); } @@ -299,7 +298,7 @@ TEST_F(ManifestTest, AppDefinedPrivilegeElement_WithLicenseManyElements) { const char* second_priv = "http://package0id/appdefined/test.write"; ASSERT_CSTR_EQ(priv_vec[1].c_str(), second_priv); ASSERT_EQ(license_vec.size(), 2); - bf::path path(m->root_path); + fs::path path(m->root_path); path /= "res/cert"; ASSERT_CSTR_EQ(license_vec[0].c_str(), path.c_str()); ASSERT_CSTR_EQ(license_vec[1].c_str(), path.c_str()); @@ -378,7 +377,7 @@ TEST_F(ManifestTest, ProvidesAppDefinedPrivilegeElement_WithLicenseValidName) { const char* expected_name = "http://package0id/appdefined/test.read"; ASSERT_CSTR_EQ(priv_vec[0].c_str(), expected_name); ASSERT_FALSE(license_vec.empty()); - bf::path path(m->root_path); + fs::path path(m->root_path); path /= "res/cert"; ASSERT_CSTR_EQ(license_vec[0].c_str(), path.c_str()); } @@ -402,7 +401,7 @@ TEST_F(ManifestTest, const char* second_priv = "http://package0id/appdefined/test.write"; ASSERT_CSTR_EQ(priv_vec[1].c_str(), second_priv); ASSERT_EQ(license_vec.size(), 2); - bf::path path(m->root_path); + fs::path path(m->root_path); path /= "res/cert"; ASSERT_CSTR_EQ(license_vec[0].c_str(), path.c_str()); ASSERT_CSTR_EQ(license_vec[1].c_str(), path.c_str()); diff --git a/test/smoke_tests/smoke_test.cc b/test/smoke_tests/smoke_test.cc index 4f81d90..1507129 100644 --- a/test/smoke_tests/smoke_test.cc +++ b/test/smoke_tests/smoke_test.cc @@ -9,15 +9,14 @@ #include #include +#include #include #include "smoke_tests/wgt_smoke_utils.h" -namespace st = smoke_test; -namespace bf = boost::filesystem; -namespace bs = boost::system; namespace ci = common_installer; -namespace bo = boost::program_options; +namespace fs = std::filesystem; +namespace st = smoke_test; namespace smoke_test { @@ -49,7 +48,7 @@ class SmokeEnvironment : public testing::Environment { private: ci::RequestMode request_mode_; - std::vector backups_; + std::vector backups_; }; } // namespace smoke_test @@ -139,7 +138,7 @@ class HybridPreloadSmokeTest : public testing::Test { }; TEST_F(SmokeTest, InstallationMode) { - bf::path path = kSmokePackagesDirectory / "InstallationMode.wgt"; + fs::path path = kSmokePackagesDirectory / "InstallationMode.wgt"; std::string pkgid = "smokewgt03"; std::string appid = "smokewgt03.InstallationMode"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); @@ -147,8 +146,8 @@ TEST_F(SmokeTest, InstallationMode) { } TEST_F(SmokeTest, UpdateMode) { - bf::path path_old = kSmokePackagesDirectory / "UpdateMode.wgt"; - bf::path path_new = kSmokePackagesDirectory / "UpdateMode_2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "UpdateMode.wgt"; + fs::path path_new = kSmokePackagesDirectory / "UpdateMode_2.wgt"; std::string pkgid = "smokewgt04"; std::string appid = "smokewgt04.UpdateMode"; ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK); @@ -162,7 +161,7 @@ TEST_F(SmokeTest, UpdateMode) { } TEST_F(SmokeTest, DeinstallationMode) { - bf::path path = kSmokePackagesDirectory / "DeinstallationMode.wgt"; + fs::path path = kSmokePackagesDirectory / "DeinstallationMode.wgt"; std::string pkgid = "smokewgt05"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); ASSERT_EQ(backend.Uninstall(pkgid), ci::AppInstaller::Result::OK); @@ -170,26 +169,26 @@ TEST_F(SmokeTest, DeinstallationMode) { } TEST_F(SmokeTest, RDSMode) { - bf::path path = kSmokePackagesDirectory / "RDSMode.wgt"; + fs::path path = kSmokePackagesDirectory / "RDSMode.wgt"; std::string pkgid = "smokewgt11"; std::string appid = "smokewgt11.RDSMode"; - bf::path delta_directory = kSmokePackagesDirectory / "delta_dir"; - bf::path sdk_expected_directory = kSdkDirectory / "tmp" / pkgid; + fs::path delta_directory = kSmokePackagesDirectory / "delta_dir"; + fs::path sdk_expected_directory = kSdkDirectory / "tmp" / pkgid; ASSERT_TRUE(ci::CopyDir(delta_directory, sdk_expected_directory)); ASSERT_EQ(backend.RDSUpdate(path, pkgid), ci::AppInstaller::Result::OK); ASSERT_TRUE(ValidatePackage(pkgid, {appid}, params)); // Check delta modifications - ASSERT_FALSE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_FALSE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res" / "wgt" / "DELETED")); - ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res" / "wgt" / "ADDED")); ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "2\n", params)); } TEST_F(SmokeTest, EnablePkg) { - bf::path path = kSmokePackagesDirectory / "EnablePkg.wgt"; + fs::path path = kSmokePackagesDirectory / "EnablePkg.wgt"; std::string pkgid = "smokewgt22"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); ASSERT_EQ(backend.DisablePackage(pkgid), ci::AppInstaller::Result::OK); @@ -201,7 +200,7 @@ TEST_F(SmokeTest, EnablePkg) { } TEST_F(SmokeTest, DisablePkg) { - bf::path path = kSmokePackagesDirectory / "DisablePkg.wgt"; + fs::path path = kSmokePackagesDirectory / "DisablePkg.wgt"; std::string pkgid = "smokewgt21"; std::string appid = "smokewgt21.DisablePkg"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); @@ -211,8 +210,8 @@ TEST_F(SmokeTest, DisablePkg) { } TEST_F(SmokeTest, DeltaMode) { - bf::path path = kSmokePackagesDirectory / "DeltaMode.wgt"; - bf::path delta_package = kSmokePackagesDirectory / "DeltaMode.delta"; + fs::path path = kSmokePackagesDirectory / "DeltaMode.wgt"; + fs::path delta_package = kSmokePackagesDirectory / "DeltaMode.delta"; std::string pkgid = "smokewgt17"; std::string appid = "smokewgt17.DeltaMode"; ASSERT_EQ(backend.InstallSuccess(path), ci::AppInstaller::Result::OK); @@ -220,29 +219,29 @@ TEST_F(SmokeTest, DeltaMode) { ASSERT_TRUE(ValidatePackage(pkgid, {appid}, params)); // Check delta modifications - ASSERT_FALSE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_FALSE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res" / "wgt" / "DELETED")); - ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res" / "wgt" / "ADDED")); - ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res" / "wgt" / "css" / "style.css")); - ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res" / "wgt" / "images" / "tizen_32.png")); - ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res" / "wgt" / "js" / "main.js")); ASSERT_TRUE(ValidateFileContentInPackage( pkgid, "res/wgt/MODIFIED", "version 2\n", params)); } TEST_F(SmokeTest, RecoveryMode_ForInstallation) { - bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt"; + fs::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt"; 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); std::string pkgid = "smokewgt09"; - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); @@ -250,8 +249,8 @@ TEST_F(SmokeTest, RecoveryMode_ForInstallation) { } TEST_F(SmokeTest, RecoveryMode_ForUpdate) { - bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForUpdate.wgt"; - bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForUpdate_2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForUpdate.wgt"; + fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForUpdate_2.wgt"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK); std::string pkgid = "smokewgt10"; @@ -262,7 +261,7 @@ TEST_F(SmokeTest, RecoveryMode_ForUpdate) { backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str()); ASSERT_NE(backend_crash.Wait(), 0); - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); @@ -274,8 +273,8 @@ TEST_F(SmokeTest, RecoveryMode_ForUpdate) { } TEST_F(SmokeTest, RecoveryMode_ForDelta) { - bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.wgt"; - bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta"; + fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.wgt"; + fs::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-installer-ut/smoke-test-helper"); @@ -285,7 +284,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { std::string pkgid = "smokewgt30"; std::string appid = "smokewgt30.RecoveryModeForDelta"; - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); @@ -296,7 +295,7 @@ TEST_F(SmokeTest, RecoveryMode_ForDelta) { } TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { - bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt"; + fs::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper"); std::string test_uid_str = std::to_string(params.test_user.uid); @@ -304,7 +303,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { ASSERT_NE(backend_crash.Wait(), 0); std::string pkgid = "smokewgt31"; - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); @@ -312,9 +311,9 @@ TEST_F(SmokeTest, RecoveryMode_ForMountInstall) { } TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { - bf::path path_old = + fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate.wgt"; - bf::path path_new = + fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate_2.wgt"; std::string pkgid = "smokewgt32"; std::string appid = "smokewgt32.RecoveryModeForMountUpdate"; @@ -331,7 +330,7 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { ScopedTzipInterface poweroff_unmount_interface(pkgid, params.test_user.uid); poweroff_unmount_interface.Release(); - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); @@ -345,26 +344,26 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) { TEST_F(SmokeTest, InstallationMode_GoodSignature) { // pkgid: smokewgt08 - bf::path path = kSmokePackagesDirectory / "InstallationMode_GoodSignature.wgt"; // NOLINT + fs::path path = kSmokePackagesDirectory / "InstallationMode_GoodSignature.wgt"; // NOLINT ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); } TEST_F(SmokeTest, InstallationMode_WrongSignature) { // pkgid: smokewgt12 - bf::path path = kSmokePackagesDirectory / "InstallationMode_WrongSignature.wgt"; // NOLINT + fs::path path = kSmokePackagesDirectory / "InstallationMode_WrongSignature.wgt"; // NOLINT ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR); } TEST_F(RollbackSmokeTest, InstallationMode) { - bf::path path = kSmokePackagesDirectory / "InstallationMode_Rollback.wgt"; + fs::path path = kSmokePackagesDirectory / "InstallationMode_Rollback.wgt"; std::string pkgid = "smokewgt06"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR); ASSERT_TRUE(CheckPackageNonExistance(pkgid, params)); } TEST_F(RollbackSmokeTest, UpdateMode) { - bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback.wgt"; - bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback.wgt"; + fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_2.wgt"; std::string pkgid = "smokewgt07"; std::string appid = "smokewgt07.UpdateModeRollback"; ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK); @@ -378,8 +377,8 @@ TEST_F(RollbackSmokeTest, UpdateMode) { } TEST_F(RollbackSmokeTest, DeltaMode) { - bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt"; - bf::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta"; + fs::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt"; + fs::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta"; std::string pkgid = "smokewgt01"; std::string appid = "smokewgt01.DeltaMode"; ASSERT_EQ(backend.InstallSuccess(path), ci::AppInstaller::Result::OK); @@ -390,14 +389,14 @@ TEST_F(RollbackSmokeTest, DeltaMode) { ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "version 1\n", params)); ASSERT_TRUE(ValidateDataFiles(pkgid, params.test_user.uid)); - ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res/wgt/DELETED")); - ASSERT_FALSE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) / + ASSERT_FALSE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) / "res/wgt/ADDED")); } TEST_F(HybridSmokeTest, InstallationMode) { - bf::path path = kSmokePackagesDirectory / "InstallationMode_Hybrid.wgt"; + fs::path path = kSmokePackagesDirectory / "InstallationMode_Hybrid.wgt"; std::string pkgid = "smokehyb01"; // Excutable for native app doesn't create symlink std::string appid1 = "smokehyb01.Web"; @@ -406,8 +405,8 @@ TEST_F(HybridSmokeTest, InstallationMode) { } TEST_F(HybridSmokeTest, UpdateMode) { - bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Hybrid.wgt"; - bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Hybrid_2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Hybrid.wgt"; + fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Hybrid_2.wgt"; std::string pkgid = "smokehyb02"; std::string appid1 = "smokehyb02.Web"; ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK); @@ -423,7 +422,7 @@ TEST_F(HybridSmokeTest, UpdateMode) { } TEST_F(HybridSmokeTest, DeinstallationMode) { - bf::path path = kSmokePackagesDirectory / "DeinstallationMode_Hybrid.wgt"; + fs::path path = kSmokePackagesDirectory / "DeinstallationMode_Hybrid.wgt"; std::string pkgid = "smokehyb03"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); ASSERT_EQ(backend.Uninstall(pkgid), ci::AppInstaller::Result::OK); @@ -431,8 +430,8 @@ TEST_F(HybridSmokeTest, DeinstallationMode) { } TEST_F(HybridSmokeTest, DeltaMode) { - bf::path path = kSmokePackagesDirectory / "DeltaMode_Hybrid.wgt"; - bf::path delta_package = kSmokePackagesDirectory / "DeltaMode_Hybrid.delta"; + fs::path path = kSmokePackagesDirectory / "DeltaMode_Hybrid.wgt"; + fs::path delta_package = kSmokePackagesDirectory / "DeltaMode_Hybrid.delta"; std::string pkgid = "smokehyb04"; std::string appid1 = "smokehyb04.Web"; ASSERT_EQ(backend.InstallSuccess(path), ci::AppInstaller::Result::OK); @@ -440,20 +439,20 @@ TEST_F(HybridSmokeTest, DeltaMode) { ASSERT_TRUE(ValidatePackage(pkgid, {appid1}, params)); // Check delta modifications - bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid); - ASSERT_FALSE(bf::exists(root_path / pkgid / "res" / "wgt" / "DELETED")); - ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "ADDED")); - ASSERT_FALSE(bf::exists(root_path / pkgid / "lib" / "DELETED")); - ASSERT_TRUE(bf::exists(root_path / pkgid / "lib" / "ADDED")); - ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "css" / "style.css")); // NOLINT - ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "images" / "tizen_32.png")); // NOLINT - ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "js" / "main.js")); + fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid); + ASSERT_FALSE(fs::exists(root_path / pkgid / "res" / "wgt" / "DELETED")); + ASSERT_TRUE(fs::exists(root_path / pkgid / "res" / "wgt" / "ADDED")); + ASSERT_FALSE(fs::exists(root_path / pkgid / "lib" / "DELETED")); + ASSERT_TRUE(fs::exists(root_path / pkgid / "lib" / "ADDED")); + ASSERT_TRUE(fs::exists(root_path / pkgid / "res" / "wgt" / "css" / "style.css")); // NOLINT + ASSERT_TRUE(fs::exists(root_path / pkgid / "res" / "wgt" / "images" / "tizen_32.png")); // NOLINT + ASSERT_TRUE(fs::exists(root_path / pkgid / "res" / "wgt" / "js" / "main.js")); ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "version 2\n", params)); // NOLINT ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "lib/MODIFIED", "version 2\n", params)); // NOLINT } TEST_F(HybridSmokeTest, MountInstallationMode) { - bf::path path = kSmokePackagesDirectory / "MountInstallationMode_Hybrid.wgt"; + fs::path path = kSmokePackagesDirectory / "MountInstallationMode_Hybrid.wgt"; std::string pkgid = "smokehyb05"; std::string appid1 = "smokehyb05.web"; ASSERT_EQ(backend.MountInstall(path), ci::AppInstaller::Result::OK); @@ -462,8 +461,8 @@ TEST_F(HybridSmokeTest, MountInstallationMode) { } TEST_F(HybridSmokeTest, MountUpdateMode) { - bf::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Hybrid.wgt"; - bf::path path_new = kSmokePackagesDirectory / "MountUpdateMode_Hybrid_2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Hybrid.wgt"; + fs::path path_new = kSmokePackagesDirectory / "MountUpdateMode_Hybrid_2.wgt"; std::string pkgid = "smokehyb06"; std::string appid1 = "smokehyb06.web"; ASSERT_EQ(backend.MountInstallSuccess(path_old), @@ -481,7 +480,7 @@ TEST_F(HybridSmokeTest, MountUpdateMode) { } TEST_F(RollbackHybridSmokeTest, InstallationMode) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "InstallationMode_Rollback_Hybrid.wgt"; std::string pkgid = "smokehyb07"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR); @@ -489,9 +488,9 @@ TEST_F(RollbackHybridSmokeTest, InstallationMode) { } TEST_F(RollbackHybridSmokeTest, UpdateMode) { - bf::path path_old = kSmokePackagesDirectory / + fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback_Hybrid.wgt"; - bf::path path_new = kSmokePackagesDirectory / + fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_Hybrid_2.wgt"; std::string pkgid = "smokehyb08"; std::string appid1 = "smokehyb08.web"; @@ -508,8 +507,8 @@ TEST_F(RollbackHybridSmokeTest, UpdateMode) { } TEST_F(RollbackHybridSmokeTest, DeltaMode) { - bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt"; - bf::path delta_package = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt"; + fs::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.delta"; std::string pkgid = "smokehyb11"; std::string appid1 = "smokehyb11.web"; @@ -520,11 +519,11 @@ TEST_F(RollbackHybridSmokeTest, DeltaMode) { ASSERT_TRUE(ValidatePackage(pkgid, {appid1}, params)); // Check delta modifications - bf::path root_path = GetPackageRoot(pkgid, params.test_user.uid); - ASSERT_TRUE(bf::exists(root_path / "res" / "wgt" / "DELETED")); - ASSERT_FALSE(bf::exists(root_path / "res" / "wgt" / "ADDED")); - ASSERT_TRUE(bf::exists(root_path / "lib" / "DELETED")); - ASSERT_FALSE(bf::exists(root_path / "lib" / "ADDED")); + fs::path root_path = GetPackageRoot(pkgid, params.test_user.uid); + ASSERT_TRUE(fs::exists(root_path / "res" / "wgt" / "DELETED")); + ASSERT_FALSE(fs::exists(root_path / "res" / "wgt" / "ADDED")); + ASSERT_TRUE(fs::exists(root_path / "lib" / "DELETED")); + ASSERT_FALSE(fs::exists(root_path / "lib" / "ADDED")); ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "version 1\n", params)); ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "lib/MODIFIED", @@ -533,7 +532,7 @@ TEST_F(RollbackHybridSmokeTest, DeltaMode) { } TEST_F(RollbackHybridSmokeTest, MountInstallationMode) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "MountInstallationMode_Rollback_Hybrid.wgt"; std::string pkgid = "smokehyb09"; ASSERT_EQ(backend.MountInstall(path), ci::AppInstaller::Result::ERROR); @@ -542,9 +541,9 @@ TEST_F(RollbackHybridSmokeTest, MountInstallationMode) { } TEST_F(RollbackHybridSmokeTest, MountUpdateMode) { - bf::path path_old = kSmokePackagesDirectory / + fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback_Hybrid.wgt"; - bf::path path_new = kSmokePackagesDirectory / + fs::path path_new = kSmokePackagesDirectory / "MountUpdateMode_Rollback_Hybrid_2.wgt"; std::string pkgid = "smokehyb10"; std::string appid1 = "smokehyb10.web"; @@ -563,7 +562,7 @@ TEST_F(RollbackHybridSmokeTest, MountUpdateMode) { } TEST_F(SmokeTest, MountInstallationMode) { - bf::path path = kSmokePackagesDirectory / "MountInstallationMode.wgt"; + fs::path path = kSmokePackagesDirectory / "MountInstallationMode.wgt"; std::string pkgid = "smokewgt28"; std::string appid = "smokewgt28.InstallationMode"; ASSERT_EQ(backend.MountInstall(path), ci::AppInstaller::Result::OK); @@ -572,8 +571,8 @@ TEST_F(SmokeTest, MountInstallationMode) { } TEST_F(SmokeTest, MountUpdateMode) { - bf::path path_old = kSmokePackagesDirectory / "MountUpdateMode.wgt"; - bf::path path_new = kSmokePackagesDirectory / "MountUpdateMode_2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode.wgt"; + fs::path path_new = kSmokePackagesDirectory / "MountUpdateMode_2.wgt"; std::string pkgid = "smokewgt29"; std::string appid = "smokewgt29.UpdateMode"; ASSERT_EQ(backend.MountInstallSuccess(path_old), @@ -589,7 +588,7 @@ TEST_F(SmokeTest, MountUpdateMode) { } TEST_F(RollbackSmokeTest, MountInstallationMode) { - bf::path path = + fs::path path = kSmokePackagesDirectory / "MountInstallationMode_Rollback.wgt"; std::string pkgid = "smokewgt33"; ASSERT_EQ(backend.MountInstall(path), ci::AppInstaller::Result::ERROR); @@ -598,8 +597,8 @@ TEST_F(RollbackSmokeTest, MountInstallationMode) { } TEST_F(RollbackSmokeTest, MountUpdateMode) { - bf::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback.wgt"; - bf::path path_new = + fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback.wgt"; + fs::path path_new = kSmokePackagesDirectory / "MountUpdateMode_Rollback_2.wgt"; std::string pkgid = "smokewgt34"; std::string appid = "smokewgt34.web"; @@ -616,7 +615,7 @@ TEST_F(RollbackSmokeTest, MountUpdateMode) { } TEST_F(SmokeTest, UserDefinedPlugins) { - bf::path path = kSmokePackagesDirectory / "SimpleEchoPrivilege.wgt"; + fs::path path = kSmokePackagesDirectory / "SimpleEchoPrivilege.wgt"; std::string pkgid = "smokewgt02"; std::string appid = "smokewgt02.SimpleEcho"; std::string call_privilege = "http://tizen.org/privilege/call"; @@ -636,7 +635,7 @@ TEST_F(SmokeTest, UserDefinedPlugins) { TEST_F(SmokeTest, InstallExternalMode) { ASSERT_TRUE(CheckAvailableExternalPath()); - bf::path path = kSmokePackagesDirectory / "InstallExternalMode.wgt"; + fs::path path = kSmokePackagesDirectory / "InstallExternalMode.wgt"; std::string pkgid = "smokewgt35"; std::string appid = "smokewgt35.web"; ASSERT_EQ(backend.InstallWithStorage(path, StorageType::EXTERNAL), @@ -646,11 +645,11 @@ TEST_F(SmokeTest, InstallExternalMode) { TEST_F(SmokeTest, MigrateLegacyExternalImageMode) { ASSERT_TRUE(CheckAvailableExternalPath()); - bf::path path = + fs::path path = kSmokePackagesDirectory / "MigrateLegacyExternalImageMode.wgt"; std::string pkgid = "smokewgt36"; std::string appid = "smokewgt36.web"; - bf::path legacy_path = kSmokePackagesDirectory / kLegacyExtImageDir; + fs::path legacy_path = kSmokePackagesDirectory / kLegacyExtImageDir; std::string test_uid_str = std::to_string(params.test_user.uid); if (test_uid_str == kDefaultUserIdStr || params.test_user.uid == kGlobalUserUid) { @@ -665,7 +664,7 @@ TEST_F(SmokeTest, MigrateLegacyExternalImageMode) { TEST_F(PreloadSmokeTest, InstallationMode) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path path = kSmokePackagesDirectory / "InstallationMode_Preload.wgt"; + fs::path path = kSmokePackagesDirectory / "InstallationMode_Preload.wgt"; std::string pkgid = "smokewgt37"; std::string appid = "smokewgt37.InstallationModePreload"; ASSERT_EQ(backend.InstallPreload(path), ci::AppInstaller::Result::OK); @@ -674,8 +673,8 @@ TEST_F(PreloadSmokeTest, InstallationMode) { TEST_F(PreloadSmokeTest, UpdateMode) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Preload.wgt"; - bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Preload2.wgt"; + fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Preload.wgt"; + fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Preload2.wgt"; std::string pkgid = "smokewgt38"; std::string appid = "smokewgt38.UpdateModePreload"; ASSERT_EQ(backend.InstallPreload(path_old), ci::AppInstaller::Result::OK); @@ -690,7 +689,7 @@ TEST_F(PreloadSmokeTest, UpdateMode) { TEST_F(PreloadSmokeTest, DeinstallationMode) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path path = kSmokePackagesDirectory / "DeinstallationMode_Preload.wgt"; + fs::path path = kSmokePackagesDirectory / "DeinstallationMode_Preload.wgt"; std::string pkgid = "smokewgt39"; ASSERT_EQ(backend.InstallPreload(path), ci::AppInstaller::Result::OK); ASSERT_EQ(backend.UninstallPreload(pkgid), ci::AppInstaller::Result::OK); @@ -699,10 +698,10 @@ TEST_F(PreloadSmokeTest, DeinstallationMode) { TEST_F(SmokeTest, ManifestDirectInstallMode) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path src_path = kSmokePackagesDirectory / "ManifestDirectInstallMode"; + fs::path src_path = kSmokePackagesDirectory / "ManifestDirectInstallMode"; std::string pkgid = "smokewgt40"; std::string appid = "smokewgt40.ManifestDirectInstallMode"; - bf::path pkg_path = ci::GetRootAppPath(false, params.test_user.uid); + fs::path pkg_path = ci::GetRootAppPath(false, params.test_user.uid); ci::CopyDir(src_path / pkgid, pkg_path / pkgid); ci::PkgQueryInterface pkg_query(pkgid, params.test_user.uid); @@ -714,7 +713,7 @@ TEST_F(SmokeTest, ManifestDirectInstallMode) { } TEST_F(SmokeTest, ManifestDirectUpdateMode) { - bf::path path = kSmokePackagesDirectory / "ManifestDirectUpdateMode.wgt"; + fs::path path = kSmokePackagesDirectory / "ManifestDirectUpdateMode.wgt"; std::string pkgid = "smokewgt41"; std::string appid = "smokewgt41.ManifestDirectUpdateMode"; @@ -731,7 +730,7 @@ TEST_F(SmokeTest, ManifestDirectUpdateMode) { TEST_F(PreloadSmokeTest, ReadonlyUpdateInstallMode) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path path = kSmokePackagesDirectory / "ReadonlyUpdateInstallMode.wgt"; + fs::path path = kSmokePackagesDirectory / "ReadonlyUpdateInstallMode.wgt"; std::string pkgid = "smokewgt42"; std::string appid = "smokewgt42.ReadonlyUpdateInstallMode"; @@ -742,7 +741,7 @@ TEST_F(PreloadSmokeTest, ReadonlyUpdateInstallMode) { TEST_F(PreloadSmokeTest, ReadonlyUpdateUninstallMode) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path path = kSmokePackagesDirectory / "ReadonlyUpdateUninstallMode.wgt"; + fs::path path = kSmokePackagesDirectory / "ReadonlyUpdateUninstallMode.wgt"; std::string pkgid = "smokewgt43"; std::string appid = "smokewgt43.ReadonlyUpdateUninstallMode"; @@ -756,11 +755,11 @@ TEST_F(PreloadSmokeTest, ReadonlyUpdateUninstallMode) { TEST_F(HybridSmokeTest, ManifestDirectInstallMode) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path src_path = kSmokePackagesDirectory / + fs::path src_path = kSmokePackagesDirectory / "ManifestDirectInstallMode_Hybrid"; std::string pkgid = "smokehyb12"; std::string appid = "smokehyb12.ManifestDirectInstallModeHybrid"; - bf::path pkg_path = ci::GetRootAppPath(false, params.test_user.uid); + fs::path pkg_path = ci::GetRootAppPath(false, params.test_user.uid); ci::CopyDir(src_path / pkgid, pkg_path / pkgid); ci::PkgQueryInterface pkg_query(pkgid, params.test_user.uid); @@ -772,7 +771,7 @@ TEST_F(HybridSmokeTest, ManifestDirectInstallMode) { } TEST_F(HybridSmokeTest, ManifestDirectUpdateMode) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "ManifestDirectUpdateMode_Hybrid.wgt"; std::string pkgid = "smokehyb13"; std::string appid = "smokehyb13.ManifestDirectUpdateModeHybrid"; @@ -788,59 +787,59 @@ TEST_F(HybridSmokeTest, ManifestDirectUpdateMode) { } TEST_F(SmokeTest, SharedRes24) { - bf::path path = kSmokePackagesDirectory / "SharedRes24.wgt"; + fs::path path = kSmokePackagesDirectory / "SharedRes24.wgt"; std::string pkgid = "smokeSh2xx"; std::string appid = "smokeSh2xx.SharedRes24"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); ValidatePackage(pkgid, {appid}, params); - bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid); - ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "NOT-SHARED-WGT")); // NOLINT - ASSERT_FALSE(bf::exists(root_path / pkgid / "shared" / "res" / "NOT-SHARED-WGT")); // NOLINT + fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid); + ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "NOT-SHARED-WGT")); // NOLINT + ASSERT_FALSE(fs::exists(root_path / pkgid / "shared" / "res" / "NOT-SHARED-WGT")); // NOLINT } TEST_F(SmokeTest, SharedRes30) { - bf::path path = kSmokePackagesDirectory / "SharedRes30.wgt"; + fs::path path = kSmokePackagesDirectory / "SharedRes30.wgt"; std::string pkgid = "smokeSh3xx"; std::string appid = "smokeSh3xx.SharedRes30"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); ASSERT_TRUE(ValidatePackage(pkgid, {appid}, params)); - bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid); - ASSERT_TRUE(bf::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT")); // NOLINT - ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT")); // NOLINT + fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid); + ASSERT_TRUE(fs::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT")); // NOLINT + ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT")); // NOLINT } TEST_F(SmokeTest, SharedRes30Delta) { - bf::path path = kSmokePackagesDirectory / "SharedRes30Delta.wgt"; - bf::path delta_package = kSmokePackagesDirectory / "SharedRes30Delta.delta"; + fs::path path = kSmokePackagesDirectory / "SharedRes30Delta.wgt"; + fs::path delta_package = kSmokePackagesDirectory / "SharedRes30Delta.delta"; std::string pkgid = "smokeSh3De"; std::string appid = "smokeSh3De.SharedRes30Delta"; ASSERT_EQ(backend.InstallSuccess(path), ci::AppInstaller::Result::OK); ASSERT_EQ(backend.Install(delta_package), ci::AppInstaller::Result::OK); ASSERT_TRUE(ValidatePackage(pkgid, {appid}, params)); // Check delta modifications - bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid); - ASSERT_TRUE(bf::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-2")); // NOLINT - ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT-2")); // NOLINT - ASSERT_FALSE(bf::exists(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-1")); // NOLINT - ASSERT_FALSE(bf::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT + fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid); + ASSERT_TRUE(fs::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-2")); // NOLINT + ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT-2")); // NOLINT + ASSERT_FALSE(fs::exists(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-1")); // NOLINT + ASSERT_FALSE(fs::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT } TEST_F(HybridSmokeTest, SharedRes30Hybrid) { - bf::path path = kSmokePackagesDirectory / "SharedRes30Hybrid.wgt"; + fs::path path = kSmokePackagesDirectory / "SharedRes30Hybrid.wgt"; std::string pkgid = "smokeSh3Hy"; std::string appid1 = "smokeSh3Hy.SharedRes30Hybrid"; std::string appid2 = "sharedres30hybridserivce"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK); ASSERT_TRUE(ValidatePackage(pkgid, {appid1, appid2}, params)); - bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid); - ASSERT_TRUE(bf::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT")); // NOLINT - ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT")); // NOLINT - ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-TPK")); // NOLINT + fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid); + ASSERT_TRUE(fs::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT")); // NOLINT + ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT")); // NOLINT + ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-TPK")); // NOLINT } TEST_F(HybridSmokeTest, SharedRes30HybridDelta) { - bf::path path = kSmokePackagesDirectory / "SharedRes30HybridDelta.wgt"; - bf::path delta_package = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "SharedRes30HybridDelta.wgt"; + fs::path delta_package = kSmokePackagesDirectory / "SharedRes30HybridDelta.delta"; std::string pkgid = "smokeSh3HD"; std::string appid1 = "smokeSh3HD.SharedRes30HybridDelta"; @@ -849,17 +848,17 @@ TEST_F(HybridSmokeTest, SharedRes30HybridDelta) { ASSERT_EQ(backend.Install(delta_package), ci::AppInstaller::Result::OK); ASSERT_TRUE(ValidatePackage(pkgid, {appid1, appid2}, params)); // Check delta modifications - bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid); - ASSERT_TRUE(bf::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-2")); // NOLINT - ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT-2")); // NOLINT - ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-TPK-2")); // NOLINT - ASSERT_FALSE(bf::exists(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-1")); // NOLINT - ASSERT_FALSE(bf::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT + fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid); + ASSERT_TRUE(fs::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-2")); // NOLINT + ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT-2")); // NOLINT + ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-TPK-2")); // NOLINT + ASSERT_FALSE(fs::exists(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-1")); // NOLINT + ASSERT_FALSE(fs::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT } TEST_F(SmokeTest, InstallExtendedMode) { ASSERT_TRUE(CheckAvailableExtendedPath()); - bf::path path = kSmokePackagesDirectory / "InstallExtendedMode.wgt"; + fs::path path = kSmokePackagesDirectory / "InstallExtendedMode.wgt"; std::string pkgid = "smokewgt44"; std::string appid = "smokewgt44.web"; ASSERT_EQ(backend.InstallWithStorage(path, StorageType::EXTENDED), @@ -868,7 +867,7 @@ TEST_F(SmokeTest, InstallExtendedMode) { } TEST_F(SmokeTest, RecoveryMode_CrashAfterUnzip) { - bf::path path = kSmokePackagesDirectory / "RecoveryMode_CrashAfterUnzip.wgt"; + fs::path path = kSmokePackagesDirectory / "RecoveryMode_CrashAfterUnzip.wgt"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper"); std::string test_uid_str = std::to_string(params.test_user.uid); @@ -877,7 +876,7 @@ TEST_F(SmokeTest, RecoveryMode_CrashAfterUnzip) { ASSERT_NE(backend_crash.Wait(), 0); std::string pkgid = "smokewgt45"; - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); std::unique_ptr recovery_info = @@ -885,11 +884,11 @@ TEST_F(SmokeTest, RecoveryMode_CrashAfterUnzip) { ASSERT_TRUE(recovery_info ? true : false); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); ASSERT_TRUE(CheckPackageNonExistance(pkgid, params)); - ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir())); + ASSERT_FALSE(fs::exists(recovery_info->unpacked_dir())); } TEST_F(SmokeTest, InstallationMode_GlobalServiceAppWithUiAppId) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "InstallationMode_GlobalServiceAppWithUiAppId.wgt"; std::string pkgid = "smokewgt46"; std::string ui_appid = "smokewgt46.uiapp"; @@ -899,7 +898,7 @@ TEST_F(SmokeTest, InstallationMode_GlobalServiceAppWithUiAppId) { } TEST_F(SmokeTest, InstallationMode_GlobalServiceAppWithoutUiAppId) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "InstallationMode_GlobalServiceAppWithoutUiAppId.wgt"; std::string pkgid = "smokewgt47"; std::string service_appid = "smokewgt47.serviceapp"; @@ -908,7 +907,7 @@ TEST_F(SmokeTest, InstallationMode_GlobalServiceAppWithoutUiAppId) { } TEST_F(SmokeTest, InstallationMode_UIServiceAppWithUiAppId) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "InstallationMode_UIServiceAppWithUiAppId.wgt"; std::string pkgid = "smokewgt48"; std::string ui_appid = "smokewgt48.uiapp"; @@ -918,14 +917,14 @@ TEST_F(SmokeTest, InstallationMode_UIServiceAppWithUiAppId) { } TEST_F(SmokeTest, InstallationMode_UIServiceAppWithoutUiAppId) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "InstallationMode_UIServiceAppWithoutUiAppId.wgt"; std::string pkgid = "smokewgt49"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR); } TEST_F(SmokeTest, InstallationMode_UIAppWithoutUiAppId) { - bf::path path = kSmokePackagesDirectory / + fs::path path = kSmokePackagesDirectory / "InstallationMode_UIAppWithoutUiAppId.wgt"; std::string pkgid = "smokewgt50"; ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR); @@ -933,9 +932,9 @@ TEST_F(SmokeTest, InstallationMode_UIAppWithoutUiAppId) { TEST_F(PreloadSmokeTest, RecoveryMode_ForReadonlyUpdateInstall) { ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user"; - bf::path path_old = kSmokePackagesDirectory / + fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForReadonlyUpdateInstall.wgt"; - bf::path path_new = kSmokePackagesDirectory / + fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForReadonlyUpdateInstall_2.wgt"; RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid); ASSERT_EQ(backend.InstallPreload(path_old), ci::AppInstaller::Result::OK); @@ -947,7 +946,7 @@ TEST_F(PreloadSmokeTest, RecoveryMode_ForReadonlyUpdateInstall) { backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str()); ASSERT_NE(backend_crash.Wait(), 0); - bf::path recovery_file = FindRecoveryFile("/wgt-recovery", + fs::path recovery_file = FindRecoveryFile("/wgt-recovery", params.test_user.uid); ASSERT_FALSE(recovery_file.empty()); ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK); diff --git a/test/smoke_tests/wgt_smoke_utils.cc b/test/smoke_tests/wgt_smoke_utils.cc index a45bcc5..5e104b8 100644 --- a/test/smoke_tests/wgt_smoke_utils.cc +++ b/test/smoke_tests/wgt_smoke_utils.cc @@ -18,7 +18,7 @@ namespace st = smoke_test; namespace smoke_test { -const bf::path kSmokePackagesDirectory = +const fs::path kSmokePackagesDirectory = "/usr/share/wgt-installer-ut/test_samples/smoke/"; bool ValidatePackage(const std::string& pkgid, diff --git a/test/smoke_tests/wgt_smoke_utils.h b/test/smoke_tests/wgt_smoke_utils.h index e0a0453..a7c4dd7 100644 --- a/test/smoke_tests/wgt_smoke_utils.h +++ b/test/smoke_tests/wgt_smoke_utils.h @@ -32,7 +32,7 @@ bool ValidateExtendedPackage(const std::string& pkgid, const std::vector& appids, const TestParameters& params); -extern const bf::path kSmokePackagesDirectory; +extern const fs::path kSmokePackagesDirectory; class WgtBackendInterface: public BackendInterface { public: -- 2.7.4 From e3ddd240309a0a9fdc32c6400bd14812043e954f Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Fri, 16 Feb 2024 17:24:06 +0900 Subject: [PATCH 13/16] Release version 0.15.38 Changes: - Remove boost dependency Change-Id: Ia76c9d96c2616643581ff1a3f2448cdf6039bada 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 a254c7e..b83cc9a 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.37 +Version: 0.15.38 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 7160aaa4780692fd4ff48891e14c7ca73d9f2ccc Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Wed, 8 May 2024 14:45:27 +0900 Subject: [PATCH 14/16] Fix StepCheckOldCertificate Requires: [app-installers] https://review.tizen.org/gerrit/310778 Change-Id: Iac17e2982abb02709848ceeeb7a7ee4ef703c42c Signed-off-by: Ilho Kim --- src/wgt/wgt_installer.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 82f1e8d..24aa876 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -93,6 +94,8 @@ void WgtInstaller::UpdateSteps() { AppInstaller::UpdateSteps(); ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); + ReplaceStep("CheckOldCertificate", + "res/wgt/"); AddStepAfter("CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); AddStepAfter("PrivilegeCompatibility"); @@ -140,6 +143,8 @@ void WgtInstaller::DeltaSteps() { AppInstaller::DeltaSteps(); ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, false); + ReplaceStep("CheckOldCertificate", + "res/wgt/"); AddStepAfter( "EnableExternalMount"); ReplaceStep("DeltaPatch", "res/wgt/"); @@ -204,6 +209,8 @@ void WgtInstaller::MountUpdateSteps() { AppInstaller::MountUpdateSteps(); ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); + ReplaceStep("CheckOldCertificate", + "res/wgt/"); AddStepAfter("CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); AddStepAfter("PrivilegeCompatibility"); @@ -255,6 +262,8 @@ void WgtInstaller::ManifestDirectUpdateSteps() { ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); ReplaceStep("Signature", true); + ReplaceStep("CheckOldCertificate", + "res/wgt/"); AddStepAfter( "CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); @@ -276,6 +285,8 @@ void WgtInstaller::ReadonlyUpdateInstallSteps() { AppInstaller::ReadonlyUpdateInstallSteps(); ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); + ReplaceStep("CheckOldCertificate", + "res/wgt/"); AddStepAfter("CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); AddStepAfter("PrivilegeCompatibility"); @@ -339,6 +350,8 @@ void WgtInstaller::ManifestPartialUpdateSteps() { ReplaceStep("ParseManifest", wgt::configuration::StepParse::ConfigLocation::INSTALLED, true); ReplaceStep("Signature", false); + ReplaceStep("CheckOldCertificate", + "res/wgt/"); AddStepAfter( "CheckOldCertificate", ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT); -- 2.7.4 From b88fd9a71e53751389e3f0a6fa33477f230a0fed Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 11 Jun 2024 08:46:06 +0900 Subject: [PATCH 15/16] Add additional log for debug Change-Id: Id307e9b7799c9e6a57c5aa743104aa639ce39edb Signed-off-by: Ilho Kim --- src/lib/wgt_archive_info.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/wgt_archive_info.cc b/src/lib/wgt_archive_info.cc index 8f8b4a2..f134738 100644 --- a/src/lib/wgt_archive_info.cc +++ b/src/lib/wgt_archive_info.cc @@ -218,7 +218,7 @@ bool WgtArchiveInfo::LoadArchiveInfo() { else manifest_path = tmp_dir / kConfigFileName; if (!parser.ParseManifest(manifest_path)) { - LOG(ERROR) << "Failed to parse"; + LOG(ERROR) << "Failed to parse, " << parser.GetErrorMessage(); RemoveTmpDir(tmp_dir.string()); return false; } -- 2.7.4 From 5b09300c44be08bc596841946e2a3346bd13d12b Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Tue, 11 Jun 2024 09:53:53 +0900 Subject: [PATCH 16/16] Release version 0.15.39 Changes: - Fix StepCheckOldCertificate - Add additional log for debug Change-Id: Ie493491df6da3cd410db308e447a681c7c29cf75 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 b83cc9a..b55abf4 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.38 +Version: 0.15.39 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4