Remove validation in author email and package version number 98/60798/5 accepted/tizen/common/20160302.193929 accepted/tizen/ivi/20160304.062736 accepted/tizen/mobile/20160304.062633 accepted/tizen/tv/20160304.062652 accepted/tizen/wearable/20160304.062715 submit/tizen/20160302.105758
authorTomasz Iwanek <t.iwanek@samsung.com>
Wed, 2 Mar 2016 08:54:18 +0000 (09:54 +0100)
committerTomasz Iwanek <t.iwanek@samsung.com>
Wed, 2 Mar 2016 10:20:24 +0000 (11:20 +0100)
Verification: run "tpk-backend -y ${pkgid}" for every preloaded app in mobile profile.
All manifests should validate no matter the content.

Change-Id: Ia13fd01db26291396c613de65f5ba795836fb55d

src/tpk_manifest_handlers/author_handler.cc
src/tpk_manifest_handlers/description_handler.cc
src/tpk_manifest_handlers/package_handler.cc

index e1a765710ca360bf793a68b9220b06039583f7c6..61b1a28be1cf1f332d1fc865e9161be83bbe1ad7 100644 (file)
@@ -48,25 +48,19 @@ void ParseAuthorAndStore(
 bool AuthorHandler::Parse(
     const parser::Manifest& manifest,
     std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+    std::string* /*error*/) {
   std::shared_ptr<AuthorInfo> author(new AuthorInfo());
-  parser::Value* value = nullptr;
-  if (!manifest.Get(kAuthorKey, &value)) {
+
+  auto items = parser::GetOneOrMany(manifest.value(), kAuthorKey, "");
+  // TODO(t.iwanek): handle multiple authors
+  if (items.empty())
     return true;
-  }
 
-  if (value->GetType() == parser::Value::TYPE_DICTIONARY) {
-    const parser::DictionaryValue* dict;
-    value->GetAsDictionary(&dict);
-    ParseAuthorAndStore(*dict, author.get());
+  ParseAuthorAndStore(*items[0], author.get());
 
-    // for preload apps
-    if (author->name().empty())
-      return true;
-  } else {
-    *error = "Cannot parse author element";
-    return false;
-  }
+  // TODO(t.iwanek): don't skip it when preloaded apps will be fixed.
+  if (author->name().empty())
+    return true;
 
   *output = std::static_pointer_cast<parser::ManifestData>(author);
   return true;
@@ -83,10 +77,8 @@ bool AuthorHandler::Validate(
     *error = "The email child element of author element is obligatory";
     return false;
   }
-  if (!parser::ValidateEmailAddress(author.email())) {
-    *error = "The author email address is not valid";
-    return false;
-  }
+
+  // TODO(t.iwanek): validate email address when preloaded apps will be fixed.
 
 
   const std::string& href = author.href();
index 95bb96f1978dba36c4c10e9971987162961cf785..3d140e9ac15f44b3a37a2eb1bfaa26973d9ded4b 100644 (file)
@@ -31,7 +31,7 @@ void ParseDescriptionAndStore(
   std::string xml_lang;
   description_dict.GetString(kDescriptionLangKey, &xml_lang);
 
-  // ignore empty <description> for preloaded apps
+  // TODO(t.iwanek): do not skip it when preloaded apps will be fixed.
   if (description.empty())
     return;
 
index 80235159200c40ab5f662f6bad5c556cf355edc7..79d5d207bb7d920e69ece909e48459162072285c 100644 (file)
@@ -168,11 +168,8 @@ bool PackageHandler::Validate(
         "The version child element of manifest element is obligatory";
     return false;
   }
-  if (!utils::VersionNumber(version).IsValidTizenPackageVersion()) {
-    *error =
-        "The version child element of manifest element is invalid";
-    return false;
-  }
+  // TODO(t.iwanek): use IsValidTizenPackageVersion() for version number if
+  // preloaded apps will be fixed.
 
   return true;
 }