From bf42edca4c714138b59f429f44368a71a855902f Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 9 Apr 2020 19:41:49 +0300 Subject: Override build constraints group values hierarchically --- libbpkg/manifest.cxx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'libbpkg/manifest.cxx') diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index 7de5f7e..c1c541f 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -2413,15 +2413,27 @@ namespace bpkg void package_manifest:: override (const vector& nvs, const string& name) { + // Reset the build constraints value sub-group on the first call. + // + bool rbc (true); + auto reset_build_constraints = [&rbc, this] () + { + if (rbc) + { + build_constraints.clear (); + rbc = false; + } + }; + // Reset the builds value group on the first call. // bool rb (true); - auto reset_builds = [&rb, this] () + auto reset_builds = [&rb, &reset_build_constraints, this] () { if (rb) { builds.clear (); - build_constraints.clear (); + reset_build_constraints (); rb = false; } }; @@ -2451,14 +2463,14 @@ namespace bpkg } else if (n == "build-include") { - reset_builds (); + reset_build_constraints (); build_constraints.push_back ( parse_build_constraint (nv, false /* exclusion */, name)); } else if (n == "build-exclude") { - reset_builds (); + reset_build_constraints (); build_constraints.push_back ( parse_build_constraint (nv, true /* exclusion */, name)); -- cgit v1.1