1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache 2.0 license that can be
3 // found in the LICENSE file.
5 #include "common/step/pkgmgr/step_check_removable.h"
13 #include "common/installer/app_installer.h"
14 #include "common/pkgmgr_dependency.h"
15 #include "common/utils/pkgmgr_query.h"
17 namespace common_installer {
20 Step::Status StepCheckRemovable::process() {
21 if (context_->force_remove.get())
24 PkgQueryInterface pkg_query(context_->pkgid.get().c_str(),
26 if (!pkg_query.IsValid()) {
27 LOG(ERROR) << "This package is not installed";
28 return Status::INVALID_VALUE;
30 bool removable = pkg_query.IsRemovablePackage();
31 if (pkg_query.GetLastOperationError() != PMINFO_R_OK)
32 return Status::INVALID_VALUE;
35 LOG(ERROR) << "This package is not removable";
36 return Status::OPERATION_NOT_ALLOWED;
42 Step::Status StepCheckRemovable::precheck() {
43 if (context_->pkgid.get().empty())
44 return Status::INVALID_VALUE;
49 } // namespace common_installer