From: Arkadiusz Szulakiewicz Date: Mon, 1 Feb 2016 15:01:43 +0000 (+0100) Subject: Modify Uninstall procedure to allow force-uninstall X-Git-Tag: accepted/tizen/mobile/20160205.064214~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56555d1509ea6e1ab49bdc33061c3a3913cd6336;p=platform%2Fcore%2Fappfw%2Fwgt-backend.git Modify Uninstall procedure to allow force-uninstall Change-Id: Ib8336c4ecf53d96d3508d13e37776bd06487538d --- diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index e7ea48a..0a88baf 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -55,6 +55,7 @@ #include "wgt/step/step_remove_encryption_data.h" #include "wgt/step/step_wgt_patch_icons.h" #include "wgt/step/step_wgt_patch_storage_directories.h" +#include "wgt/step/step_wgt_remove_manifest.h" namespace ci = common_installer; @@ -134,13 +135,13 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) ci::parse::StepParseManifest::ManifestLocation::INSTALLED, ci::parse::StepParseManifest::StoreLocation::NORMAL); AddStep(); - AddStep(); AddStep(); AddStep(); AddStep(); AddStep(); AddStep(); AddStep(); + AddStep(); break; case ci::RequestType::Reinstall: // RDS is not supported for hybrid apps diff --git a/src/wgt/CMakeLists.txt b/src/wgt/CMakeLists.txt index 6cb1e7a..405d9e4 100644 --- a/src/wgt/CMakeLists.txt +++ b/src/wgt/CMakeLists.txt @@ -14,6 +14,7 @@ SET(SRCS step/step_wgt_patch_icons.cc step/step_wgt_patch_storage_directories.cc step/step_wgt_resource_directory.cc + step/step_wgt_remove_manifest.cc step/step_add_default_privileges.cc wgt_app_query_interface.cc wgt_installer.cc diff --git a/src/wgt/step/step_wgt_remove_manifest.cc b/src/wgt/step/step_wgt_remove_manifest.cc new file mode 100644 index 0000000..68a982e --- /dev/null +++ b/src/wgt/step/step_wgt_remove_manifest.cc @@ -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 "wgt/step/step_wgt_remove_manifest.h" + +#include +#include +#include + +#include +#include + +#include +#include + +#include "common/utils/file_util.h" + +namespace bf = boost::filesystem; +namespace bs = boost::system; + +namespace wgt { +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/wgt/step/step_wgt_remove_manifest.h b/src/wgt/step/step_wgt_remove_manifest.h new file mode 100644 index 0000000..459d633 --- /dev/null +++ b/src/wgt/step/step_wgt_remove_manifest.h @@ -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 WGT_STEP_STEP_WGT_REMOVE_MANIFEST_H_ +#define WGT_STEP_STEP_WGT_REMOVE_MANIFEST_H_ + +#include + +#include "common/installer_context.h" +#include "common/step/step.h" + +namespace wgt { +namespace pkgmgr { + +/** + * \brief Step responsbile for removing manifest file during uninstallation + */ +class StepRemoveManifest : public common_installer::Step { + public: + using common_installer::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 wgt + +#endif // WGT_STEP_STEP_WGT_REMOVE_MANIFEST_H_ diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 8cf97b0..2397ebd 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -58,6 +58,7 @@ #include "wgt/step/step_wgt_patch_icons.h" #include "wgt/step/step_wgt_patch_storage_directories.h" #include "wgt/step/step_wgt_resource_directory.h" +#include "wgt/step/step_wgt_remove_manifest.h" namespace ci = common_installer; @@ -126,13 +127,13 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) ci::parse::StepParseManifest::ManifestLocation::INSTALLED, ci::parse::StepParseManifest::StoreLocation::NORMAL); AddStep(); - AddStep(); AddStep(); AddStep(); AddStep(); AddStep(); AddStep(); AddStep(); + AddStep(); break; } case ci::RequestType::Reinstall: {