aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-06-12 13:49:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-06-12 13:49:29 +0300
commit8fe369a00e4c230f10611361942086709e2d4f1b (patch)
tree0af323c45da58c9c1fb88fdf87d5b9186b6d6a61
parent8a300f420c276ec92a53259aaa15affda8daa723 (diff)
Make project url and email optional in package manifest
-rw-r--r--libbpkg/manifest.cxx15
-rw-r--r--libbpkg/manifest.hxx4
2 files changed, 9 insertions, 10 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx
index b7c3a75..f155c5a 100644
--- a/libbpkg/manifest.cxx
+++ b/libbpkg/manifest.cxx
@@ -1068,14 +1068,14 @@ namespace bpkg
}
else if (n == "url")
{
- if (!m.url.empty ())
+ if (m.url)
bad_name ("project url redefinition");
m.url = parse_url (v, "project");
}
else if (n == "email")
{
- if (!m.email.empty ())
+ if (m.email)
bad_name ("project email redefinition");
m.email = parse_email (v, "project");
@@ -1323,10 +1323,6 @@ namespace bpkg
bad_value ("no package version specified");
else if (m.summary.empty ())
bad_value ("no package summary specified");
- else if (m.url.empty ())
- bad_value ("no project url specified");
- else if (m.email.empty ())
- bad_value ("no project email specified");
else if (m.license_alternatives.empty ())
bad_value ("no project license specified");
@@ -1423,7 +1419,9 @@ namespace bpkg
s.next ("changes", c.text);
}
- s.next ("url", serializer::merge_comment (url, url.comment));
+ if (url)
+ s.next ("url", serializer::merge_comment (*url, url->comment));
+
if (doc_url)
s.next ("doc-url",
serializer::merge_comment (*doc_url, doc_url->comment));
@@ -1437,7 +1435,8 @@ namespace bpkg
serializer::merge_comment (*package_url,
package_url->comment));
- s.next ("email", serializer::merge_comment (email, email.comment));
+ if (email)
+ s.next ("email", serializer::merge_comment (*email, email->comment));
if (package_email)
s.next ("package-email",
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx
index 82e580d..5e7a748 100644
--- a/libbpkg/manifest.hxx
+++ b/libbpkg/manifest.hxx
@@ -394,11 +394,11 @@ namespace bpkg
strings tags;
butl::optional<text_file> description;
std::vector<text_file> changes;
- url_type url;
+ butl::optional<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> email;
butl::optional<email_type> package_email;
butl::optional<email_type> build_email;
std::vector<dependency_alternatives> dependencies;