From d61e9338c8eda118c5f2afd93827be4a84bdc36a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 8 Apr 2016 21:14:55 +0300 Subject: Add certificate member to the repository_manifest class --- bpkg/manifest | 3 ++- bpkg/manifest.cxx | 32 +++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'bpkg') diff --git a/bpkg/manifest b/bpkg/manifest index a6eeb05..d55e714 100644 --- a/bpkg/manifest +++ b/bpkg/manifest @@ -541,6 +541,7 @@ namespace bpkg butl::optional email; butl::optional summary; butl::optional description; + butl::optional certificate; // Return the effective role of the repository. If the role is not // explicitly specified (see the role member above), then calculate @@ -548,7 +549,7 @@ namespace bpkg // empty, then the effective role is base. Otherwise -- prerequisite. // If the role is specified, then verify that it is consistent with // the location value (that is, base if the location is empty and - // prerequisite or complete if not) and return that. Otherwise, + // prerequisite or complement if not) and return that. Otherwise, // throw std::logic_error. // repository_role diff --git a/bpkg/manifest.cxx b/bpkg/manifest.cxx index 3f937a8..b94c2c6 100644 --- a/bpkg/manifest.cxx +++ b/bpkg/manifest.cxx @@ -1704,8 +1704,9 @@ namespace bpkg // Canonical name / part. // string cp ( - strip_path (path_, remote () ? strip_mode::component : strip_mode::path). - posix_string ()); + strip_path ( + path_, remote () ? strip_mode::component : strip_mode::path). + posix_string ()); // Note: allow empty paths (e.g., http://stable.cppget.org/1/). // @@ -1844,6 +1845,16 @@ namespace bpkg description = move (v); } + else if (n == "certificate") + { + if (certificate) + bad_name ("certificate redefinition"); + + if (v.empty ()) + bad_value ("empty certificate"); + + certificate = move (v); + } else if (!iu) bad_name ("unknown name '" + n + "' in repository manifest"); } @@ -1869,6 +1880,9 @@ namespace bpkg if (description) bad_value ("description not allowed"); + + if (certificate) + bad_value ("certificate not allowed"); } } @@ -1927,6 +1941,14 @@ namespace bpkg s.next ("description", *description); } + if (certificate) + { + if (!b) + bad_value ("certificate not allowed"); + + s.next ("certificate", *certificate); + } + s.next ("", ""); // End of manifest. } @@ -1984,9 +2006,9 @@ namespace bpkg // Web interface URL path part. // - // It is important to call strip_path() before appending the relative path. - // Otherwise the effective URL for the path ./../../.. and the repository - // location http://a.com/foo/pkg/1/math will wrongly be + // It is important to call strip_path() before appending the relative + // path. Otherwise the effective URL for the path ./../../.. and the + // repository location http://a.com/foo/pkg/1/math will wrongly be // http://a.com/foo/pkg instead of http://a.com. // dir_path ipath ( -- cgit v1.1