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_force_clean.h"
7 #include <pkgmgr/pkgmgr_parser.h>
8 #include <pkgmgr-info.h>
9 #include <tzplatform_config.h>
13 #include "common/utils/pkgmgr_query.h"
14 #include "common/installer_context.h"
15 #include "common/utils/manifest_util.h"
17 namespace fs = std::filesystem;
20 namespace common_installer {
23 Step::Status StepCheckForceClean::process() {
24 if (context_->request_type.get() != RequestType::Uninstall &&
25 context_->request_type.get() != RequestType::PartialUninstall)
28 fs::path xml_path = GetManifestLocation(context_->pkgid.get(),
30 context_->is_readonly_package.get());
32 // if manifeset not found but pkg exist in db for target uid, do clean
33 PkgQueryInterface pkg_query(context_->pkgid.get(), context_->uid.get());
34 if (!fs::exists(xml_path) &&
35 pkg_query.IsPackageInstalled()) {
36 context_->force_clean_from_db.set(true);
37 manifest_x* manifest = PkgmgrGenerateManifestInfoFromDB(
38 context_->pkgid.get(), context_->uid.get());
40 LOG(ERROR) << "Failed to get manifest_x from DB";
44 context_->manifest_data.set(manifest);
51 } // namespace common_installer