From 6202224d079b704ffb9cfbc6972de2be60d38a97 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 8 Feb 2018 18:41:25 +0300 Subject: Add support for git location type to repository manifest --- libbpkg/manifest.cxx | 4 ++-- libbpkg/manifest.hxx | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'libbpkg') diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index 306649d..6a5ff23 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -2160,10 +2160,10 @@ namespace bpkg { static const char* invalid_location ("invalid repository location"); - if (l.local () || l.type () != repository_type::bpkg) + if (l.local ()) throw invalid_argument (invalid_location); - if (!url || (*url)[0] != '.') + if (l.type () != repository_type::bpkg || !url || (*url)[0] != '.') return url; const path rp (*url); diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index 743df48..905eea1 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -376,7 +376,8 @@ namespace bpkg std::vector requirements; std::vector build_constraints; - // The following values are only valid in the manifest list. + // The following values are only valid in the manifest list (and only for + // certain repository types). // butl::optional location; butl::optional sha256sum; @@ -473,9 +474,9 @@ namespace bpkg // // - For the local URL object the path can be relative or absolute. Query // can not be present. Fragment can not be present for the relative path - // as there is no notation that can be used to represent it. The file:// - // notation can be enforced for the absolute path by setting the authority - // to an empty object. + // as there is no notation that can be used to represent it. Represent + // the object as a local path if it is absolute and there is no fragment or + // authority present. // struct LIBBPKG_EXPORT repository_url: butl::basic_url @@ -695,13 +696,14 @@ namespace bpkg public: using email_type = bpkg::email; - repository_location location; // bpkg repository location. + repository_location location; // Non-empy for non-base roles. butl::optional role; - // The following values may only be present for the base repository. + // The following values may only be present for the base repository (and + // only for certain repository types). // butl::optional url; - butl::optional email; + butl::optional email; butl::optional summary; butl::optional description; butl::optional certificate; @@ -719,11 +721,11 @@ namespace bpkg effective_role () const; // Return the effective web interface URL based on the specified remote - // bpkg repository location. If url is not present or doesn't start with - // '.', then return it unchanged. Otherwise, process the relative format - // as described in the manifest specification. Throw std::invalid_argument - // if the relative url format is invalid or if the repository location is - // empty or local. + // repository location. If url is not present, doesn't start with '.', or + // the repository type differs from bpkg, then return it unchanged. + // Otherwise, process the relative format as described in the manifest + // specification. Throw std::invalid_argument if the relative url format is + // invalid or if the repository location is empty or local. // butl::optional effective_url (const repository_location&) const; -- cgit v1.1