diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-07-05 21:44:50 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-07-10 22:24:59 +0300 |
commit | 98f8d3031eb4b55fcedb753fdd4473b081023db9 (patch) | |
tree | fd6787e635e59582b5b7bb57476e2a1bb2c7ee4c /libbpkg/manifest.cxx | |
parent | 9617f1789d76ab7d07d82b040e41d8bc26754b0b (diff) |
Add support for build include/exclude manifest values
Diffstat (limited to 'libbpkg/manifest.cxx')
-rw-r--r-- | libbpkg/manifest.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index 64daa11..ee71596 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -673,6 +673,25 @@ namespace bpkg if (nv.value != "1") bad_value ("unsupported format version"); + auto add_build_constraint = [&bad_value, this] (bool e, string&& v) + { + string c (split_comment (v)); + size_t p (v.find ('/')); + + string nm (p != string::npos ? v.substr (0, p) : move (v)); + optional<string> tg (p != string::npos + ? optional<string> (string (v, p + 1)) + : nullopt); + + if (nm.empty ()) + bad_value ("empty build configuration name pattern"); + + if (tg && tg->empty ()) + bad_value ("empty build target pattern"); + + build_constraints.emplace_back (e, move (nm), move (tg), move (c)); + }; + for (nv = p.next (); !nv.empty (); nv = p.next ()) { string& n (nv.name); @@ -915,6 +934,14 @@ namespace bpkg requirements.push_back (move (ra)); } + else if (n == "build-include") + { + add_build_constraint (false, move (v)); + } + else if (n == "build-exclude") + { + add_build_constraint (true, move (v)); + } else if (n == "depends") { // Allow specifying ?* in any order. @@ -1270,6 +1297,11 @@ namespace bpkg : (r.buildtime ? "* " : "")) + add_comment (concatenate (r, " | "), r.comment)); + for (const auto& c: build_constraints) + s.next (c.exclusion ? "build-exclude" : "build-include", + add_comment (!c.target ? c.config : c.config + "/" + *c.target, + c.comment)); + if (location) s.next ("location", location->posix_string ()); |