#include <pkgmgr-info.h>
#include <rpk_manifest_handlers/package_handler.h>
+#include <rpk_manifest_handlers/allowed_package_handler.h>
#include <common/installer_context.h>
#include <common/step/step.h>
const char kManifestFileName[] = "tizen-manifest.xml";
+const char kManifestKey[] = "manifest";
+
+const char kAllowedPackageKey[] = "manifest.allowed-package";
+
+
} // namespace
// Copy data from ManifestData to InstallerContext
std::shared_ptr<const rpk::parse::PackageInfo> info =
std::static_pointer_cast<const rpk::parse::PackageInfo>(
- parser_->GetManifestData(kManifestFileName));
+ parser_->GetManifestData(kManifestKey));
context_->pkgid.set(info->package());
bool StepParseRpkManifest::FillManifestX(manifest_x* manifest) {
if (!FillPackageInfo(manifest))
return false;
+
+ if (!FillAllowedPackageInfo(manifest))
+ return false;
+
+ // author
+
+ // description
+
+ // dependencies
return true;
}
bool StepParseRpkManifest::FillPackageInfo(manifest_x* manifest) {
std::shared_ptr<const rpk::parse::PackageInfo> pkg_info =
std::static_pointer_cast<const rpk::parse::PackageInfo>(
- parser_->GetManifestData(kManifestFileName));
+ parser_->GetManifestData(kManifestKey));
if (!pkg_info) {
LOG(ERROR) << "Package info manifest data has not been found.";
return false;
return true;
}
+bool StepParseRpkManifest::FillAllowedPackageInfo(manifest_x* manifest) {
+ // add allowed-package info
+ std::shared_ptr<const rpk::parse::AllowedPackageInfoList> allowed_pkg_info_list =
+ std::static_pointer_cast<const rpk::parse::AllowedPackageInfoList>(
+ parser_->GetManifestData(kAllowedPackageKey));
+ if (!allowed_pkg_info_list) {
+ LOG(ERROR) << "Package info manifest data has not been found.";
+ return false;
+ }
+
+ auto& allowed_pkg_list = allowed_pkg_info_list->allowed_packages();
+ if (allowed_pkg_list.size() == 0)
+ return true;
+/*
+ // TODO: this should be activated after manifest has variables for these
+ for (auto& allowed_pkg : allowed_pkg_list) {
+ // add allowed-package info
+ std::string pkgid = allowed_pkg->get_pkgid();
+ auto& required_privileges = allowed_pkg->get_privileges();
+ }
+*/
+
+ return true;
+}
+
} // namespace configuration
} // namespace rpk