aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-04-08 21:14:55 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-04-26 20:39:48 +0300
commitd61e9338c8eda118c5f2afd93827be4a84bdc36a (patch)
tree58e5dfb071feabfad0e4701eae1b2d838e07e22d
parent2f523c3d7a7dcd42859951b1b6898ef49299116d (diff)
Add certificate member to the repository_manifest class
-rw-r--r--bpkg/manifest3
-rw-r--r--bpkg/manifest.cxx32
-rw-r--r--tests/manifest/repositories32
3 files changed, 61 insertions, 6 deletions
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_type> email;
butl::optional<std::string> summary;
butl::optional<std::string> description;
+ butl::optional<std::string> 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 <prefix>/<path> 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 (
diff --git a/tests/manifest/repositories b/tests/manifest/repositories
index bae9c86..06eb8a0 100644
--- a/tests/manifest/repositories
+++ b/tests/manifest/repositories
@@ -10,3 +10,35 @@ email: repoman@cppget.org; General mailing list.
summary: General C++ package repository
description: This is the awesome C++ package repository full of exciting\
stuff.
+certificate: \
+-----BEGIN CERTIFICATE-----
+MIIFLzCCAxegAwIBAgIJAJ71rMp8mDy1MA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
+BAoMDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDDA9uYW1lOmNwcGdldC5vcmcwHhcN
+MTYwNDA4MTc1NTUwWhcNMTcwNDA4MTc1NTUwWjAzMRcwFQYDVQQKDA5Db2RlIFN5
+bnRoZXNpczEYMBYGA1UEAwwPbmFtZTpjcHBnZXQub3JnMIICIjANBgkqhkiG9w0B
+AQEFAAOCAg8AMIICCgKCAgEAwj7lwxkr19ygfNIzQsiKkmyyRG0c5AwMrwvldEk7
+2UIwz5kNb04zveUzQcfNFhau60+xC980Y4TKA4/ScfinyaDfp1I3pmiv4OSDUoBw
+9e8a+4Jyo5fuiA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