Add logics for parsing and set api-version into manifest
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 11 May 2021 08:15:32 +0000 (17:15 +0900)
committer연정현/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jungh.yeon@samsung.com>
Wed, 12 May 2021 07:12:49 +0000 (16:12 +0900)
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/rpk/step/configuration/step_parse_rpk_manifest.cc
src/rpk_manifest_handlers/package_handler.cc
src/rpk_manifest_handlers/package_handler.h

index 6131ccd..73b30b0 100644 (file)
@@ -224,6 +224,7 @@ bool StepParseRpkManifest::FillPackageInfo(manifest_x* manifest) {
   manifest->ns = strdup(pkg_info->xmlns().c_str());
   manifest->package = strdup(pkg_info->package().c_str());
   manifest->version = strdup(pkg_info->version().c_str());
+  manifest->api_version = strdup(pkg_info->api_version().c_str());
 
 /*
   // TODO: add this code when manifest has variables for these
index b824180..cd659e6 100755 (executable)
@@ -25,6 +25,7 @@ const char kPackage[] = "@package";
 const char kVersion[] = "@version";
 const char kResourceType[] = "@res-type";
 const char kResourceVersion[] = "@res-version";
+const char kApiVersion[] = "@api-version";
 const char kManifestKey[] = "manifest";
 const std::set<std::string> kPackageTypeAllowedValues =
     {"rpk"};
@@ -42,12 +43,15 @@ bool ParsePackageAndStore(
   manifest_dict.GetString(kResourceType, &res_type);
   std::string res_version;
   manifest_dict.GetString(kResourceVersion, &res_version);
+  std::string api_version;
+  manifest_dict.GetString(kApiVersion, &api_version);
 
   pkg_info->set_xmlns(xmlns);
   pkg_info->set_package(package);
   pkg_info->set_version(version);
   pkg_info->set_res_type(res_type);
   pkg_info->set_res_version(res_version);
+  pkg_info->set_api_version(api_version);
 
   return true;
 }
index f875777..b8a0c64 100755 (executable)
@@ -59,6 +59,10 @@ class PackageInfo : public parser::ManifestData {
     res_version_ = std::move(res_version);
   }
 
+  void set_api_version(std::string api_version) {
+    api_version_ = std::move(api_version);
+  }
+
   /**
    * @brief xmlns
    * @return xmlns string
@@ -85,16 +89,22 @@ class PackageInfo : public parser::ManifestData {
   const std::string& res_type() const {
     return res_type_;
   }
+
   const std::string& res_version() const {
     return res_version_;
   }
 
+  const std::string& api_version() const {
+    return api_version_;
+  }
+
  private:
   std::string xmlns_;
   std::string package_;
   std::string version_;
   std::string res_type_;
   std::string res_version_;
+  std::string api_version_;
 };
 
 /**