From c4d16fac879a62ebfcb2d2b4b3748ea10d3f574d Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Mon, 10 Aug 2015 08:48:11 +0200 Subject: [PATCH] Fix RDS when no start file is updated RDS failed to work when start file was not updated due to switch to WidgetConfigParser that has additional filesystem checks for start file. StepParse has flags_ parameter now to prevent RDS from failing when start file is localized. Fixed backup path of files. Requeries submit of: https://review.tizen.org/gerrit/#/c/45895/ Change-Id: I129a5face58c51324de0fd774c39008cceac86f0 --- src/wgt/step/step_parse.cc | 12 ++++++++++++ src/wgt/step/step_parse.h | 4 +++- src/wgt/step/step_parse_recovery.cc | 5 +++++ src/wgt/step/step_parse_recovery.h | 2 +- src/wgt/step/step_rds_modify.cc | 6 +++--- src/wgt/wgt_installer.cc | 8 +++++--- 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/wgt/step/step_parse.cc b/src/wgt/step/step_parse.cc index 00db36f..55694a1 100755 --- a/src/wgt/step/step_parse.cc +++ b/src/wgt/step/step_parse.cc @@ -58,6 +58,12 @@ namespace parse { namespace app_keys = wgt::application_widget_keys; namespace manifest_keys = wgt::application_manifest_keys; +StepParse::StepParse(common_installer::ContextInstaller* context, + bool check_start_file) + : Step(context), + check_start_file_(check_start_file) { +} + std::set StepParse::ExtractPrivileges( std::shared_ptr perm_info) const { return perm_info->GetAPIPermissions(); @@ -289,6 +295,12 @@ common_installer::Step::Status StepParse::process() { LOG(ERROR) << "[Parse] Parse failed. " << parser_->GetErrorMessage(); return common_installer::Step::Status::ERROR; } + if (check_start_file_) { + if (!parser_->HasValidStartFile()) { + LOG(ERROR) << "No valid start file" << parser_->GetErrorMessage(); + return common_installer::Step::Status::ERROR; + } + } const manifest_x* manifest = context_->manifest_data.get(); if (!FillManifestX(const_cast(manifest))) { diff --git a/src/wgt/step/step_parse.h b/src/wgt/step/step_parse.h index 0c2a37e..b0b4d49 100644 --- a/src/wgt/step/step_parse.h +++ b/src/wgt/step/step_parse.h @@ -23,7 +23,8 @@ namespace parse { class StepParse : public common_installer::Step { public: - using Step::Step; + explicit StepParse(common_installer::ContextInstaller* context, + bool check_start_file); Status process() override; Status clean() override { return Status::OK; } @@ -53,6 +54,7 @@ class StepParse : public common_installer::Step { bool FillManifestX(manifest_x* manifest); std::unique_ptr parser_; + bool check_start_file_; SCOPE_LOG_TAG(Parse) }; diff --git a/src/wgt/step/step_parse_recovery.cc b/src/wgt/step/step_parse_recovery.cc index 44dd715..9ec6306 100644 --- a/src/wgt/step/step_parse_recovery.cc +++ b/src/wgt/step/step_parse_recovery.cc @@ -16,6 +16,11 @@ const char kResWgtPath[] = "res/wgt"; namespace wgt { namespace parse { +StepParseRecovery::StepParseRecovery( + common_installer::ContextInstaller* context) + : StepParse(context, false) { +} + common_installer::Step::Status StepParseRecovery::process() { (void) StepParse::process(); return Status::OK; diff --git a/src/wgt/step/step_parse_recovery.h b/src/wgt/step/step_parse_recovery.h index 8d7db7c..a117452 100644 --- a/src/wgt/step/step_parse_recovery.h +++ b/src/wgt/step/step_parse_recovery.h @@ -24,7 +24,7 @@ namespace parse { */ class StepParseRecovery : public StepParse { public: - using StepParse::StepParse; + StepParseRecovery(common_installer::ContextInstaller* context); Status process() override; Status precheck() override; diff --git a/src/wgt/step/step_rds_modify.cc b/src/wgt/step/step_rds_modify.cc index c8550c5..2204497 100644 --- a/src/wgt/step/step_rds_modify.cc +++ b/src/wgt/step/step_rds_modify.cc @@ -164,8 +164,7 @@ bool StepRDSModify::PerformBackup(std::string relative_path, if (backup_temp_dir_.empty()) return false; if (operation == Operation::DELETE || operation == Operation::MODIFY) { - bf::path app_path = context_->pkg_path.get() / - context_->manifest_data.get()->mainapp_id;; + bf::path app_path = context_->pkg_path.get() / "res" / "wgt"; bf::path source_path = app_path / relative_path; if (bf::is_directory(source_path)) { if (!cu::CreateDir(backup_temp_dir_ / relative_path)) { @@ -182,7 +181,8 @@ bool StepRDSModify::PerformBackup(std::string relative_path, } bf::copy_file(source_path, tmp_dest_path, error); if (error) { - LOG(ERROR) << "unable to backup file " << error.message(); + LOG(ERROR) << "unable to backup file: " + << source_path << " : " << error.message(); return false; } } diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index e6d881c..9b75632 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -4,6 +4,8 @@ #include "wgt/wgt_installer.h" +#include + #include "common/pkgmgr_interface.h" #include "common/step/step_configure.h" #include "common/step/step_backup_manifest.h" @@ -58,7 +60,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) case ci::RequestType::Install : { AddStep(pkgmgr_); AddStep(); - AddStep(); + AddStep(true); AddStep(); AddStep(); AddStep(); @@ -74,7 +76,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) case ci::RequestType::Update: { AddStep(pkgmgr_); AddStep(); - AddStep(); + AddStep(true); AddStep(); AddStep(); AddStep(); @@ -104,7 +106,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) } case ci::RequestType::Reinstall: { AddStep(pkgmgr_); - AddStep(); + AddStep(false); AddStep(); AddStep(); AddStep(); -- 2.7.4