From: Junghyun Yeon Date: Thu, 28 Nov 2019 11:10:18 +0000 (+0900) Subject: Change duplicated step name X-Git-Tag: submit/tizen/20191213.074937~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e720facf9859fac9b2f897dbb4f06b8985f6072;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Change duplicated step name Same step name exists on wgt-backend. Change-Id: Iea12e8def08dd21e91302a602c82c1eb91881c97 Signed-off-by: Junghyun Yeon --- diff --git a/src/tpk/step/filesystem/step_create_symbolic_link.cc b/src/tpk/step/filesystem/step_create_symbolic_link.cc deleted file mode 100644 index 8afacd0..0000000 --- a/src/tpk/step/filesystem/step_create_symbolic_link.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2015 Samsung Electronics, license APACHE-2.0, see LICENSE file */ - -#include "tpk/step/filesystem/step_create_symbolic_link.h" - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include - -namespace tpk { -namespace filesystem { - -namespace bf = boost::filesystem; -namespace ci = common_installer; - -using common_installer::InstallerContext; -typedef common_installer::Step::Status Status; - -bool CreateSymLink(application_x* app, InstallerContext* context) { - boost::system::error_code boost_error; - bf::path bindir = context->GetPkgPath() / - bf::path("bin"); - LOG(DEBUG) << "Creating dir: " << bindir; - if (!bf::is_symlink(symlink_status(bindir)) && - !common_installer::CreateDir(bindir)) { - LOG(ERROR) << "Directory creation failure: " << bindir; - return false; - } - - if (app->ui_gadget && strcmp(app->ui_gadget, "true") == 0) { - // Ug-client path - // Make a symlink with the name of appid, pointing /usr/bin/ug-client - bf::path app_exec_path(app->exec); - if (!bf::exists(app_exec_path)) { - bf::path ug_client_path(tzplatform_mkpath(TZ_SYS_BIN, "ug-client")); - LOG(INFO) << "Createing symlink " << app_exec_path << " pointing " << - ug_client_path; - bf::create_symlink(ug_client_path, app_exec_path, boost_error); - if (boost_error) { - LOG(ERROR) << "Symlink creation failure: " << app_exec_path; - return false; - } - } - } - - return true; -} - -Status StepCreateSymbolicLink::precheck() { - manifest_x *m = context_->manifest_data.get(); - if (!m) { - LOG(ERROR) << "manifest_data attribute is empty"; - return Step::Status::INVALID_VALUE; - } - if (!m->application) { - LOG(ERROR) << "No application exists"; - return Step::Status::ERROR; - } - - return Step::Status::OK; -} - -Status StepCreateSymbolicLink::process() { - manifest_x* m = context_->manifest_data.get(); - for (application_x* app : GListRange(m->application)) { - // filter out non-tpk apps as this step is run for hybrid backend too - if (strcmp("webapp", app->type) == 0) - continue; - if (!CreateSymLink(app, context_)) - return Status::ERROR; - } - return Status::OK; -} - -} // namespace filesystem -} // namespace tpk diff --git a/src/tpk/step/filesystem/step_create_symbolic_link.h b/src/tpk/step/filesystem/step_create_symbolic_link.h deleted file mode 100644 index e27eea2..0000000 --- a/src/tpk/step/filesystem/step_create_symbolic_link.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2015 Samsung Electronics, license APACHE-2.0, see LICENSE file */ - -#ifndef TPK_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ -#define TPK_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ - -#include - -#include - -namespace tpk { -namespace filesystem { - -class StepCreateSymbolicLink : public common_installer::Step { - public: - using Step::Step; - Status process() override; - Status clean() override { return Status::OK; } - Status undo() override { return Status::OK; } - Status precheck() override; - - STEP_NAME(CreateSymbolicLink) -}; - -} // namespace filesystem -} // namespace tpk - -#endif // TPK_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_ diff --git a/src/tpk/step/filesystem/step_create_tpk_symbolic_link.cc b/src/tpk/step/filesystem/step_create_tpk_symbolic_link.cc new file mode 100644 index 0000000..29f2158 --- /dev/null +++ b/src/tpk/step/filesystem/step_create_tpk_symbolic_link.cc @@ -0,0 +1,84 @@ +/* Copyright 2015 Samsung Electronics, license APACHE-2.0, see LICENSE file */ + +#include "tpk/step/filesystem/step_create_tpk_symbolic_link.h" + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +namespace tpk { +namespace filesystem { + +namespace bf = boost::filesystem; +namespace ci = common_installer; + +using common_installer::InstallerContext; +typedef common_installer::Step::Status Status; + +bool CreateSymLink(application_x* app, InstallerContext* context) { + boost::system::error_code boost_error; + bf::path bindir = context->GetPkgPath() / + bf::path("bin"); + LOG(DEBUG) << "Creating dir: " << bindir; + if (!bf::is_symlink(symlink_status(bindir)) && + !common_installer::CreateDir(bindir)) { + LOG(ERROR) << "Directory creation failure: " << bindir; + return false; + } + + if (app->ui_gadget && strcmp(app->ui_gadget, "true") == 0) { + // Ug-client path + // Make a symlink with the name of appid, pointing /usr/bin/ug-client + bf::path app_exec_path(app->exec); + if (!bf::exists(app_exec_path)) { + bf::path ug_client_path(tzplatform_mkpath(TZ_SYS_BIN, "ug-client")); + LOG(INFO) << "Createing symlink " << app_exec_path << " pointing " << + ug_client_path; + bf::create_symlink(ug_client_path, app_exec_path, boost_error); + if (boost_error) { + LOG(ERROR) << "Symlink creation failure: " << app_exec_path; + return false; + } + } + } + + return true; +} + +Status StepCreateTpkSymbolicLink::precheck() { + manifest_x *m = context_->manifest_data.get(); + if (!m) { + LOG(ERROR) << "manifest_data attribute is empty"; + return Step::Status::INVALID_VALUE; + } + if (!m->application) { + LOG(ERROR) << "No application exists"; + return Step::Status::ERROR; + } + + return Step::Status::OK; +} + +Status StepCreateTpkSymbolicLink::process() { + manifest_x* m = context_->manifest_data.get(); + for (application_x* app : GListRange(m->application)) { + // filter out non-tpk apps as this step is run for hybrid backend too + if (strcmp("webapp", app->type) == 0) + continue; + if (!CreateSymLink(app, context_)) + return Status::ERROR; + } + return Status::OK; +} + +} // namespace filesystem +} // namespace tpk diff --git a/src/tpk/step/filesystem/step_create_tpk_symbolic_link.h b/src/tpk/step/filesystem/step_create_tpk_symbolic_link.h new file mode 100644 index 0000000..63cc4f6 --- /dev/null +++ b/src/tpk/step/filesystem/step_create_tpk_symbolic_link.h @@ -0,0 +1,27 @@ +/* Copyright 2015 Samsung Electronics, license APACHE-2.0, see LICENSE file */ + +#ifndef TPK_STEP_FILESYSTEM_STEP_CREATE_TPK_SYMBOLIC_LINK_H_ +#define TPK_STEP_FILESYSTEM_STEP_CREATE_TPK_SYMBOLIC_LINK_H_ + +#include + +#include + +namespace tpk { +namespace filesystem { + +class StepCreateTpkSymbolicLink : public common_installer::Step { + public: + using Step::Step; + Status process() override; + Status clean() override { return Status::OK; } + Status undo() override { return Status::OK; } + Status precheck() override; + + STEP_NAME(CreateTpkSymbolicLink) +}; + +} // namespace filesystem +} // namespace tpk + +#endif // TPK_STEP_FILESYSTEM_STEP_CREATE_TPK_SYMBOLIC_LINK_H_ diff --git a/src/tpk/tpk_installer.cc b/src/tpk/tpk_installer.cc index a131088..3994b7c 100644 --- a/src/tpk/tpk_installer.cc +++ b/src/tpk/tpk_installer.cc @@ -89,7 +89,7 @@ #include "tpk/step/configuration/step_adjust_install_location.h" #include "tpk/step/configuration/step_check_reinstall_manifest.h" #include "tpk/step/filesystem/step_create_external_storage_directories.h" -#include "tpk/step/filesystem/step_create_symbolic_link.h" +#include "tpk/step/filesystem/step_create_tpk_symbolic_link.h" #include "tpk/step/filesystem/step_check_pkg_directory_path.h" #include "tpk/step/filesystem/step_remove_external_storage_directories.h" #include "tpk/step/filesystem/step_tpk_patch_icons.h" @@ -142,7 +142,7 @@ void TpkInstaller::InstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -191,7 +191,7 @@ void TpkInstaller::UpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -265,7 +265,7 @@ void TpkInstaller::ReinstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -316,7 +316,7 @@ void TpkInstaller::DeltaSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -392,7 +392,7 @@ void TpkInstaller::MountInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -439,7 +439,7 @@ void TpkInstaller::MountUpdateSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -475,7 +475,7 @@ void TpkInstaller::ManifestDirectInstallSteps() { AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::TPK); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -507,7 +507,7 @@ void TpkInstaller::ManifestDirectUpdateSteps() { AddStep( ci::security::StepPrivilegeCompatibility::InternalPrivType::TPK); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -616,7 +616,7 @@ void TpkInstaller::ReadonlyUpdateInstallSteps() { AddStep(); AddStep(); AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep();