From: Ilho Kim Date: Thu, 4 Jun 2020 04:31:11 +0000 (+0900) Subject: Change routine to check start file X-Git-Tag: accepted/tizen/unified/20200616.171030~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72925c80c61285e2bc28c1dbe3570055772eb63c;p=platform%2Fcore%2Fappfw%2Fwgt-backend.git Change routine to check start file If webapp has not ui application and all service app's type global, routine to check start file is skipped Change-Id: I5108a635525181cbeba8596b27b622914a58bb0d Signed-off-by: Ilho Kim --- diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index b544181..757a3c6 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -161,7 +161,8 @@ StepParse::StepParse(common_installer::InstallerContext* context, bool check_start_file) : Step(context), config_location_(config_location), - check_start_file_(check_start_file) { + check_start_file_(check_start_file), + ui_app_not_exists_(false) { } std::set StepParse::ExtractPrivileges( @@ -368,6 +369,7 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { return true; if (app_info.get()->id().empty()) { + ui_app_not_exists_ = true; if (!AllServiceAppGlobal()) { LOG(ERROR) << "Empty of ui app's id is possible" << " when service app types are all global"; @@ -949,30 +951,6 @@ common_installer::Step::Status StepParse::process() { return common_installer::Step::Status::PARSE_ERROR; } - WgtBackendData* backend_data = - static_cast(context_->backend_data.get()); - - if (check_start_file_) { - if (!parser_->CheckValidStartFile()) { - LOG(ERROR) << parser_->GetErrorMessage(); - return common_installer::Step::Status::PARSE_ERROR; - } - if (!parser_->CheckValidServicesStartFiles()) { - LOG(ERROR) << parser_->GetErrorMessage(); - return common_installer::Step::Status::PARSE_ERROR; - } - } else { - // making backup of content data and services content data - auto content_info = GetManifestDataForKey( - app_keys::kTizenContentKey); - auto service_list = GetManifestDataForKey( - app_keys::kTizenServiceKey); - if (content_info) - backend_data->content.set(*content_info); - if (service_list) - backend_data->service_list.set(*service_list); - } - // Copy data from ManifestData to InstallerContext auto info = GetManifestDataForKey( app_keys::kTizenApplicationKey); @@ -1014,6 +992,32 @@ common_installer::Step::Status StepParse::process() { return common_installer::Step::Status::PARSE_ERROR; } + WgtBackendData* backend_data = + static_cast(context_->backend_data.get()); + + if (check_start_file_) { + if (!ui_app_not_exists_ && !parser_->CheckValidStartFile()) { + LOG(ERROR) << parser_->GetErrorMessage(); + pkgmgr_parser_free_manifest_xml(manifest); + return common_installer::Step::Status::PARSE_ERROR; + } + if (!parser_->CheckValidServicesStartFiles()) { + LOG(ERROR) << parser_->GetErrorMessage(); + pkgmgr_parser_free_manifest_xml(manifest); + return common_installer::Step::Status::PARSE_ERROR; + } + } else { + // making backup of content data and services content data + auto content_info = GetManifestDataForKey( + app_keys::kTizenContentKey); + auto service_list = GetManifestDataForKey( + app_keys::kTizenServiceKey); + if (content_info) + backend_data->content.set(*content_info); + if (service_list) + backend_data->service_list.set(*service_list); + } + context_->pkgid.set(manifest->package); // write pkgid for recovery file diff --git a/src/wgt/step/configuration/step_parse.h b/src/wgt/step/configuration/step_parse.h index c4afe3a..55cd0d7 100644 --- a/src/wgt/step/configuration/step_parse.h +++ b/src/wgt/step/configuration/step_parse.h @@ -81,6 +81,7 @@ class StepParse : public common_installer::Step { std::unique_ptr parser_; ConfigLocation config_location_; bool check_start_file_; + bool ui_app_not_exists_; template std::shared_ptr GetManifestDataForKey(const std::string& key) {