From: Sangyoon Jang Date: Thu, 3 Mar 2022 05:05:46 +0000 (+0900) Subject: Keep system and update value for undo operation X-Git-Tag: accepted/tizen/6.5/unified/20220324.134544~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86a05866a86c766d7e19106e9e02dfd4f01b3a3e;p=platform%2Fcore%2Fappfw%2Fapp-installers.git Keep system and update value for undo operation These value must be set for undo operation. Change-Id: I5d2896b82c535489bd8795b2357bf6a4cfa3153f Signed-off-by: Sangyoon Jang (cherry picked from commit f9c9291bdaf5cef264566cd48aa3f56be8a3fd04) --- diff --git a/src/common/step/configuration/step_parse_preload.cc b/src/common/step/configuration/step_parse_preload.cc index a09e008..d926bdc 100644 --- a/src/common/step/configuration/step_parse_preload.cc +++ b/src/common/step/configuration/step_parse_preload.cc @@ -213,6 +213,36 @@ ci::Step::Status StepParsePreload::AdjustSystem() { return Status::OK; } +ci::Step::Status StepParsePreload::AdjustOldManifest() { + manifest_x* old_manifest = context_->old_manifest_data.get(); + if (!old_manifest) + return Status::OK; + + free(old_manifest->system); + // keep system value for undo operation + if (pkg_query_->IsSystemPackage()) + old_manifest->system = strdup("true"); + else + old_manifest->system = strdup("false"); + if (!old_manifest->system) { + LOG(ERROR) << "Out of memory"; + return Status::ERROR; + } + + free(old_manifest->update); + // keep update value for undo operation + if (pkg_query_->IsUpdatedPackage()) + old_manifest->update = strdup("true"); + else + old_manifest->update = strdup("false"); + if (!old_manifest->update) { + LOG(ERROR) << "Out of memory"; + return Status::ERROR; + } + + return Status::OK; +} + ci::Step::Status StepParsePreload::process() { req_type_ = context_->request_type.get(); pkg_query_.reset( @@ -241,6 +271,10 @@ ci::Step::Status StepParsePreload::process() { if (ret != Status::OK) return ret; + ret = AdjustOldManifest(); + if (ret != Status::OK) + return ret; + return Status::OK; } diff --git a/src/common/step/configuration/step_parse_preload.h b/src/common/step/configuration/step_parse_preload.h index 01d1541..21cae22 100644 --- a/src/common/step/configuration/step_parse_preload.h +++ b/src/common/step/configuration/step_parse_preload.h @@ -33,6 +33,7 @@ class StepParsePreload : public common_installer::Step { bool ValidateAttrs(); Status AdjustUpdate(); Status AdjustSystem(); + Status AdjustOldManifest(); common_installer::RequestType req_type_; std::unique_ptr pkg_query_;