Move step remove manifest to app-installer 34/59034/8
authorArkadiusz Szulakiewicz <a.szulakiewi@partner.samsung.com>
Mon, 8 Feb 2016 10:49:33 +0000 (11:49 +0100)
committerArkadiusz Szulakiewicz <a.szulakiewi@partner.samsung.com>
Wed, 10 Feb 2016 13:50:51 +0000 (14:50 +0100)
Change-Id: Ic13e3fea135eab0aad2ccb872b9aaf1b162549d7

src/common/CMakeLists.txt
src/common/step/step_remove_files.cc
src/common/step/step_remove_icons.cc
src/common/step/step_remove_manifest.cc [new file with mode: 0644]
src/common/step/step_remove_manifest.h [new file with mode: 0644]

index b81b621..e85ded1 100644 (file)
@@ -51,6 +51,7 @@ SET(SRCS
   step/step_update_app.cc
   step/step_update_security.cc
   step/step_update_tep.cc
+  step/step_remove_manifest.cc
   utils/dynamic_lib_handle.cc
   utils/file_util.cc
   utils/subprocess.cc
index d44bd85..19ff998 100644 (file)
@@ -10,6 +10,7 @@
 namespace bs = boost::system;
 namespace bf = boost::filesystem;
 
+
 namespace common_installer {
 namespace filesystem {
 
index 11720b8..f73c206 100644 (file)
@@ -16,6 +16,7 @@
 namespace bs = boost::system;
 namespace bf = boost::filesystem;
 
+
 namespace common_installer {
 namespace filesystem {
 
diff --git a/src/common/step/step_remove_manifest.cc b/src/common/step/step_remove_manifest.cc
new file mode 100644 (file)
index 0000000..24bd555
--- /dev/null
@@ -0,0 +1,40 @@
+// 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 "common/step/step_remove_manifest.h"
+
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/system/error_code.hpp>
+
+#include <pkgmgr-info.h>
+#include <pkgmgr_installer.h>
+
+#include <algorithm>
+#include <string>
+
+#include "common/utils/file_util.h"
+
+namespace bf = boost::filesystem;
+namespace bs = boost::system;
+
+namespace common_installer {
+namespace pkgmgr {
+
+
+common_installer::Step::Status StepRemoveManifest::process() {
+  bs::error_code error;
+  bf::remove(context_->xml_path.get(), error);
+
+  if (error) {
+    LOG(ERROR) << "Failed to remove xml manifest file";
+    return Status::MANIFEST_ERROR;
+  }
+  LOG(DEBUG) << "Manifest file removed";
+  return Status::OK;
+}
+
+
+}  // namespace wgt
+}  // namespace pkgmgr
diff --git a/src/common/step/step_remove_manifest.h b/src/common/step/step_remove_manifest.h
new file mode 100644 (file)
index 0000000..0f424d4
--- /dev/null
@@ -0,0 +1,40 @@
+// 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 COMMON_STEP_REMOVE_MANIFEST_H_
+#define COMMON_STEP_REMOVE_MANIFEST_H_
+
+#include <manifest_parser/utils/logging.h>
+
+#include "common/installer_context.h"
+#include "common/step/step.h"
+
+namespace common_installer {
+namespace pkgmgr {
+
+/**
+ * \brief Step responsbile for removing manifest file during uninstallation
+ */
+class StepRemoveManifest : public Step {
+ public:
+  using Step::Step;
+
+  /**
+   * \brief main logic of remove manifest
+   *
+   * \return Status::OK if success, Status::ERROR otherwise
+   */
+  Status process() override;
+
+  Status clean() override { return Status::OK; }
+  Status undo() override { return Status::OK; }
+  Status precheck() override { return Status::OK; }
+
+  SCOPE_LOG_TAG(RemoveManifest)
+};
+
+}  // namespace pkgmgr
+}  // namespace common_installer
+
+#endif  // COMMON_STEP_REMOVE_MANIFEST_H_