Fix preload request for wgt 97/82497/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Wed, 3 Aug 2016 11:57:59 +0000 (13:57 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Wed, 3 Aug 2016 12:30:22 +0000 (14:30 +0200)
This commit should allow to install preload wgt package with command:
 - wgt-backend --preload -i $package

Submit together:
 - https://review.tizen.org/gerrit/82424
 - https://review.tizen.org/gerrit/82496
 - https://review.tizen.org/gerrit/82497

Change-Id: Ic0926ebb16e725e1c1304394acfac559c57aa95c

src/tpk/CMakeLists.txt
src/tpk/step/configuration/step_parse_preload.cc [deleted file]
src/tpk/step/configuration/step_parse_preload.h [deleted file]
src/tpk/tpk_installer.cc

index 0a8181d85d212b1fc5f60e8c5f53b991a2dc34cc..03d4e346edd0d012d5629b2825969b01fbaffc34 100644 (file)
@@ -1,6 +1,5 @@
 SET(SRCS
   external_dirs.cc
-  step/configuration/step_parse_preload.cc
   step/filesystem/step_check_pkg_directory_path.cc
   step/filesystem/step_create_external_storage_directories.cc
   step/filesystem/step_create_symbolic_link.cc
diff --git a/src/tpk/step/configuration/step_parse_preload.cc b/src/tpk/step/configuration/step_parse_preload.cc
deleted file mode 100644 (file)
index 0d572ee..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2016 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 "tpk/step/configuration/step_parse_preload.h"
-
-#include <pkgmgr-info.h>
-#include <unistd.h>
-
-#include <boost/filesystem.hpp>
-
-#include <cstring>
-#include <cstdio>
-#include <string>
-
-#include "common/pkgmgr_interface.h"
-#include "common/utils/file_util.h"
-
-namespace bf = boost::filesystem;
-namespace ci = common_installer;
-
-namespace tpk {
-namespace configuration {
-
-ci::Step::Status StepParsePreload::process() {
-  const char* preload_manifest_val = context_->manifest_data.get()->preload;
-
-  if (strcmp(preload_manifest_val, "true") != 0) {
-    bool is_preload = context_->is_preload_request.get();
-
-    LOG(INFO) << "is_preload : (" << is_preload << ")";
-    if (is_preload) {
-      context_->manifest_data.get()->preload = strdup("true");
-
-      if (getuid() != 0) {
-        LOG(ERROR) << "You're not authorized to install preload app: "
-            << context_->pkgid.get().c_str();
-        return Status::OPERATION_NOT_ALLOWED;
-      }
-    } else {
-      context_->manifest_data.get()->preload = strdup("false");
-    }
-  }
-
-  return Status::OK;
-}
-
-}  // namespace configuration
-}  // namespace tpk
diff --git a/src/tpk/step/configuration/step_parse_preload.h b/src/tpk/step/configuration/step_parse_preload.h
deleted file mode 100644 (file)
index 51fe4a3..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2016 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 TPK_STEP_CONFIGURATION_STEP_PARSE_PRELOAD_H_
-#define TPK_STEP_CONFIGURATION_STEP_PARSE_PRELOAD_H_
-
-#include <manifest_parser/utils/logging.h>
-
-#include "common/installer_context.h"
-#include "common/step/step.h"
-
-namespace tpk {
-namespace configuration {
-
-class StepParsePreload : 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 { return Status::OK; }
-
-  STEP_NAME(ParsePreload)
-};
-
-}  // namespace configuration
-}  // namespace tpk
-
-#endif  // TPK_STEP_CONFIGURATION_STEP_PARSE_PRELOAD_H_
index aa5f78b784f73523223f6fbfc50ab365b1a51e8d..f47955348f15e5b86d7f34afd7a6235a2ab31979 100644 (file)
@@ -10,6 +10,7 @@
 #include <common/step/configuration/step_configure.h>
 #include <common/step/configuration/step_fail.h>
 #include <common/step/configuration/step_parse_manifest.h>
+#include <common/step/configuration/step_parse_preload.h>
 #include <common/step/filesystem/step_acquire_external_storage.h>
 #include <common/step/filesystem/step_clear_data.h>
 #include <common/step/filesystem/step_copy.h>
@@ -62,7 +63,6 @@
 #include <common/step/security/step_rollback_installation_security.h>
 #include <common/step/security/step_update_security.h>
 
-#include "tpk/step/configuration/step_parse_preload.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_check_pkg_directory_path.h"
@@ -151,7 +151,7 @@ void TpkInstaller::InstallSteps() {
   AddStep<ci::configuration::StepParseManifest>(
       ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
       ci::configuration::StepParseManifest::StoreLocation::NORMAL);
-  AddStep<tpk::configuration::StepParsePreload>();
+  AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::pkgmgr::StepCheckRestriction>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   AddStep<ci::security::StepCheckSignature>();
@@ -183,7 +183,7 @@ void TpkInstaller::UpdateSteps() {
   AddStep<ci::configuration::StepParseManifest>(
       ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
       ci::configuration::StepParseManifest::StoreLocation::NORMAL);
-  AddStep<tpk::configuration::StepParsePreload>();
+  AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   AddStep<ci::security::StepCheckSignature>();
   AddStep<ci::security::StepPrivilegeCompatibility>();
@@ -241,7 +241,7 @@ void TpkInstaller::ReinstallSteps() {
   AddStep<ci::configuration::StepParseManifest>(
      ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
      ci::configuration::StepParseManifest::StoreLocation::NORMAL);
-  AddStep<tpk::configuration::StepParsePreload>();
+  AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::pkgmgr::StepCheckRestriction>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   // TODO(t.iwanek): add StepCheckSignature which is missing
@@ -340,7 +340,7 @@ void TpkInstaller::MountInstallSteps() {
   AddStep<ci::configuration::StepParseManifest>(
       ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
       ci::configuration::StepParseManifest::StoreLocation::NORMAL);
-  AddStep<tpk::configuration::StepParsePreload>();
+  AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::pkgmgr::StepCheckRestriction>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   AddStep<ci::security::StepCheckSignature>();
@@ -372,7 +372,7 @@ void TpkInstaller::MountUpdateSteps() {
   AddStep<ci::configuration::StepParseManifest>(
       ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
       ci::configuration::StepParseManifest::StoreLocation::NORMAL);
-  AddStep<tpk::configuration::StepParsePreload>();
+  AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   AddStep<ci::security::StepCheckSignature>();
   AddStep<ci::security::StepPrivilegeCompatibility>();
@@ -406,7 +406,7 @@ void TpkInstaller::ManifestDirectInstallSteps() {
       ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
       ci::configuration::StepParseManifest::StoreLocation::NORMAL);
   AddStep<tpk::filesystem::StepCheckPkgDirPath>();
-  AddStep<tpk::configuration::StepParsePreload>();
+  AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   AddStep<tpk::pkgmgr::StepManifestAdjustment>();
   AddStep<ci::security::StepCheckSignature>();
@@ -428,7 +428,7 @@ void TpkInstaller::ManifestDirectUpdateSteps() {
   AddStep<ci::configuration::StepParseManifest>(
       ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
       ci::configuration::StepParseManifest::StoreLocation::NORMAL);
-  AddStep<tpk::configuration::StepParsePreload>();
+  AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   AddStep<tpk::pkgmgr::StepManifestAdjustment>();
   AddStep<ci::security::StepCheckSignature>();