Change routine to check start file 45/235345/2
authorIlho Kim <ilho159.kim@samsung.com>
Thu, 4 Jun 2020 04:31:11 +0000 (13:31 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Thu, 4 Jun 2020 07:18:38 +0000 (16:18 +0900)
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 <ilho159.kim@samsung.com>
src/wgt/step/configuration/step_parse.cc
src/wgt/step/configuration/step_parse.h

index b544181..757a3c6 100644 (file)
@@ -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<std::string> 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<WgtBackendData*>(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<const wgt::parse::ContentInfo>(
-        app_keys::kTizenContentKey);
-    auto service_list = GetManifestDataForKey<const wgt::parse::ServiceList>(
-        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<const wgt::parse::TizenApplicationInfo>(
       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<WgtBackendData*>(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<const wgt::parse::ContentInfo>(
+        app_keys::kTizenContentKey);
+    auto service_list = GetManifestDataForKey<const wgt::parse::ServiceList>(
+        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
index c4afe3a..55cd0d7 100644 (file)
@@ -81,6 +81,7 @@ class StepParse : public common_installer::Step {
   std::unique_ptr<wgt::parse::WidgetConfigParser> parser_;
   ConfigLocation config_location_;
   bool check_start_file_;
+  bool ui_app_not_exists_;
 
   template<typename T>
   std::shared_ptr<const T> GetManifestDataForKey(const std::string& key) {