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 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'bpkg') 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. } -- cgit v1.1