aboutsummaryrefslogtreecommitdiff
path: root/bpkg/manifest
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-25 10:34:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-25 14:46:57 +0200
commita2ccb6406bb1b016aaf31a47c659d06bce0cfc6a (patch)
treedd60c18e41983f87902b4a81e8f761770b541281 /bpkg/manifest
parente83df84b8d0b73896421b52bead0eaa625d4586d (diff)
Add role member to the repository_manifest class
Diffstat (limited to 'bpkg/manifest')
-rw-r--r--bpkg/manifest20
1 files changed, 20 insertions, 0 deletions
diff --git a/bpkg/manifest b/bpkg/manifest
index dfbe5af..75f87bd 100644
--- a/bpkg/manifest
+++ b/bpkg/manifest
@@ -438,10 +438,18 @@ namespace bpkg
return os << l.string ();
}
+ enum class repository_role
+ {
+ base,
+ prerequisite,
+ complement
+ };
+
class repository_manifest
{
public:
repository_location location;
+ butl::optional<repository_role> role;
public:
repository_manifest (manifest_parser&);
@@ -449,6 +457,18 @@ namespace bpkg
void
serialize (manifest_serializer&) const;
+
+ // 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 complete if not) and return that. Otherwise,
+ // throw logic_error.
+ //
+ repository_role
+ effective_role () const;
};
class repository_manifests: public std::vector<repository_manifest>