From da6d239d0771142b795d18105aac8d130e85c5ba Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 28 Jul 2023 14:18:53 +0300 Subject: Add another test case for pkg_configure() flaws --- bpkg/pkg-configure.cxx | 15 +++--- .../t8a/libfox-1.0.0.tar.gz | Bin 0 -> 398 bytes .../dependency-alternatives/t8a/tvx-1.0.0.tar.gz | Bin 0 -> 482 bytes tests/pkg-build.testscript | 55 +++++++++++++++++++-- 4 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 tests/common/dependency-alternatives/t8a/libfox-1.0.0.tar.gz create mode 100644 tests/common/dependency-alternatives/t8a/tvx-1.0.0.tar.gz diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx index 5bb7dfa..57ac5ac 100644 --- a/bpkg/pkg-configure.cxx +++ b/bpkg/pkg-configure.cxx @@ -99,17 +99,20 @@ namespace bpkg // // @@ It seems there is a hole in the reconfiguration mode: // - // foo -> libfoo {require {config.libfoo.proto=1} + // foo -> libfoo {prefer {config.libfoo.proto=1} accept(true) // reflect {config.foo.reflect=1}} | - // libfoo {require {config.libfoo.proto=2} + // libfoo {prefer {config.libfoo.proto=2} accept(true) // reflect {config.foo.reflect=2}} - // -> libbar {require {config.libfoo.proto=2}} + // -> libbar {prefer {config.libbar.proto=$config.libfoo.proto} + // accept (config.libbar.proto=2)} // -> libbaz // - // foo is configured with config.foo.reflect=2 + // foo is configured with config.foo.reflect=2 initially. // - // If afterwords libbaz is upgraded, the foo is - // reconfigured with config.foo.reflect=1 + // If afterwords libbaz is upgraded, the foo is reconfigured with + // config.foo.reflect=1 just because we erroneously pick the first + // libfoo alternative (which has been banned by libbar accept clause + // on the previous pkg-build run during negotiation). // // It feels more and more that the proper solution here is to go // "nuclear" and to always "upgrade" re-configuration for a package diff --git a/tests/common/dependency-alternatives/t8a/libfox-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/libfox-1.0.0.tar.gz new file mode 100644 index 0000000..68eee9d Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/libfox-1.0.0.tar.gz differ diff --git a/tests/common/dependency-alternatives/t8a/tvx-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/tvx-1.0.0.tar.gz new file mode 100644 index 0000000..0d719a5 Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/tvx-1.0.0.tar.gz differ diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index a3149ae..e018a1b 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -5205,9 +5205,9 @@ test.arguments += --sys-no-query %.* EOO - # Note that the current behavior should actually be considered as a - # bug which we will fix eventually. The proper behaviour would be to - # re-evaluate this dependent rather than just to re-configure. + # @@ Note that the current behavior should actually be considered as a + # bug which we will fix eventually. The proper behaviour would be + # to re-evaluate this dependent rather than just to re-configure. # $* ?libfoo 2>>~%EOE% != 0; error: unable to reconfigure dependent tox with reflect clause that refers to dependency configuration variables @@ -5254,6 +5254,55 @@ test.arguments += --sys-no-query $pkg_drop tux } + + : dont-re-evaluate-dependent + : + { + $clone_cfg; + + $* tvx ?libfoo/1.0.0 2>!; + + $pkg_status -r >>EOO; + !tvx configured 1.0.0 + libfoo configured !1.0.0 available 2.0.0 + libfox configured 1.0.0 + EOO + + cat cfg/libfox-1.0.0/build/config.build >>~%EOO%; + %.* + config.libfox.level = 1 + %.* + EOO + + # @@ Note that the current behavior should actually be considered as a + # bug which we will fix eventually. The proper behaviour would be + # to re-evaluate this dependent rather than just to re-configure. + # + $* ?libfoo 2>>~%EOE%; + disfigured tvx/1.0.0 + disfigured libfoo/1.0.0 + fetched libfoo/2.0.0 + unpacked libfoo/2.0.0 + configured libfoo/2.0.0 + configured tvx/1.0.0 + %info: .+tvx-1.0.0.+ is up to date% + updated tvx/1.0.0 + EOE + + $pkg_status -r >>EOO; + !tvx configured 1.0.0 + libfoo configured 2.0.0 + libfox configured 1.0.0 + EOO + + cat cfg/libfox-1.0.0/build/config.build >>~%EOO%; + %.* + config.libfox.level = 1 + %.* + EOO + + $pkg_drop tvx + } } } -- cgit v1.1