Add codes for setting installed time and root path
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 11 May 2021 09:31:14 +0000 (18:31 +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/step/configuration/step_parse_rpk_manifest.h

index ec8398642e6e747f253ecef8f19ce345f4721bbd..9588606dc6368cd46ffbd0f3df77f4e225f8ead4 100644 (file)
@@ -13,6 +13,8 @@
 #include <rpk_manifest_handlers/dependencies_handler.h>
 #include <rpk_manifest_handlers/package_handler.h>
 
+#include <chrono>
+#include <string>
 
 #include <common/installer_context.h>
 #include <common/step/step.h>
@@ -213,6 +215,9 @@ bool StepParseRpkManifest::FillManifestX(manifest_x* manifest) {
   if (!FillDependencyInfo(manifest))
     return false;
 
+  if (!FillInstallationInfo(manifest))
+    return false;
+
   return true;
 }
 
@@ -334,5 +339,14 @@ bool StepParseRpkManifest::FillDependencyInfo(manifest_x* manifest) {
   return true;
 }
 
+bool StepParseRpkManifest::FillInstallationInfo(manifest_x* manifest) {
+  manifest->root_path = strdup(
+      (context_->root_application_path.get() / manifest->package).c_str());
+  manifest->installed_time =
+      strdup(std::to_string(std::chrono::system_clock::to_time_t(
+          std::chrono::system_clock::now())).c_str());
+  return true;
+}
+
 }  // namespace configuration
 }  // namespace rpk
index cd5b12402e26df79cfc341c2891d8ad59e217aad..81e39d51ee3d43fae229ce826ca54e526d3c862e 100644 (file)
@@ -53,6 +53,7 @@ class StepParseRpkManifest : public common_installer::Step {
   bool FillAuthorInfo(manifest_x* manifest);
   bool FillDescriptionInfo(manifest_x* manifest);
   bool FillDependencyInfo(manifest_x* manifest);
+  bool FillInstallationInfo(manifest_x* manifest);
 
   std::unique_ptr<rpk::parse::RPKConfigParser> parser_;
   ManifestLocation manifest_location_;