aboutsummaryrefslogtreecommitdiff
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
parent213f575151429bbfa0869e6d2fe99c1bbc785ce1 (diff)
Add location to package manifest
-rw-r--r--bpkg/manifest4
-rw-r--r--bpkg/manifest.cxx27
-rw-r--r--tests/manifest/manifest3
3 files changed, 34 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.
}
diff --git a/tests/manifest/manifest b/tests/manifest/manifest
index 6aac49e..902a7ac 100644
--- a/tests/manifest/manifest
+++ b/tests/manifest/manifest
@@ -29,6 +29,7 @@ requires: ? ; VC++ 12.0 or later if targeting Windows.
requires: ? ; libc++ standard library if using Clang on Mac OS X.
requires: zlib; Most Linux/UNIX systems already have one; or get it at\
www.zlib.net.
+location: libfoo-1.2.3-2.tar.bz2
:
name: libbar
version: 3.4A.5-6
@@ -38,6 +39,7 @@ tags: c++, xml, modern
description-file: README; Comprehensive description
url: http://www.example.org/projects/libbar/
email: libbar-users@example.org
+location: bar/libbar-3.4A.5-6.tbz
:
name: libbaz
version: 2+3.4A.5-3
@@ -45,3 +47,4 @@ summary: Modern baz system
license: LGPLv2
url: http://www.example.org/projects/libbar/
email: libbaz-users@example.org
+location: libbaz/libbaz-2+3.4A.5-3.tar.gz