aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-07-29 20:58:19 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-07-29 20:58:44 +0300
commit5fa12c54ad71feb0d493537ceed4d1a1d8208943 (patch)
tree0167a2a59a9987131c988b5436f29f13b3bb9b74
parent6d28b0449f27781b94a0b6633db728a323efd71e (diff)
Add support for src-url and doc-url package manifest values
-rw-r--r--libbpkg/manifest.cxx73
-rw-r--r--libbpkg/manifest.hxx2
-rw-r--r--manifest1
-rw-r--r--tests/manifest/testscript4
4 files changed, 52 insertions, 28 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx
index b7f744f..64c0b90 100644
--- a/libbpkg/manifest.cxx
+++ b/libbpkg/manifest.cxx
@@ -695,6 +695,28 @@ namespace bpkg
build_constraints.emplace_back (e, move (nm), move (tg), move (c));
};
+ auto parse_url = [&bad_value] (string&& v, const char* what) -> url_type
+ {
+ string c (split_comment (v));
+
+ if (v.empty ())
+ bad_value (string ("empty ") + what + " url");
+
+ return url_type (move (v), move (c));
+ };
+
+ auto parse_email = [&bad_value] (string&& v,
+ const char* what,
+ bool empty = false) -> email_type
+ {
+ string c (split_comment (v));
+
+ if (v.empty () && !empty)
+ bad_value (string ("empty ") + what + " email");
+
+ return email_type (move (v), move (c));
+ };
+
for (nv = p.next (); !nv.empty (); nv = p.next ())
{
string& n (nv.name);
@@ -828,57 +850,49 @@ namespace bpkg
if (!url.empty ())
bad_name ("project url redefinition");
- string c (split_comment (v));
-
- if (v.empty ())
- bad_value ("empty project url");
-
- url = url_type (move (v), move (c));
+ url = parse_url (move (v), "project");
}
else if (n == "email")
{
if (!email.empty ())
bad_name ("project email redefinition");
- string c (split_comment (v));
+ email = parse_email (move (v), "project");
+ }
+ else if (n == "doc-url")
+ {
+ if (doc_url)
+ bad_name ("doc url redefinition");
- if (v.empty ())
- bad_value ("empty project email");
+ doc_url = parse_url (move (v), "doc");
+ }
+ else if (n == "src-url")
+ {
+ if (src_url)
+ bad_name ("src url redefinition");
- email = email_type (move (v), move (c));
+ src_url = parse_url (move (v), "src");
}
else if (n == "package-url")
{
if (package_url)
bad_name ("package url redefinition");
- string c (split_comment (v));
-
- if (v.empty ())
- bad_value ("empty package url");
-
- package_url = url_type (move (v), move (c));
+ package_url = parse_url (move (v), "package");
}
else if (n == "package-email")
{
if (package_email)
bad_name ("package email redefinition");
- string c (split_comment (v));
-
- if (v.empty ())
- bad_value ("empty package email");
-
- package_email = email_type (move (v), move (c));
+ package_email = parse_email (move (v), "package");
}
else if (n == "build-email")
{
if (build_email)
bad_name ("build email redefinition");
- string c (split_comment (v));
-
- build_email = email_type (move (v), move (c));
+ build_email = parse_email (move (v), "build", true);
}
else if (n == "priority")
{
@@ -1272,12 +1286,17 @@ namespace bpkg
}
s.next ("url", add_comment (url, url.comment));
+ s.next ("email", add_comment (email, email.comment));
+
+ if (doc_url)
+ s.next ("doc-url", add_comment (*doc_url, doc_url->comment));
+
+ if (src_url)
+ s.next ("src-url", add_comment (*src_url, src_url->comment));
if (package_url)
s.next ("package-url", add_comment (*package_url, package_url->comment));
- s.next ("email", add_comment (email, email.comment));
-
if (package_email)
s.next ("package-email",
add_comment (*package_email, package_email->comment));
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx
index ccc52a6..908eb81 100644
--- a/libbpkg/manifest.hxx
+++ b/libbpkg/manifest.hxx
@@ -365,6 +365,8 @@ namespace bpkg
butl::optional<text_file> description;
std::vector<text_file> changes;
url_type url;
+ butl::optional<url_type> doc_url;
+ butl::optional<url_type> src_url;
butl::optional<url_type> package_url;
email_type email;
butl::optional<email_type> package_email;
diff --git a/manifest b/manifest
index 7bace1e..a53224f 100644
--- a/manifest
+++ b/manifest
@@ -8,6 +8,7 @@ description-file: README
changes-file: NEWS
url: https://build2.org
email: users@build2.org
+src-url: https://git.build2.org/cgit/libbpkg/tree/
build-email: builds@build2.org
requires: c++14
depends: * build2 >= 0.5.0-
diff --git a/tests/manifest/testscript b/tests/manifest/testscript
index a1d936e..d41189e 100644
--- a/tests/manifest/testscript
+++ b/tests/manifest/testscript
@@ -24,9 +24,11 @@
changes: 1.2.3+2: applied upstream patch for critical bug bar
changes: 1.2.3+1: applied upstream patch for critical bug foo
url: http://www.example.org/projects/libfoo/; libfoo project page url
- package-url: http://www.example.org/projects/libbar/1.2.3+2; package url
email: libfoo-users@example.org; Public mailing list, posts by non-members\
are allowed but moderated.
+ doc-url: http://www.example.org/projects/libfoo/man.xhtml; documentation page
+ src-url: https://git.example.org/cgit/libfoo/tree/; source tree url
+ package-url: http://www.example.org/projects/libfoo/1.2.3+2; package url
package-email: libfoo-1.2.3+2@example.org; Bug reports are welcome.
build-email: libfoo-builds@example.org; Mailing list for bbot notification\
emails.