aboutsummaryrefslogtreecommitdiff
path: root/libbpkg/manifest.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-05-03 14:50:05 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-05-03 15:31:20 +0300
commit4c6c50047e085e256a19a91ee84398a3b7c8846f (patch)
tree5a4c6a41fb62798292a66b6a624a63714b85de0e /libbpkg/manifest.hxx
parentd3e5ca3472472d1d6f218f6dc88371a79557880e (diff)
Make base repository manifest optional
Diffstat (limited to 'libbpkg/manifest.hxx')
-rw-r--r--libbpkg/manifest.hxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx
index 15d19fc..81dd5f0 100644
--- a/libbpkg/manifest.hxx
+++ b/libbpkg/manifest.hxx
@@ -917,16 +917,13 @@ namespace bpkg
butl::optional<std::string> fragment;
// Return the effective role of the repository. If the role is not
- // explicitly specified (see the role member above), then calculate
- // the role based on the location. Specifically, if the location is
- // 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 complement if not) and return that. Otherwise,
- // throw std::logic_error.
+ // explicitly specified, then the base role is assumed.
//
repository_role
- effective_role () const;
+ effective_role () const noexcept
+ {
+ return role ? *role : repository_role::base;
+ }
// Return the effective web interface URL based on the specified remote
// repository location. If url is not present, doesn't start with '.', or
@@ -1024,6 +1021,13 @@ namespace bpkg
serialize (butl::manifest_serializer&) const;
};
+ // Search a repository manifest list for the base repository and return its
+ // reference, if found. Otherwise, return a reference to an empty manifest
+ // instance (which is the representation of the default base).
+ //
+ LIBBPKG_EXPORT const repository_manifest&
+ find_base_repository (const std::vector<repository_manifest>&) noexcept;
+
class LIBBPKG_EXPORT signature_manifest
{
public: