From 32e4cffb444d4ad936c9037eecea9bd78f81f3d0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 13 Jun 2023 21:05:35 +0300 Subject: Add --mask-repository pkg-build option --- bpkg/pkg-build-collect.cxx | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'bpkg/pkg-build-collect.cxx') diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx index 86dcb24..73b5dc0 100644 --- a/bpkg/pkg-build-collect.cxx +++ b/bpkg/pkg-build-collect.cxx @@ -153,7 +153,20 @@ namespace bpkg // If adjustment or orphan, then new and old are the same. // - if (available == nullptr || available->locations.empty ()) + small_vector, 8> locations; + + if (available != nullptr) + { + locations.reserve (available->locations.size ()); + + for (const package_location& pl: available->locations) + { + if (!masked_repository_fragment (pl.repository_fragment)) + locations.push_back (pl); + } + } + + if (locations.empty ()) { assert (selected != nullptr); @@ -169,7 +182,7 @@ namespace bpkg } else { - const package_location& pl (available->locations[0]); + const package_location& pl (locations[0]); if (pl.repository_fragment.object_id () == "") // Special root? { @@ -189,7 +202,7 @@ namespace bpkg // Note that such repository fragments are always preferred over // others (see below). // - for (const package_location& pl: available->locations) + for (const package_location& pl: locations) { const repository_location& rl ( pl.repository_fragment.load ()->location); @@ -1127,7 +1140,7 @@ namespace bpkg void build_packages:: enter (package_name name, build_package pkg) { - assert (!pkg.action); + assert (!pkg.action && pkg.repository_fragment == nullptr); database& db (pkg.db); // Save before the move() call. auto p (map_.emplace (package_key {db, move (name)}, @@ -1157,6 +1170,9 @@ namespace bpkg tracer trace ("collect_build"); + assert (pkg.repository_fragment == nullptr || + !masked_repository_fragment (pkg.repository_fragment)); + // See the above notes. // bool recursive (dep_chain != nullptr); -- cgit v1.1