From c4c3ab9a49d824eb64dbf3d1e1c6c079ffff92cb Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 27 Jul 2023 21:49:44 +0300 Subject: Fix inability to fetch repository containing toolchain-unsatisfied packages (GH issue #305) Note: the breaking commit is d6d72bc6e454. --- bpkg/rep-fetch.cxx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'bpkg/rep-fetch.cxx') diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index 6f31478..d7f4cc6 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -314,7 +314,10 @@ namespace bpkg if (bs && r.build2_dependency && !satisfy_build2 (co, *r.build2_dependency)) + { bs = false; + pds.clear (); // Won't now be used. + } nvs.push_back (move (r)); } @@ -328,7 +331,9 @@ namespace bpkg } mfs.push_back (move (f)); - pds.push_back (move (d)); + + if (bs) + pds.push_back (move (d)); } // Note that for the directory-based repositories we also query @@ -1110,12 +1115,6 @@ namespace bpkg // if (rl.directory_based ()) { - // Wouldn't be here otherwise. Note that rep_fetch_data is retrieved - // by rep_fetch() with false passed as the ignore_toolchain argument - // (see rep_fetch() for more details). - // - assert (!pis.empty ()); - // Note that we can't check if the external package of this upstream // version and revision is already available in the configuration // until we fetch all the repositories, as some of the available @@ -1129,7 +1128,7 @@ namespace bpkg path_cast (rl.path () / *pm.location), pm.name, pm.version, - &pis[i], + !pis.empty () ? &pis[i] : nullptr, false /* check_external */)); if (v) @@ -1314,6 +1313,12 @@ namespace bpkg // repository fragments list, as well as its prerequisite and complement // repository sets. // + // Note that we do this in the forward compatible manner ignoring + // unrecognized manifest values and unsatisfied build2 toolchain + // constraints in the package manifests. This approach allows older + // toolchains to work with newer repositories, successfully building the + // toolchain-satisfied packages and only failing for unsatisfied ones. + // rep_fetch_data rfd ( rep_fetch (co, &db.config_orig, @@ -1321,7 +1326,7 @@ namespace bpkg rl, dependent_trust, true /* ignore_unknow */, - false /* ignore_toolchain */, + true /* ignore_toolchain */, false /* expand_values */, true /* load_buildfiles */)); -- cgit v1.1