aboutsummaryrefslogtreecommitdiff
path: root/bpkg
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-04 13:47:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-04 13:47:35 +0200
commitce6eb3555b1264c14563eb383c25f4132c0d2a89 (patch)
treef8ae90c809161d63e71efaa67d1005631ade6f2d /bpkg
parent213f575151429bbfa0869e6d2fe99c1bbc785ce1 (diff)
Add location to package manifest
Diffstat (limited to 'bpkg')
-rw-r--r--bpkg/manifest4
-rw-r--r--bpkg/manifest.cxx27
2 files changed, 31 insertions, 0 deletions
diff --git a/bpkg/manifest b/bpkg/manifest
index 10d1980..0f03371 100644
--- a/bpkg/manifest
+++ b/bpkg/manifest
@@ -291,6 +291,10 @@ namespace bpkg
std::vector<dependency_alternatives> dependencies;
std::vector<requirement_alternatives> requirements;
+ // The following values are only valid in the manifest list.
+ //
+ butl::optional<butl::path> location;
+
public:
package_manifest (manifest_parser&);
package_manifest (manifest_parser&, manifest_name_value start);
diff --git a/bpkg/manifest.cxx b/bpkg/manifest.cxx
index 5e8da1a..d080fbb 100644
--- a/bpkg/manifest.cxx
+++ b/bpkg/manifest.cxx
@@ -663,6 +663,30 @@ namespace bpkg
dependencies.push_back (da);
}
+ // Manifest list names. Currently we don't check it is indeed a list.
+ //
+ else if (n == "location")
+ {
+ if (location)
+ bad_name ("package location redefinition");
+
+ try
+ {
+ path l (v);
+
+ if (l.empty ())
+ bad_value ("empty package location");
+
+ if (l.absolute ())
+ bad_value ("absolute package location");
+
+ location = move (l);
+ }
+ catch (const invalid_path&)
+ {
+ bad_value ("invalid package location");
+ }
+ }
else
bad_name ("unknown name '" + n + "' in package manifest");
}
@@ -743,6 +767,9 @@ namespace bpkg
(r.conditional ? "? " : "") +
add_comment (concatenate (r, " | "), r.comment));
+ if (location)
+ s.next ("location", location->posix_string ());
+
s.next ("", ""); // End of manifest.
}