Change duplicated step name 29/218829/3
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 28 Nov 2019 11:14:24 +0000 (20:14 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 9 Dec 2019 00:09:37 +0000 (00:09 +0000)
Same step name exists on tpk-backend

Change-Id: Ia96de025c403f19af3deca55f9ff669a863d0092
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/hybrid/hybrid_installer.cc
src/wgt/step/filesystem/step_create_symbolic_link.cc [deleted file]
src/wgt/step/filesystem/step_create_symbolic_link.h [deleted file]
src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc [new file with mode: 0644]
src/wgt/step/filesystem/step_create_wgt_symbolic_link.h [new file with mode: 0644]
src/wgt/wgt_installer.cc

index fc7824f3c69b7a4a5531831da5e5f52912b7e091..2f00998c38da738efe3dc84df376a0fe7dd5a759 100644 (file)
@@ -79,7 +79,7 @@
 #include <common/step/security/step_register_trust_anchor.h>
 #include <common/step/security/step_unregister_trust_anchor.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_tpk_patch_icons.h>
 #include <tpk/step/filesystem/step_tpk_prepare_package_directory.h>
 #include <tpk/step/filesystem/step_tpk_update_package_directory.h>
@@ -98,7 +98,7 @@
 #include "wgt/step/configuration/step_set_old_signature_files_location.h"
 #include "wgt/step/encryption/step_remove_encryption_data.h"
 #include "wgt/step/filesystem/step_copy_preview_icons.h"
-#include "wgt/step/filesystem/step_create_symbolic_link.h"
+#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h"
 #include "wgt/step/filesystem/step_wgt_patch_icons.h"
 #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
 #include "wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h"
@@ -155,8 +155,8 @@ void HybridInstaller::InstallSteps() {
   AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
   AddStep<ci::security::StepPrivilegeCompatibility>(
       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-  AddStep<tpk::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
+  AddStep<tpk::filesystem::StepCreateTpkSymbolicLink>();
   AddStep<ci::pkgmgr::StepRegisterApplication>();
   AddStep<ci::security::StepRegisterTrustAnchor>(
       ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL);
@@ -214,8 +214,8 @@ void HybridInstaller::UpdateSteps() {
   AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
   AddStep<ci::security::StepPrivilegeCompatibility>(
       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-  AddStep<tpk::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
+  AddStep<tpk::filesystem::StepCreateTpkSymbolicLink>();
   AddStep<ci::pkgmgr::StepUpdateApplication>();
   AddStep<ci::security::StepRegisterTrustAnchor>(
       ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL);
@@ -309,8 +309,8 @@ void HybridInstaller::DeltaSteps() {
   AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
   AddStep<ci::security::StepPrivilegeCompatibility>(
       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-  AddStep<tpk::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
+  AddStep<tpk::filesystem::StepCreateTpkSymbolicLink>();
   AddStep<ci::security::StepRegisterTrustAnchor>(
       ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
   AddStep<ci::security::StepPrivacyPrivilege>(
@@ -383,8 +383,8 @@ void HybridInstaller::MountInstallSteps() {
   AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
   AddStep<ci::security::StepPrivilegeCompatibility>(
       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-  AddStep<tpk::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
+  AddStep<tpk::filesystem::StepCreateTpkSymbolicLink>();
   AddStep<ci::pkgmgr::StepRegisterApplication>();
   AddStep<ci::security::StepRegisterTrustAnchor>(
       ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL);
@@ -441,8 +441,8 @@ void HybridInstaller::MountUpdateSteps() {
   AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
   AddStep<ci::security::StepPrivilegeCompatibility>(
       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-  AddStep<tpk::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
+  AddStep<tpk::filesystem::StepCreateTpkSymbolicLink>();
   AddStep<ci::pkgmgr::StepUpdateApplication>();
   AddStep<ci::security::StepRegisterTrustAnchor>(
       ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
@@ -663,8 +663,8 @@ void HybridInstaller::ReadonlyUpdateInstallSteps() {
   AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
   AddStep<ci::security::StepPrivilegeCompatibility>(
       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
-  AddStep<tpk::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
+  AddStep<tpk::filesystem::StepCreateTpkSymbolicLink>();
   AddStep<ci::pkgmgr::StepUpdateApplication>();
   AddStep<ci::security::StepRegisterTrustAnchor>(
       ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
diff --git a/src/wgt/step/filesystem/step_create_symbolic_link.cc b/src/wgt/step/filesystem/step_create_symbolic_link.cc
deleted file mode 100644 (file)
index c1091d0..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 2014, Copyright © Eurogiciel Coporation, APACHE-2.0, see LICENSE file */
-// 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.
-
-#include "wgt/step/filesystem/step_create_symbolic_link.h"
-
-#include <pkgmgr-info.h>
-#include <unistd.h>
-
-#include <boost/filesystem.hpp>
-#include <boost/system/error_code.hpp>
-#include <common/utils/file_util.h>
-#include <common/utils/glist_range.h>
-#include <cassert>
-#include <cstring>
-#include <cstdio>
-#include <string>
-
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
-
-namespace {
-
-const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service";
-const char kWebWidgetRuntimeBinaryPath[] = "/usr/bin/web-widget-runtime";
-const char kWRTPath[] = "/usr/bin/wrt";
-
-}  // namespace
-
-namespace wgt {
-namespace filesystem {
-
-bool StepCreateSymbolicLink::CreateSymlinksForApps() {
-  boost::system::error_code error;
-  for (application_x* app :
-       GListRange<application_x*>(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 <appid> and is located in <pkgid>/<appid>
-    bf::path exec_path = context_->GetPkgPath() / bf::path("bin");
-    common_installer::CreateDir(exec_path);
-
-    exec_path /= bf::path(app->appid);
-    common_installer::RemoveAll(exec_path);
-
-    if (strcmp(app->component_type, "uiapp") == 0) {
-      bf::create_symlink(bf::path(kWRTPath), exec_path, error);
-    } else if (strcmp(app->component_type, "watchapp") == 0) {
-      bf::create_symlink(bf::path(kWRTPath), exec_path, error);
-    } else if (strcmp(app->component_type, "widgetapp") == 0) {
-      bf::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error);
-    } else {
-      bf::create_symlink(kWrtServiceBinaryPath, exec_path, error);
-    }
-    if (error) {
-      LOG(ERROR) << "Failed to set symbolic link "
-        << boost::system::system_error(error).what();
-      return false;
-    }
-  }
-  return true;
-}
-
-common_installer::Step::Status StepCreateSymbolicLink::process() {
-  assert(context_->manifest_data.get());
-
-  if (!CreateSymlinksForApps())
-    return Status::APP_DIR_ERROR;
-
-  LOG(DEBUG) << "Symlinks created successfully";
-  return Status::OK;
-}
-
-common_installer::Step::Status StepCreateSymbolicLink::undo() {
-  for (application_x* app :
-       GListRange<application_x*>(context_->manifest_data.get()->application)) {
-    bf::path exec_path = context_->GetPkgPath() / "bin" / app->appid;
-    common_installer::RemoveAll(exec_path);
-  }
-  return Status::OK;
-}
-
-}  // namespace filesystem
-}  // namespace wgt
diff --git a/src/wgt/step/filesystem/step_create_symbolic_link.h b/src/wgt/step/filesystem/step_create_symbolic_link.h
deleted file mode 100644 (file)
index c1129e7..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_
-#define WGT_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_
-
-#include <boost/filesystem.hpp>
-
-#include <manifest_parser/utils/logging.h>
-
-#include <common/app_installer.h>
-#include <common/installer_context.h>
-#include <common/step/step.h>
-
-namespace wgt {
-namespace filesystem {
-
-/**
- * \brief Step that create symbolic link to application
- */
-class StepCreateSymbolicLink : public common_installer::Step {
- public:
-  using Step::Step;
-
-  /**
-   * \brief Create symbolic link
-   *
-   * \return Status::ERROR when failed to create symbolic link,
-   *         Status::OK otherwise
-   */
-  Status process() override;
-
-  /**
-   * \brief Empty method
-   *
-   * \return Status::OK
-   */
-  Status clean() override { return Status::OK; }
-
-  /**
-   * \brief Delete created symbolic link
-   *
-   * \return Status::OK
-   */
-  Status undo() override;
-
-  /**
-   * \brief Empty method
-   *
-   * \return Status::OK
-   */
-  Status precheck() override { return Status::OK; }
-
- private:
-  bool CreateSymlinksForApps();
-
-  STEP_NAME(CreateSymbolicLink)
-};
-
-}  // namespace filesystem
-}  // namespace wgt
-
-#endif  // WGT_STEP_FILESYSTEM_STEP_CREATE_SYMBOLIC_LINK_H_
diff --git a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc
new file mode 100644 (file)
index 0000000..d234494
--- /dev/null
@@ -0,0 +1,95 @@
+/* 2014, Copyright © Eurogiciel Coporation, APACHE-2.0, see LICENSE file */
+// 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.
+
+#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h"
+
+#include <pkgmgr-info.h>
+#include <unistd.h>
+
+#include <boost/filesystem.hpp>
+#include <boost/system/error_code.hpp>
+#include <common/utils/file_util.h>
+#include <common/utils/glist_range.h>
+#include <cassert>
+#include <cstring>
+#include <cstdio>
+#include <string>
+
+namespace bf = boost::filesystem;
+namespace bs = boost::system;
+
+namespace {
+
+const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service";
+const char kWebWidgetRuntimeBinaryPath[] = "/usr/bin/web-widget-runtime";
+const char kWRTPath[] = "/usr/bin/wrt";
+
+}  // namespace
+
+namespace wgt {
+namespace filesystem {
+
+bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() {
+  boost::system::error_code error;
+  for (application_x* app :
+      GListRange<application_x*>(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 <appid> and is located in <pkgid>/<appid>
+    bf::path exec_path = context_->GetPkgPath() / bf::path("bin");
+    common_installer::CreateDir(exec_path);
+
+    exec_path /= bf::path(app->appid);
+    common_installer::RemoveAll(exec_path);
+
+    if (strcmp(app->component_type, "uiapp") == 0) {
+      bf::create_symlink(bf::path(kWRTPath), exec_path, error);
+    } else if (strcmp(app->component_type, "watchapp") == 0) {
+      bf::create_symlink(bf::path(kWRTPath), exec_path, error);
+    } else if (strcmp(app->component_type, "widgetapp") == 0) {
+      bf::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error);
+    } else {
+      bf::create_symlink(kWrtServiceBinaryPath, exec_path, error);
+    }
+    if (error) {
+      LOG(ERROR) << "Failed to set symbolic link "
+        << boost::system::system_error(error).what();
+      return false;
+    }
+  }
+  return true;
+}
+
+common_installer::Step::Status StepCreateWgtSymbolicLink::precheck() {
+  if (!context_->manifest_data.get()) {
+    LOG(ERROR) << "Manifest data empty";
+    return Status::ERROR;
+  }
+
+  return Status::OK;
+}
+
+common_installer::Step::Status StepCreateWgtSymbolicLink::process() {
+  assert(context_->manifest_data.get());
+
+  if (!CreateSymlinksForApps())
+    return Status::APP_DIR_ERROR;
+
+  LOG(DEBUG) << "Symlinks created successfully";
+  return Status::OK;
+}
+
+common_installer::Step::Status StepCreateWgtSymbolicLink::undo() {
+  for (application_x* app :
+      GListRange<application_x*>(context_->manifest_data.get()->application)) {
+    bf::path exec_path = context_->GetPkgPath() / "bin" / app->appid;
+    common_installer::RemoveAll(exec_path);
+  }
+  return Status::OK;
+}
+
+}  // namespace filesystem
+}  // namespace wgt
diff --git a/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h b/src/wgt/step/filesystem/step_create_wgt_symbolic_link.h
new file mode 100644 (file)
index 0000000..8f8e326
--- /dev/null
@@ -0,0 +1,64 @@
+// 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_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_
+#define WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_
+
+#include <boost/filesystem.hpp>
+
+#include <manifest_parser/utils/logging.h>
+
+#include <common/app_installer.h>
+#include <common/installer_context.h>
+#include <common/step/step.h>
+
+namespace wgt {
+namespace filesystem {
+
+/**
+ * \brief Step that create symbolic link to application
+ */
+class StepCreateWgtSymbolicLink : public common_installer::Step {
+ public:
+  using Step::Step;
+
+  /**
+   * \brief Create symbolic link
+   *
+   * \return Status::ERROR when failed to create symbolic link,
+   *         Status::OK otherwise
+   */
+  Status process() override;
+
+  /**
+   * \brief Empty method
+   *
+   * \return Status::OK
+   */
+  Status clean() override { return Status::OK; }
+
+  /**
+   * \brief Delete created symbolic link
+   *
+   * \return Status::OK
+   */
+  Status undo() override;
+
+  /**
+   * \brief Check weather manifest data is empty or not
+   *
+   * \return Status::OK
+   */
+  Status precheck() override;
+
+ private:
+  bool CreateSymlinksForApps();
+
+  STEP_NAME(CreateSymbolicLink)
+};
+
+}  // namespace filesystem
+}  // namespace wgt
+
+#endif  // WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_
index 2031f14b994539ecfafb3a7aa10c1a219c17fe1c..2187656a86ca1fd2edd112f642b413aaa9f50c10 100644 (file)
@@ -99,7 +99,7 @@
 #include "wgt/step/encryption/step_encrypt_resources.h"
 #include "wgt/step/encryption/step_remove_encryption_data.h"
 #include "wgt/step/filesystem/step_copy_preview_icons.h"
-#include "wgt/step/filesystem/step_create_symbolic_link.h"
+#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h"
 #include "wgt/step/filesystem/step_wgt_patch_icons.h"
 #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
 #include "wgt/step/filesystem/step_wgt_prepare_package_directory.h"
@@ -151,7 +151,7 @@ void WgtInstaller::InstallSteps() {
   AddStep<ci::filesystem::StepCopy>();
   AddStep<ci::filesystem::StepCopyTep>();
   AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
   AddStep<wgt::filesystem::StepWgtPatchIcons>(true);
   AddStep<ci::filesystem::StepCreateIcons>();
   AddStep<wgt::filesystem::StepCopyPreviewIcons>();
@@ -204,7 +204,7 @@ void WgtInstaller::UpdateSteps() {
   AddStep<ci::backup::StepCopyBackup>();
   AddStep<ci::filesystem::StepUpdateTep>();
   AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
   AddStep<wgt::filesystem::StepWgtPatchIcons>(true);
   AddStep<ci::filesystem::StepCreateIcons>();
   AddStep<wgt::filesystem::StepCopyPreviewIcons>();
@@ -322,7 +322,7 @@ void WgtInstaller::DeltaSteps() {
   AddStep<ci::backup::StepCopyBackup>();
   AddStep<ci::filesystem::StepUpdateTep>();
   AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
   AddStep<wgt::filesystem::StepWgtPatchIcons>(true);
   AddStep<ci::filesystem::StepCreateIcons>();
   AddStep<wgt::filesystem::StepCopyPreviewIcons>();
@@ -391,7 +391,7 @@ void WgtInstaller::MountInstallSteps() {
   AddStep<wgt::filesystem::StepWgtPreparePackageDirectory>();
   AddStep<ci::filesystem::StepCopyTep>();
   AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
   AddStep<wgt::filesystem::StepWgtPatchIcons>(true);
   AddStep<ci::filesystem::StepCreateIcons>();
   AddStep<wgt::filesystem::StepCopyPreviewIcons>();
@@ -442,7 +442,7 @@ void WgtInstaller::MountUpdateSteps() {
   AddStep<wgt::filesystem::StepWgtUpdatePackageDirectory>();
   AddStep<ci::filesystem::StepUpdateTep>();
   AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
   AddStep<wgt::filesystem::StepWgtPatchIcons>(true);
   AddStep<ci::filesystem::StepCreateIcons>();
   AddStep<wgt::filesystem::StepCopyPreviewIcons>();
@@ -560,7 +560,7 @@ void WgtInstaller::ReadonlyUpdateInstallSteps() {
   AddStep<ci::filesystem::StepCopyTep>();
   AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
   AddStep<ci::filesystem::StepCreateStorageDirectories>();
-  AddStep<wgt::filesystem::StepCreateSymbolicLink>();
+  AddStep<wgt::filesystem::StepCreateWgtSymbolicLink>();
   AddStep<wgt::filesystem::StepWgtPatchIcons>(true);
   AddStep<wgt::filesystem::StepCopyPreviewIcons>();
   AddStep<wgt::security::StepCheckExtensionPrivileges>();