From 8fe369a00e4c230f10611361942086709e2d4f1b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 12 Jun 2018 13:49:29 +0300 Subject: Make project url and email optional in package manifest --- libbpkg/manifest.cxx | 15 +++++++-------- libbpkg/manifest.hxx | 4 ++-- 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 description; std::vector changes; - url_type url; + butl::optional url; butl::optional doc_url; butl::optional src_url; butl::optional package_url; - email_type email; + butl::optional email; butl::optional package_email; butl::optional build_email; std::vector dependencies; -- cgit v1.1