From 7f86ee1fd487cb7fd4a1b76949951ad8e4b8b69d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 11 Jul 2018 13:35:50 +0300 Subject: Add support for package project manifest value --- libbpkg/manifest.cxx | 17 +++++++++++++++++ libbpkg/manifest.hxx | 4 ++++ tests/manifest/testscript | 1 + 3 files changed, 22 insertions(+) diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index c2d7eee..b4b1fa5 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -993,6 +993,20 @@ namespace bpkg if (m.version.release && m.version.release->empty ()) bad_value ("invalid package version release"); } + else if (n == "project") + { + if (m.project) + bad_name ("package project redefinition"); + + try + { + m.project = package_name (move (v)); + } + catch (const invalid_argument& e) + { + bad_value (string ("invalid project name: ") + e.what ()); + } + } else if (n == "summary") { if (!m.summary.empty ()) @@ -1399,6 +1413,9 @@ namespace bpkg s.next ("name", name.string ()); s.next ("version", version.string ()); + if (project) + s.next ("project", project->string ()); + if (priority) { size_t v (*priority); diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index 72af14c..cd81d6e 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -388,6 +388,7 @@ namespace bpkg package_name name; version_type version; + butl::optional project; butl::optional priority; std::string summary; std::vector license_alternatives; @@ -412,6 +413,9 @@ namespace bpkg butl::optional sha256sum; butl::optional fragment; + const package_name& + effective_project () const noexcept {return project ? *project : name;} + public: package_manifest () = default; // VC export. package_manifest (butl::manifest_parser&, bool ignore_unknown = false); diff --git a/tests/manifest/testscript b/tests/manifest/testscript index 77a27ea..f9a42cb 100644 --- a/tests/manifest/testscript +++ b/tests/manifest/testscript @@ -97,6 +97,7 @@ : name: libfoo version: 1.2.3+2 + project: foo priority: high; Due to critical bug fix. summary: Modern XML parser license: LGPLv2, MIT; Both required. -- cgit v1.1