From 761a13058814f05500026601bbe67dcfd7aa8987 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Mon, 13 Jun 2016 15:51:02 +0900 Subject: [PATCH 01/16] set label to prevent execution by non-system application. Change-Id: I12e682b56fa142919ef1d6941d995b7874cab130 Signed-off-by: jongmyeongko --- packaging/wgt-backend.manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.manifest b/packaging/wgt-backend.manifest index 55125da..85f79f1 100644 --- a/packaging/wgt-backend.manifest +++ b/packaging/wgt-backend.manifest @@ -3,6 +3,6 @@ - + -- 2.7.4 From c487e4bf613524114db57876f33790a7a0b66a3d Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Mon, 13 Jun 2016 16:45:48 +0900 Subject: [PATCH 02/16] Add StepCheckRestriction Added at install, uninstall, reinstall, mount install. Change-Id: I85ff7e43ac8b9033654b116b436a0db04953572f Signed-off-by: Sangyoon Jang --- src/hybrid/hybrid_installer.cc | 4 ++++ src/wgt/wgt_installer.cc | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index c1765cc..b54c8e5 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -94,6 +95,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep( wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -167,6 +169,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) break; case ci::RequestType::Uninstall: AddStep(pkgmgr_); + AddStep(); AddStep(); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, @@ -264,6 +267,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep( wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 13176b2..11b7c9b 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -95,6 +96,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep( wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -163,6 +165,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) } case ci::RequestType::Uninstall: { AddStep(pkgmgr_); + AddStep(); AddStep(); AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, @@ -186,6 +189,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(pkgmgr_); AddStep( wgt::configuration::StepParse::ConfigLocation::PACKAGE, false); + AddStep(); AddStep(); AddStep(); AddStep( @@ -269,6 +273,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep( wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); + AddStep(); AddStep(); AddStep(); AddStep(); -- 2.7.4 From 487c97263f921ed473549f6c6022827e50ff33f1 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Thu, 9 Jun 2016 11:30:12 +0900 Subject: [PATCH 03/16] Change the binary name.(widget-client => web-widget-runtime) Change-Id: If3da83217bd4e3739079689697a56b5454b714e0 --- src/wgt/step/filesystem/step_create_symbolic_link.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wgt/step/filesystem/step_create_symbolic_link.cc b/src/wgt/step/filesystem/step_create_symbolic_link.cc index bc94fe2..cbdbb7f 100644 --- a/src/wgt/step/filesystem/step_create_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_create_symbolic_link.cc @@ -23,7 +23,7 @@ namespace bs = boost::system; namespace { const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service"; -const char kWidgetClientBinaryPath[] = "/usr/bin/widget-client"; +const char kWebWidgetRuntimeBinaryPath[] = "/usr/bin/web-widget-runtime"; } // namespace @@ -48,7 +48,7 @@ bool StepCreateSymbolicLink::CreateSymlinksForApps() { } else if (strcmp(app->component_type, "watchapp") == 0) { bf::create_symlink(bf::path(WRT_LAUNCHER), exec_path, error); } else if (strcmp(app->component_type, "widgetapp") == 0) { - bf::create_symlink(kWidgetClientBinaryPath, exec_path, error); + bf::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error); } else { bf::create_symlink(kWrtServiceBinaryPath, exec_path, error); } -- 2.7.4 From 810e4243029550e4861625943e8bd949023097b8 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Thu, 16 Jun 2016 20:39:59 +0900 Subject: [PATCH 04/16] apply PIE option Change-Id: I7d3271747ff9be58b0f8a46637a8282000c59b3c Signed-off-by: jongmyeongko --- CMakeLists.txt | 23 ++++++++++++----------- src/hybrid/CMakeLists.txt | 1 + src/unit_tests/CMakeLists.txt | 6 +++--- src/wgt/CMakeLists.txt | 1 + src/wgt_backend/CMakeLists.txt | 2 ++ 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08858fa..20eafb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,13 +13,18 @@ IF(NOT CMAKE_BUILD_TYPE) ENDIF(NOT CMAKE_BUILD_TYPE) # Compiler flags -SET(CMAKE_C_FLAGS_PROFILING "-O2") -SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++11") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++11 -g") -SET(CMAKE_C_FLAGS_RELEASE "-O2 -g") -SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++11 -g") -SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++11 -g --coverage") +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_C_FLAGS_DEBUG "-O0 -g ${EXTRA_FLAGS}") +SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++11 -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}") + +# Linker flags +SET(EXTRA_LINKER_FLAGS "-Wl,--as-needed") +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LINKER_FLAGS}") # Targets SET(TARGET_LIBNAME_WGT "wgt-installer") @@ -30,10 +35,6 @@ SET(TARGET_SMOKE_TEST "smoke-test") SET(TARGET_SMOKE_TEST_HELPER "smoke-test-helper") SET(TARGET_MANIFEST_TEST "manifest-test") -ADD_DEFINITIONS("-Wall") -ADD_DEFINITIONS("-Wextra") -ADD_DEFINITIONS("-fPIE") -ADD_DEFINITIONS("-fPIC") ADD_DEFINITIONS("-DPROJECT_TAG=\"WGT_BACKEND\"") SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") diff --git a/src/hybrid/CMakeLists.txt b/src/hybrid/CMakeLists.txt index 72cc3d2..ccc7f4a 100644 --- a/src/hybrid/CMakeLists.txt +++ b/src/hybrid/CMakeLists.txt @@ -16,3 +16,4 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_HYBRID} PUBLIC # Target - in-package deps TARGET_LINK_LIBRARIES(${TARGET_LIBNAME_HYBRID} PRIVATE ${TARGET_LIBNAME_WGT}) +SET_TARGET_PROPERTIES(${TARGET_LIBNAME_HYBRID} PROPERTIES COMPILE_FLAGS "-fPIC") diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt index 7222f1e..3947045 100644 --- a/src/unit_tests/CMakeLists.txt +++ b/src/unit_tests/CMakeLists.txt @@ -29,9 +29,9 @@ APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC # FindGTest module do not sets all needed libraries in GTEST_LIBRARIES and # GTest main libraries is still missing, so additional linking of # GTEST_MAIN_LIBRARIES is needed. -target_link_libraries(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES}) -target_link_libraries(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_WGT}) -target_link_libraries(${TARGET_MANIFEST_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${GTEST_MAIN_LIBRARIES}) +TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES}) +TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_WGT}) +TARGET_LINK_LIBRARIES(${TARGET_MANIFEST_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${GTEST_MAIN_LIBRARIES}) INSTALL(TARGETS ${TARGET_SMOKE_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR}) INSTALL(TARGETS ${TARGET_SMOKE_TEST_HELPER} DESTINATION ${BINDIR}/${DESTINATION_DIR}) diff --git a/src/wgt/CMakeLists.txt b/src/wgt/CMakeLists.txt index ea51011..f45acc5 100644 --- a/src/wgt/CMakeLists.txt +++ b/src/wgt/CMakeLists.txt @@ -42,3 +42,4 @@ APPLY_PKG_CONFIG(${TARGET_LIBNAME_WGT} PUBLIC ENCRYPTION_DEPS Boost ) +SET_TARGET_PROPERTIES(${TARGET_LIBNAME_WGT} PROPERTIES COMPILE_FLAGS "-fPIC") diff --git a/src/wgt_backend/CMakeLists.txt b/src/wgt_backend/CMakeLists.txt index 54f886e..79807f6 100644 --- a/src/wgt_backend/CMakeLists.txt +++ b/src/wgt_backend/CMakeLists.txt @@ -6,6 +6,8 @@ TARGET_INCLUDE_DIRECTORIES(${TARGET_WGT_BACKEND} PUBLIC "${CMAKE_CURRENT_SOURCE_ # Target - in-package deps TARGET_LINK_LIBRARIES(${TARGET_WGT_BACKEND} PRIVATE ${TARGET_LIBNAME_WGT}) TARGET_LINK_LIBRARIES(${TARGET_WGT_BACKEND} PRIVATE ${TARGET_LIBNAME_HYBRID}) +SET_TARGET_PROPERTIES(${TARGET_WGT_BACKEND} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIE") +SET_TARGET_PROPERTIES(${TARGET_WGT_BACKEND} PROPERTIES LINK_FLAGS "-pie") # Install INSTALL(TARGETS ${TARGET_WGT_BACKEND} DESTINATION ${BINDIR}) -- 2.7.4 From e4076b741c3091c2bdebf422dbed000e2b4e59f2 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Fri, 10 Jun 2016 12:58:58 +0200 Subject: [PATCH 05/16] Implement move request for wgt-backend Check success of commands to verify: wgt-backend -i ${package} wgt-backend -m ${pkgid} -t 1 wgt-backend -m ${pkgid} -t 2 Change-Id: I72ef419c1b4c5f99b3477265a7549a53c5efa838 --- src/wgt/step/configuration/step_parse.cc | 1 + src/wgt/wgt_installer.cc | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index ee937d2..51c86ca 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -200,6 +200,7 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { manifest->appsetting = strdup("false"); manifest->nodisplay_setting = strdup("false"); manifest->preload = strdup("false"); + manifest->installed_storage = strdup("installed_internal"); // For wgt package use the long name for (auto& item : wgt_info->name_set()) { diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 11b7c9b..bfa2b4e 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -377,6 +378,16 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); break; } + case ci::RequestType::Move: { + AddStep(pkgmgr_); + AddStep( + ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, + ci::configuration::StepParseManifest::StoreLocation::NORMAL); + AddStep(); + AddStep(); + AddStep(); + break; + } default: { AddStep(); } -- 2.7.4 From 97105afe0264304db009f68f0e10333db77217af Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Mon, 13 Jun 2016 15:39:43 +0200 Subject: [PATCH 06/16] New use of tep steps For internal installation tep is removed with files removal. For external installation tep file must be removed from sd card. Requires: - https://review.tizen.org/gerrit/#/c/74068/ Submit together: - https://review.tizen.org/gerrit/#/c/74068/ - https://review.tizen.org/gerrit/#/c/74293/ - https://review.tizen.org/gerrit/#/c/74294/ Change-Id: I2457b1918d5cb8450c8d1f3f93d42bec77f65d5f --- src/hybrid/hybrid_installer.cc | 11 ++++++----- src/wgt/wgt_installer.cc | 12 +++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index b54c8e5..9b8be50 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -31,7 +31,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -44,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -151,8 +152,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -181,6 +181,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -221,6 +222,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -323,8 +325,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index bfa2b4e..7abd4e2 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -33,8 +33,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -47,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -149,8 +150,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -178,6 +178,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -199,6 +200,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); break; @@ -232,6 +234,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -323,8 +326,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); -- 2.7.4 From e82d90ac3087342e09f4dc5d81167aebb32c5119 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Wed, 25 May 2016 12:39:18 +0200 Subject: [PATCH 07/16] Fix StepParse for tizen:service icon According to 782d65d706b0bc46e12a2e041a9331893c788f6c icon path should be always set with full path. To verify: - install widget with tag and check shared/res/ for icons there should be one per tizen:service and one for widget itself. Change-Id: I58d61c447b88a70de34faabaff81c07133f4cfe4 --- src/wgt/step/configuration/step_parse.cc | 4 +++- src/wgt/step/filesystem/step_wgt_patch_icons.cc | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 51c86ca..5e1a677 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -343,8 +343,10 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { } if (!service_info.icon().empty()) { + bf::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))); - icon->text = strdup(service_info.icon().c_str()); + icon->text = strdup(icon_path.c_str()); icon->lang = strdup(DEFAULT_LOCALE); application->icon = g_list_append(application->icon, icon); } diff --git a/src/wgt/step/filesystem/step_wgt_patch_icons.cc b/src/wgt/step/filesystem/step_wgt_patch_icons.cc index d9a1827..5bcb229 100644 --- a/src/wgt/step/filesystem/step_wgt_patch_icons.cc +++ b/src/wgt/step/filesystem/step_wgt_patch_icons.cc @@ -13,10 +13,6 @@ namespace bf = boost::filesystem; namespace bs = boost::system; namespace ci = common_installer; -namespace { -const char kResWgt[] = "res/wgt"; -} // namespace - namespace wgt { namespace filesystem { -- 2.7.4 From c32ebaf7ea6c7b4e1593327e7b6bd3a156a32d10 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 22 Jun 2016 17:52:03 +0900 Subject: [PATCH 08/16] grant User label to wgt-backend Change-Id: I301c4e2c990a7c3aab377cf9435bb194d8d40868 Signed-off-by: jongmyeongko --- packaging/wgt-backend.manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.manifest b/packaging/wgt-backend.manifest index 85f79f1..18893ce 100644 --- a/packaging/wgt-backend.manifest +++ b/packaging/wgt-backend.manifest @@ -3,6 +3,6 @@ - + -- 2.7.4 From 6099c6684c9f61ffae80084671e6a023a41df03d Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Mon, 13 Jun 2016 16:06:10 +0200 Subject: [PATCH 09/16] Rename backup_paths.h to paths.h Submit together: - https://review.tizen.org/gerrit/74296 - https://review.tizen.org/gerrit/74297 - https://review.tizen.org/gerrit/74298 Change-Id: I9b679eebc05951df0e9c706c1495bf54a376fb9e --- src/unit_tests/smoke_test.cc | 2 +- src/wgt/step/configuration/step_parse.cc | 2 +- src/wgt/step/configuration/step_parse_recovery.cc | 2 +- src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc | 2 +- src/wgt/step/filesystem/step_wgt_update_package_directory.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 3ab430b..f150590 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 5e1a677..24c359b 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/wgt/step/configuration/step_parse_recovery.cc b/src/wgt/step/configuration/step_parse_recovery.cc index c01cb41..8ff406d 100644 --- a/src/wgt/step/configuration/step_parse_recovery.cc +++ b/src/wgt/step/configuration/step_parse_recovery.cc @@ -4,7 +4,7 @@ #include "wgt/step/configuration/step_parse_recovery.h" -#include +#include #include namespace { 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 fc4907b..a4e1d6a 100644 --- a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace bf = boost::filesystem; 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 0aadad5..17e07d9 100644 --- a/src/wgt/step/filesystem/step_wgt_update_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_update_package_directory.cc @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace bf = boost::filesystem; -- 2.7.4 From 5a036ff4525f485ee44cbc53e05452508a9cbe15 Mon Sep 17 00:00:00 2001 From: Piotr Ganicz Date: Tue, 21 Jun 2016 10:50:51 +0200 Subject: [PATCH 10/16] Refactoring StepParse Change-Id: Ib396f828909c4c114c82876b504c37bdb682a128 --- src/wgt/step/configuration/step_parse.cc | 134 +++++++++++++++---------------- src/wgt/step/configuration/step_parse.h | 11 ++- 2 files changed, 74 insertions(+), 71 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 24c359b..602df3f 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -82,6 +82,7 @@ void SetApplicationXDefaults(application_x* application) { application->submode = strdup("false"); application->support_disable = strdup("false"); application->ui_gadget = strdup("false"); + application->multiple = strdup("false"); } template @@ -94,7 +95,6 @@ void AppendLabel(T* root, const std::string& label, strdup(locale.c_str()) : strdup(DEFAULT_LOCALE); root->label = g_list_append(root->label, label_item); } - } // namespace namespace wgt { @@ -146,16 +146,16 @@ bool StepParse::FillInstallationInfo(manifest_x* manifest) { } bool StepParse::FillIconPaths(manifest_x* manifest) { - std::shared_ptr app_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenApplicationKey)); + auto app_info = + GetManifestDataForKey( + app_keys::kTizenApplicationKey); if (!app_info) { LOG(ERROR) << "Application info manifest data has not been found."; return false; } - std::shared_ptr icons_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kIconsKey)); + auto icons_info = + GetManifestDataForKey( + app_keys::kIconsKey); if (icons_info.get()) { for (auto& application_icon : icons_info->icons()) { icon_x* icon = reinterpret_cast (calloc(1, sizeof(icon_x))); @@ -170,9 +170,10 @@ bool StepParse::FillIconPaths(manifest_x* manifest) { } bool StepParse::FillWidgetInfo(manifest_x* manifest) { - std::shared_ptr wgt_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kWidgetKey)); + auto wgt_info = + GetManifestDataForKey( + app_keys::kWidgetKey); + if (!wgt_info.get()) { LOG(ERROR) << "Widget info manifest data has not been found."; return false; @@ -203,9 +204,9 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { manifest->installed_storage = strdup("installed_internal"); // For wgt package use the long name + application_x* app = + reinterpret_cast(manifest->application->data); for (auto& item : wgt_info->name_set()) { - application_x* app = - reinterpret_cast(manifest->application->data); AppendLabel(app, item.second, item.first); } @@ -219,10 +220,9 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { author->lang = strdup(DEFAULT_LOCALE); manifest->author = g_list_append(manifest->author, author); - std::shared_ptr settings_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenSettingKey)); + auto settings_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenSettingKey); if (settings_info) { switch (settings_info->install_location()) { case wgt::parse::SettingInfo::InstallLocation::AUTO: { @@ -246,18 +246,19 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { } bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { - std::shared_ptr app_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenApplicationKey)); + auto app_info = + GetManifestDataForKey( + app_keys::kTizenApplicationKey); if (!app_info) { LOG(ERROR) << "Application info manifest data has not been found."; return false; } bool has_watch_catergory = false; bool has_ime = false; - std::shared_ptr category_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenCategoryKey)); + auto category_info = + GetManifestDataForKey( + app_keys::kTizenCategoryKey); + if (category_info) { has_watch_catergory = std::find_if(category_info->categories.begin(), category_info->categories.end(), @@ -277,7 +278,6 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { application->component_type = has_watch_catergory ? strdup("watchapp") : strdup("uiapp"); application->mainapp = strdup("true"); - application->multiple = strdup("false"); application->appid = strdup(app_info->id().c_str()); application->nodisplay = has_ime ? strdup("true") : strdup("false"); application->taskmanage = has_ime ? strdup("false") : strdup("true"); @@ -304,7 +304,8 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { app_icon->lang = strdup(icon->lang); application->icon = g_list_append(application->icon, app_icon); } - manifest->application = g_list_append(manifest->application, application); + // guarantees that the main app will be at the begining of the list + manifest->application = g_list_insert(manifest->application, application, 0); manifest->package = strdup(app_info->package().c_str()); manifest->mainapp_id = strdup(app_info->id().c_str()); @@ -312,9 +313,9 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { } bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { - std::shared_ptr service_list = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenServiceKey)); + auto service_list = + GetManifestDataForKey( + app_keys::kTizenServiceKey); if (!service_list) return true; for (auto& service_info : service_list->services) { @@ -322,7 +323,6 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { (calloc(1, sizeof(application_x))); application->component_type = strdup("svcapp"); application->mainapp = strdup("false"); - application->multiple = strdup("false"); application->appid = strdup(service_info.id().c_str()); application->exec = strdup((context_->root_application_path.get() / manifest->package @@ -373,10 +373,9 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { } bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) { - std::shared_ptr appwidget_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenAppWidgetFullKey)); + auto appwidget_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenAppWidgetFullKey); if (!appwidget_info) return true; for (auto& app_widget : appwidget_info->app_widgets()) { @@ -384,7 +383,6 @@ bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) { (calloc(1, sizeof(application_x))); application->component_type = strdup("widgetapp"); application->mainapp = strdup("false"); - application->multiple = strdup("false"); application->appid = strdup(app_widget.id.c_str()); application->exec = strdup((context_->root_application_path.get() / manifest->package @@ -439,9 +437,9 @@ bool StepParse::FillBackgroundCategoryInfo(manifest_x* manifest) { } bool StepParse::FillAppControl(manifest_x* manifest) { - std::shared_ptr app_info_list = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenApplicationAppControlsKey)); + auto app_info_list = + GetManifestDataForKey( + app_keys::kTizenApplicationAppControlsKey); application_x* app = reinterpret_cast(manifest->application->data); @@ -459,9 +457,9 @@ bool StepParse::FillAppControl(manifest_x* manifest) { } bool StepParse::FillPrivileges(manifest_x* manifest) { - std::shared_ptr perm_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenPermissionsKey)); + auto perm_info = + GetManifestDataForKey( + app_keys::kTizenPermissionsKey); std::set privileges; if (perm_info) privileges = ExtractPrivileges(perm_info); @@ -474,9 +472,9 @@ bool StepParse::FillPrivileges(manifest_x* manifest) { } bool StepParse::FillCategories(manifest_x* manifest) { - std::shared_ptr category_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenCategoryKey)); + auto category_info = + GetManifestDataForKey( + app_keys::kTizenCategoryKey); if (!category_info) return true; @@ -490,9 +488,9 @@ bool StepParse::FillCategories(manifest_x* manifest) { } bool StepParse::FillMetadata(manifest_x* manifest) { - std::shared_ptr meta_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenMetaDataKey)); + auto meta_info = + GetManifestDataForKey( + app_keys::kTizenMetaDataKey); if (!meta_info) return true; @@ -507,19 +505,18 @@ bool StepParse::FillAppWidget() { WgtBackendData* backend_data = static_cast(context_->backend_data.get()); - std::shared_ptr appwidget_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenAppWidgetFullKey)); + auto appwidget_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenAppWidgetFullKey); if (appwidget_info) backend_data->appwidgets.set(*appwidget_info); return true; } bool StepParse::FillAccounts(manifest_x* manifest) { - std::shared_ptr account_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kAccountKey)); + auto account_info = + GetManifestDataForKey( + app_keys::kAccountKey); if (!account_info) return true; common_installer::AccountInfo info; @@ -538,8 +535,9 @@ bool StepParse::FillAccounts(manifest_x* manifest) { } bool StepParse::FillImeInfo() { - const auto ime_info = std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenImeKey)); + auto ime_info = + GetManifestDataForKey( + app_keys::kAccountKey); if (!ime_info) return true; @@ -645,14 +643,12 @@ common_installer::Step::Status StepParse::process() { } // Copy data from ManifestData to InstallerContext - std::shared_ptr info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenApplicationKey)); - std::shared_ptr wgt_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenWidgetKey)); + auto info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenApplicationKey); + auto wgt_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenWidgetKey); std::string name; const auto& name_set = wgt_info->name_set(); @@ -681,10 +677,9 @@ common_installer::Step::Status StepParse::process() { context_->recovery_info.get().recovery_file->WriteAndCommitFileContent(); } - std::shared_ptr perm_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenPermissionsKey)); + auto perm_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenPermissionsKey); parser::PermissionSet permissions; if (perm_info) permissions = perm_info->GetAPIPermissions(); @@ -692,10 +687,9 @@ common_installer::Step::Status StepParse::process() { WgtBackendData* backend_data = static_cast(context_->backend_data.get()); - std::shared_ptr settings_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenSettingKey)); + auto settings_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenSettingKey); if (settings_info) backend_data->settings.set(*settings_info); diff --git a/src/wgt/step/configuration/step_parse.h b/src/wgt/step/configuration/step_parse.h index e7b9357..69015fc 100644 --- a/src/wgt/step/configuration/step_parse.h +++ b/src/wgt/step/configuration/step_parse.h @@ -1,7 +1,6 @@ // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved // Use of this source code is governed by a apache 2.0 license that can be // found in the LICENSE file. - #ifndef WGT_STEP_CONFIGURATION_STEP_PARSE_H_ #define WGT_STEP_CONFIGURATION_STEP_PARSE_H_ @@ -15,6 +14,8 @@ #include #include +#include +#include #include #include #include @@ -75,6 +76,14 @@ class StepParse : public common_installer::Step { ConfigLocation config_location_; bool check_start_file_; + template + std::shared_ptr GetManifestDataForKey(const std::string& key) { + assert(!key.empty()); + static_assert(std::is_base_of::value, + "Type is not base of parser::ManifestData"); + return std::static_pointer_cast(parser_->GetManifestData(key)); + } + STEP_NAME(Parse) }; -- 2.7.4 From da54fd639e7284dd641e5a67579ca2836ade0591 Mon Sep 17 00:00:00 2001 From: Piotr Ganicz Date: Wed, 22 Jun 2016 09:51:31 +0200 Subject: [PATCH 11/16] Fix for update-period Change-Id: Ic8adec0d7bd7aa14a3b5e054aaed67d5cb1d849c --- src/wgt/step/pkgmgr/step_generate_xml.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 1148642..1173a85 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -108,7 +108,11 @@ bool WriteWidgetApplicationAttributesAndElements( xmlTextWriterWriteAttribute(writer, BAD_CAST "main", BAD_CAST (appwidget->primary ? "true" : "false")); // NOLINT - xmlTextWriterWriteAttribute(writer, BAD_CAST "update-period", BAD_CAST "0"); + if (!appwidget->update_period.empty()) { + xmlTextWriterWriteAttribute(writer, BAD_CAST "update-period", BAD_CAST + std::to_string(static_cast( + appwidget->update_period.front())).c_str()); + } for (auto& size : appwidget->content_size) { xmlTextWriterStartElement(writer, BAD_CAST "support-size"); @@ -297,7 +301,8 @@ common_installer::Step::Status StepGenerateXml::precheck() { } if (context_->pkgid.get().empty()) { LOG(ERROR) << "pkgid attribute is empty"; - return Step::Status::PACKAGE_NOT_FOUND; } + return Step::Status::PACKAGE_NOT_FOUND; + } if (!context_->manifest_data.get()->application) { LOG(ERROR) << "No application in package"; -- 2.7.4 From 6bbd3f9ddc27487d54bc2441d8cfba9d8bef2345 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Thu, 16 Jun 2016 14:57:58 +0200 Subject: [PATCH 12/16] Split API in pkgmgr_registration.h Submit together: - https://review.tizen.org/gerrit/75107 - https://review.tizen.org/gerrit/75108 - https://review.tizen.org/gerrit/75109 Change-Id: I259d3aac621443e7985fc2d5aa87e99d5a7bd959 --- src/unit_tests/smoke_test.cc | 6 +++--- src/wgt/wgt_app_query_interface.cc | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index f150590..56dfb15 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -217,13 +217,13 @@ void PackageCheckCleanup(const std::string& pkgid, void ValidatePackage(const std::string& pkgid, const std::vector& appids) { - ASSERT_TRUE(ci::IsPackageInstalled(pkgid, ci::GetRequestMode())); + ASSERT_TRUE(ci::QueryIsPackageInstalled(pkgid, ci::GetRequestMode())); ValidatePackageFS(pkgid, appids); } void CheckPackageNonExistance(const std::string& pkgid, const std::vector& appids) { - ASSERT_FALSE(ci::IsPackageInstalled(pkgid, ci::GetRequestMode())); + ASSERT_FALSE(ci::QueryIsPackageInstalled(pkgid, ci::GetRequestMode())); PackageCheckCleanup(pkgid, appids); } diff --git a/src/wgt/wgt_app_query_interface.cc b/src/wgt/wgt_app_query_interface.cc index e4245cc..912c861 100644 --- a/src/wgt/wgt_app_query_interface.cc +++ b/src/wgt/wgt_app_query_interface.cc @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -107,21 +107,21 @@ bool WgtAppQueryInterface::IsAppInstalledByArgv(int argc, char** argv) { return false; // argument from commandline is package id - if (ci::IsPackageInstalled(arg, ci::GetRequestMode())) + if (ci::QueryIsPackageInstalled(arg, ci::GetRequestMode())) return true; // argument from commandline is path to file std::string pkg_id = GetPkgIdFromPath(arg); if (pkg_id.empty()) return false; - return ci::IsPackageInstalled(pkg_id, ci::GetRequestMode()); + return ci::QueryIsPackageInstalled(pkg_id, ci::GetRequestMode()); } bool WgtAppQueryInterface::IsHybridApplication(int argc, char** argv) { std::string arg = GetInstallationRequestInfo(argc, argv); if (arg.find("apps_rw/recovery-") != std::string::npos) arg = ReadPkgidFromRecovery(arg); - if (ci::IsPackageInstalled(arg, ci::GetRequestMode())) { + if (ci::QueryIsPackageInstalled(arg, ci::GetRequestMode())) { bf::path package_directory(ci::GetRootAppPath(false)); if (bf::exists(package_directory / arg / kTizenManifestLocation) && bf::exists(package_directory / arg / kHybridConfigLocation)) -- 2.7.4 From 70f676c0d426d55dc0dc7201f83e7c4e9aac1c06 Mon Sep 17 00:00:00 2001 From: Arkadiusz Szulakiewicz Date: Wed, 22 Jun 2016 14:29:06 +0200 Subject: [PATCH 13/16] Add 'multiple-accounts-support' attribute for false values Change-Id: I16f212ec25689115c890f5688cdd7f8657cbebda --- src/wgt/step/pkgmgr/step_generate_xml.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 1173a85..8e92818 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -504,6 +504,10 @@ void StepGenerateXml::GenerateAccount(xmlTextWriterPtr writer) { xmlTextWriterWriteAttribute(writer, BAD_CAST "multiple-accounts-support", BAD_CAST "true"); + else + xmlTextWriterWriteAttribute(writer, + BAD_CAST "multiple-accounts-support", + BAD_CAST "false"); for (auto& icon_pair : account.icon_paths) { xmlTextWriterStartElement(writer, BAD_CAST "icon"); if (icon_pair.first == "AccountSmall") -- 2.7.4 From a90c5e7a6e9bd7302109e7e91f0d44b6ce67cc96 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Mon, 27 Jun 2016 13:26:44 +0900 Subject: [PATCH 14/16] Modify nodisplay value of widget-application Change-Id: I1cc298f5761d9bdd0b446a7cc06a937244f83187 --- src/wgt/step/configuration/step_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 602df3f..df06790 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -388,7 +388,7 @@ bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) { strdup((context_->root_application_path.get() / manifest->package / "bin" / application->appid).c_str()); application->type = strdup("webapp"); - application->nodisplay = strdup("false"); + application->nodisplay = strdup("true"); application->taskmanage = strdup("false"); SetApplicationXDefaults(application); application->ambient_support = strdup("false"); -- 2.7.4 From f3af9bd52c8664b63d301a4c62e1d45e5bd3d063 Mon Sep 17 00:00:00 2001 From: Piotr Ganicz Date: Tue, 28 Jun 2016 12:52:34 +0200 Subject: [PATCH 15/16] [Refactor] check-coding-style Change-Id: If44523674d80b403d32af34848230f53a2620d0b --- src/wgt/step/pkgmgr/step_generate_xml.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 8e92818..dffb4c8 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -119,7 +119,8 @@ bool WriteWidgetApplicationAttributesAndElements( std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type); if (!size.preview.empty()) { - std::string icon_name = shared_path.string() + "/" + appwidget->id + "." + type + "." + "preview" + + std::string icon_name = shared_path.string() + "/" + + appwidget->id + "." + type + "." + "preview" + bf::path(size.preview).extension().string(); xmlTextWriterWriteAttribute(writer, BAD_CAST "preview", BAD_CAST icon_name.c_str()); // NOLINT -- 2.7.4 From 5957350d379b2307e5b2d33ce2ce90137fe536a0 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Fri, 1 Jul 2016 11:01:36 +0200 Subject: [PATCH 16/16] Check if widget's shared/res/ entry is directory Installation will succeed if shared/res entry is not directory. Change-Id: I06e2b3934dd1342ad7ae98fd681a4b2a21d13885 --- src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc | 4 ++++ 1 file changed, 4 insertions(+) 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 3c5d9e9..fbb8519 100644 --- a/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc +++ b/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc @@ -52,6 +52,10 @@ bool StepWgtPatchStorageDirectories::ShareDirFor3x() { bf::path src = context_->pkg_path.get() / kResWgtSubPath / kSharedResLocation; if (!bf::exists(src)) return true; + if (!bf::is_directory(src)) { + LOG(WARNING) << "Widget's shared/res/ is not directory"; + return true; + } bf::path dst = context_->pkg_path.get() / kSharedResLocation; if (!common_installer::MoveDir(src, dst, common_installer::FS_MERGE_DIRECTORIES)) { -- 2.7.4