From ce6eb3555b1264c14563eb383c25f4132c0d2a89 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Sep 2015 13:47:35 +0200 Subject: Add location to package manifest --- bpkg/manifest | 4 ++++ bpkg/manifest.cxx | 27 +++++++++++++++++++++++++++ tests/manifest/manifest | 3 +++ 3 files changed, 34 insertions(+) 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 dependencies; std::vector requirements; + // The following values are only valid in the manifest list. + // + butl::optional 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 -- cgit v1.1