Fix description parsing in StepParseManifest 81/60481/3 accepted/tizen/common/20160301.025441 accepted/tizen/common/20160301.120648 accepted/tizen/common/20160302.193747 accepted/tizen/ivi/20160302.224040 accepted/tizen/mobile/20160302.223953 accepted/tizen/tv/20160302.224006 accepted/tizen/wearable/20160302.224025 submit/tizen/20160229.102401 submit/tizen/20160302.020013 submit/tizen/20160302.065807 submit/tizen_common/20160229.190608
authorTomasz Iwanek <t.iwanek@samsung.com>
Fri, 26 Feb 2016 11:03:31 +0000 (12:03 +0100)
committerTomasz Iwanek <t.iwanek@samsung.com>
Mon, 29 Feb 2016 09:47:42 +0000 (01:47 -0800)
Requires to be submitted with:
 - https://review.tizen.org/gerrit/60480

Change-Id: I353b47bb554f189ce84c7e191c0fa4ea80984669

src/common/step/step_parse_manifest.cc
src/common/step/step_parse_manifest.h

index 2b75a9b..ea81a80 100644 (file)
@@ -229,22 +229,22 @@ bool StepParseManifest::FillAuthorInfo(manifest_x* manifest) {
   return true;
 }
 
-bool StepParseManifest::FillDescription(manifest_x* manifest) {
-  std::shared_ptr<const tpk::parse::DescriptionInfo> description_info =
-      std::static_pointer_cast<const tpk::parse::DescriptionInfo>(
-          parser_->GetManifestData(app_keys::kDescriptionKey));
+bool StepParseManifest::FillDescriptionInfo(manifest_x* manifest) {
+  std::shared_ptr<const tpk::parse::DescriptionInfoList> description_info =
+      std::static_pointer_cast<const tpk::parse::DescriptionInfoList>(
+          parser_->GetManifestData(tpk::parse::DescriptionInfoList::Key()));
 
-  if (!description_info) {
-    LOG(ERROR) << "Description data has not been found.";
-    return false;
-  }
+  if (!description_info)
+    return true;
 
-  description_x* description = reinterpret_cast<description_x*>
-      (calloc(1, sizeof(description_x)));
-  description->text = strdup(description_info->description().c_str());
-  description->lang = !description_info->xml_lang().empty() ?
-      strdup(description_info->xml_lang().c_str()) : strdup(DEFAULT_LOCALE);
-  manifest->description = g_list_append(manifest->description, description);
+  for (auto& desc : description_info->descriptions) {
+    description_x* description = reinterpret_cast<description_x*>
+        (calloc(1, sizeof(description_x)));
+    description->text = strdup(desc.description().c_str());
+    description->lang = !desc.xml_lang().empty() ?
+        strdup(desc.xml_lang().c_str()) : strdup(DEFAULT_LOCALE);
+    manifest->description = g_list_append(manifest->description, description);
+  }
   return true;
 }
 
@@ -691,6 +691,8 @@ bool StepParseManifest::FillManifestX(manifest_x* manifest) {
     return false;
   if (!FillAuthorInfo(manifest))
     return false;
+  if (!FillDescriptionInfo(manifest))
+    return false;
   if (!FillAccounts())
     return false;
   if (!FillShortcuts())
index aa3f883..6853a8a 100644 (file)
@@ -64,7 +64,7 @@ class StepParseManifest : public common_installer::Step {
   bool FillInstallationInfo(manifest_x* manifest);
   bool FillPackageInfo(manifest_x* manifest);
   bool FillAuthorInfo(manifest_x* manifest);
-  bool FillDescription(manifest_x* manifest);
+  bool FillDescriptionInfo(manifest_x* manifest);
   bool FillPrivileges(manifest_x* manifest);
   bool FillWidgetApplication(manifest_x* manifest);
   bool FillServiceApplication(manifest_x* manifest);