From a2d58be61ad1fa3da9e1523b4d1bb9d626716d2e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 20 Oct 2023 22:21:19 +0300 Subject: Fix collect_build_prerequisites() pre-reevaluation mode to always iterate through all the depends clauses --- bpkg/pkg-build-collect.cxx | 16 ++++++++-------- .../dependency-alternatives/t11a/tvz-1.0.0.tar.gz | Bin 0 -> 451 bytes tests/pkg-build.testscript | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 tests/common/dependency-alternatives/t11a/tvz-1.0.0.tar.gz diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx index 9d7a3c8..b16c518 100644 --- a/bpkg/pkg-build-collect.cxx +++ b/bpkg/pkg-build-collect.cxx @@ -4828,15 +4828,15 @@ namespace bpkg } } - // Bail out if the collection is postponed or we are in the - // pre-reevaluation mode and have already collected all the required - // information. + // Bail out if the collection is postponed. // - if (postponed || - (pre_reeval && - r.reevaluation_position.first != 0 && - r.originating_dependency_position.first != 0 && - !r.reevaluation_optional)) + // Note that it's tempting to also bail out in the pre-reevaluation mode + // if we have already collected all the required resulting information + // (reevaluation position, originating dependency position, etc). + // However, in this case we may not detect the dependent deviation and + // thus we always iterate through all the depends clauses. + // + if (postponed) break; } diff --git a/tests/common/dependency-alternatives/t11a/tvz-1.0.0.tar.gz b/tests/common/dependency-alternatives/t11a/tvz-1.0.0.tar.gz new file mode 100644 index 0000000..0743be6 Binary files /dev/null and b/tests/common/dependency-alternatives/t11a/tvz-1.0.0.tar.gz differ diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index e9ea9c2..d3f949d 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -284,6 +284,7 @@ # | |-- tuz-1.0.0.tar.gz -> toz {require {config.toz.extras=true}} # | |-- tux-1.0.0.tar.gz -> libbox {require {config.libbox.extras=true}}, # | | tix == 0.1.0 +# | |-- tvz-1.0.0.tar.gz -> toz == 0.2.0 {require {config.toz.extras=true}} # | |-- dex-1.0.0.tar.gz -> bar {require {config.bar.extras=true}}, # | | libfoo {require {config.libfoo.extras=true}} # | |-- dix-1.0.0.tar.gz -> libbar {require {config.libbar.extras=true}}, @@ -16062,6 +16063,8 @@ test.arguments += --sys-no-query # depends: toz == 0.1.0 (c) # depends: libbar(c) # + # tvz: depends: toz == 0.2.0 (c) + # # toz/0.1.0: # $* bax tiz --verbose 1 2>!; @@ -16521,6 +16524,18 @@ test.arguments += --sys-no-query toz configured 0.1.0 available 1.0.0 0.2.0 EOO + # While at it make sure that we won't be able to build tvz since it + # requires toz of the 0.2.0 version, which can't be satisfied. + # + $* tvz --verbose 1 2>>EOE != 0; + error: unable to upgrade package toz/0.1.0 to 0.2.0 + info: because package tez depends on (toz == 0.1.0) + info: package toz/0.2.0 required by tez, tvz + info: consider re-trying with --upgrade|-u potentially combined with --recursive|-r + info: or explicitly request up/downgrade of package tez + info: or explicitly specify package toz version to manually satisfy these constraints + EOE + $pkg_drop bax tiz tez } @@ -19490,7 +19505,7 @@ test.arguments += --sys-no-query ds = foo fox fux fix fex bar baz bac bat bas bus box bax bux bix \ bex boo biz buz buc tax tex tix tiz toz tez tuz tux dex dix \ - diz dox ''; + diz dox tvz ''; # Prepare the package build list. # -- cgit v1.1