Cleanup of application_path 30/41430/1
authorTomasz Iwanek <t.iwanek@samsung.com>
Fri, 29 May 2015 12:17:01 +0000 (14:17 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Mon, 8 Jun 2015 11:26:50 +0000 (13:26 +0200)
Change-Id: Ibcce5a9c7440bbf2e9c4f41ee01bd7010f14ae59

src/common/context_installer.h
src/common/step/step_copy.cc
src/common/step/step_copy_backup.cc
src/common/step/step_parse.cc
src/common/step/step_register_security.cc
src/common/step/step_revoke_security.cc
src/common/step/step_update_security.cc

index b6a446b..6ffca51 100644 (file)
@@ -87,9 +87,6 @@ class ContextInstaller {
   // data from config.xml
   Property<ConfigData> config_data;
 
-  // path for the applications directory
-  Property<boost::filesystem::path> application_path;
-
   // path for the applications root directory
   Property<boost::filesystem::path> root_application_path;
 };
index 19d4cd1..ad21c4a 100644 (file)
@@ -57,12 +57,10 @@ Step::Status StepCopy::precheck() {
 
 Step::Status StepCopy::process() {
   // set application path
-  context_->application_path.set(
+  context_->pkg_path.set(
     context_->root_application_path.get() / context_->pkgid.get());
 
-  bf::path install_path = bf::path(context_->application_path.get());
-
-  context_->pkg_path.set(install_path.string());
+  bf::path install_path = context_->pkg_path.get();
 
   // FIXME: correctly order app's data.
   // If there is 1 app in package, the app's data are stored in
index 4466f31..fb3b71a 100644 (file)
@@ -22,19 +22,19 @@ Step::Status StepCopyBackup::process() {
   assert(!context_->pkgid.get().empty());
 
   // set application path
-  context_->application_path.set(
+  context_->pkg_path.set(
       context_->root_application_path.get() / context_->pkgid.get());
 
-  // set paths
-  install_path_ = context_->application_path.get();
-  context_->pkg_path.set(install_path_.string());
+  install_path_ = context_->pkg_path.get();
 
   // FIXME: correctly order app's data.
   // If there is 1 app in package, app's data are stored in <pkg_path>/<app_id>
   // If there are >1 apps in package, app's data are stored in <pkg_path>
   // considering that multiple apps data are already separated in folders.
-  if (context_->manifest_data.get()->uiapplication &&
-      !context_->manifest_data.get()->uiapplication->next)
+  manifest_x *m = context_->manifest_data.get();
+  if ((m->uiapplication && !m->uiapplication->next && !m->serviceapplication) ||
+      (m->serviceapplication && !m->serviceapplication->next &&
+      !m->uiapplication))
     install_path_ /= bf::path(context_->manifest_data.get()->mainapp_id);
 
   backup_path_ = context_->pkg_path.get();
index 3adb7d4..00d8489 100644 (file)
@@ -38,13 +38,9 @@ Step::Status StepParse::process() {
 
   context_->manifest_data.set(mfx);
 
-  // TODO(t.iwanek): fix me -> it shouldn't be here
-  // set application path
-  context_->application_path.set(
+  context_->pkg_path.set(
       context_->root_application_path.get() / context_->pkgid.get());
 
-  context_->pkg_path.set(context_->application_path.get());
-
   LOG(DEBUG) << "Successfully parse tizen manifest xml";
 
   return Status::OK;
index 44836fb..e735846 100644 (file)
@@ -12,13 +12,13 @@ namespace common_installer {
 namespace security {
 
 Step::Status StepRegisterSecurity::precheck() {
-  if (context_->application_path.get().empty()) {
-    LOG(ERROR) << "application_path attribute is empty";
+  if (context_->pkg_path.get().empty()) {
+    LOG(ERROR) << "pkg_path attribute is empty";
     return Step::Status::INVALID_VALUE;
   }
-  if (!boost::filesystem::exists(context_->application_path.get())) {
-    LOG(ERROR) << "application_path ("
-               << context_->application_path.get()
+  if (!boost::filesystem::exists(context_->pkg_path.get())) {
+    LOG(ERROR) << "pkg_path ("
+               << context_->pkg_path.get()
                << ") path does not exist";
     return Step::Status::INVALID_VALUE;
   }
@@ -38,7 +38,7 @@ Step::Status StepRegisterSecurity::precheck() {
 
 Step::Status StepRegisterSecurity::process() {
   if (!RegisterSecurityContextForApps(
-      context_->pkgid.get(), context_->application_path.get(),
+      context_->pkgid.get(), context_->pkg_path.get(),
       context_->manifest_data.get())) {
     return Status::ERROR;
   }
index a6bcac4..a4ae920 100644 (file)
@@ -21,14 +21,6 @@ Step::Status StepRevokeSecurity::precheck() {
     return Step::Status::INVALID_VALUE;
   }
 
-  // application_path is used in undo, but still, it might need to be checked
-  if (context_->application_path.get().empty()) {
-    LOG(ERROR) << "application_path attribute is empty";
-    // TODO(p.sikorski) during standard process(), it does not need to exist
-    // However, during "undo" application_path has to exist.
-    // return Step::Status::INVALID_VALUE;
-  }
-
   return Step::Status::OK;
 }
 
@@ -45,7 +37,7 @@ Step::Status StepRevokeSecurity::process() {
 
 Step::Status StepRevokeSecurity::undo() {
   if (!RegisterSecurityContextForApps(
-      context_->pkgid.get(), context_->application_path.get(),
+      context_->pkgid.get(), context_->pkg_path.get(),
       context_->manifest_data.get())) {
     LOG(ERROR) << "Failure on re-installing security context for app "
                << context_->pkgid.get();
index 0b275da..a0fc42e 100644 (file)
@@ -11,7 +11,7 @@ namespace update_security {
 
 Step::Status StepUpdateSecurity::process() {
   if (!RegisterSecurityContextForApps(
-      context_->pkgid.get(), context_->application_path.get(),
+      context_->pkgid.get(), context_->pkg_path.get(),
       context_->manifest_data.get())) {
     return Status::ERROR;
   }
@@ -21,7 +21,7 @@ Step::Status StepUpdateSecurity::process() {
 
 Step::Status StepUpdateSecurity::undo() {
   if (!RegisterSecurityContextForApps(
-      context_->pkgid.get(), context_->application_path.get(),
+      context_->pkgid.get(), context_->pkg_path.get(),
       context_->old_manifest_data.get())) {
     return Status::ERROR;
   }