aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-07-19 15:14:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-07-19 16:47:00 +0300
commitfb8c6c683463a1c18e29d4801bc4f5a33552bf0e (patch)
treef73afb261fb47f619fe7a7fd79d42e95f46506d0
parentc279979af18d59d935512d91c7e75762b914bdfd (diff)
Don't reconfigure re-evaluated dependent if it's dependencies are not reconfigured
-rw-r--r--bpkg/pkg-build-collect.cxx14
-rw-r--r--bpkg/pkg-build.cxx8
-rw-r--r--tests/common/dependency-alternatives/t13a/box-1.0.0.tar.gzbin0 -> 505 bytes
-rw-r--r--tests/pkg-build.testscript114
4 files changed, 126 insertions, 10 deletions
diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx
index c8173b2..729c145 100644
--- a/bpkg/pkg-build-collect.cxx
+++ b/bpkg/pkg-build-collect.cxx
@@ -4716,6 +4716,16 @@ namespace bpkg
lazy_shared_ptr<repository_fragment>> rp (
find_available_fragment (o, pk.db, ed.selected));
+ // Note that a re-evaluated package doesn't necessarily needs to
+ // be reconfigured and thus we don't add the
+ // build_package::adjust_reconfigure flag here.
+ //
+ // Specifically, if none of its dependencies get reconfigured,
+ // then it doesn't need to be reconfigured either since nothing
+ // changes for its config clauses. Otherwise, the
+ // build_package::adjust_reconfigure flag will be added normally
+ // by collect_order_dependents().
+ //
build_package p {
build_package::build,
pk.db,
@@ -4740,7 +4750,6 @@ namespace bpkg
set<package_key> ( // Required by (dependency).
ds.begin (), ds.end ()),
false, // Required by dependents.
- build_package::adjust_reconfigure |
build_package::build_reevaluate};
// Note: not recursive.
@@ -5005,9 +5014,6 @@ namespace bpkg
// Unless the dependency is already being reconfigured, reconfigure
// it if its configuration changes.
//
- // Note that for configured dependents which belong to the
- // configuration cluster this flag is already set (see above).
- //
if (!b->reconfigure ())
{
const shared_ptr<selected_package>& sp (b->selected);
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index f9882b6..ed23ea5 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -5589,10 +5589,14 @@ namespace bpkg
database& db (p.db);
+ // Note: don't update the re-evaluated dependent unless it is
+ // reconfigured.
+ //
if ((*p.action == build_package::adjust && p.reconfigure ()) ||
(*p.action == build_package::build &&
- (p.flags & (build_package::build_repoint |
- build_package::build_reevaluate)) != 0))
+ ((p.flags & build_package::build_repoint) != 0 ||
+ ((p.flags & build_package::build_reevaluate) != 0 &&
+ p.reconfigure ()))))
upkgs.push_back (pkg_command_vars {db.config_orig,
!multi_config () && db.main (),
p.selected,
diff --git a/tests/common/dependency-alternatives/t13a/box-1.0.0.tar.gz b/tests/common/dependency-alternatives/t13a/box-1.0.0.tar.gz
new file mode 100644
index 0000000..be45865
--- /dev/null
+++ b/tests/common/dependency-alternatives/t13a/box-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript
index 3351c8b..a891ca3 100644
--- a/tests/pkg-build.testscript
+++ b/tests/pkg-build.testscript
@@ -275,6 +275,7 @@
# | |-- bar-1.0.0.tar.gz -> liba {prefer {...} accept (...)}
# | |-- baz-1.0.0.tar.gz -> liba {prefer {...} accept (...)}
# | |-- biz-1.0.0.tar.gz -> liba {prefer {...} accept (...)}
+# | |-- box-1.0.0.tar.gz -> liba {prefer {} accept (true) reflect (...)}
# | `-- repositories.manifest
# |
# |-- t13b
@@ -12010,7 +12011,7 @@ test.arguments += --sys-no-query
{
+$clone_root_cfg && $rep_add $rep/t13a && $rep_fetch
- : bar
+ : bar-baz-biz
:
{
$clone_cfg;
@@ -12040,7 +12041,75 @@ test.arguments += --sys-no-query
config.liba.backend = cli
EOO
- $pkg_drop bar
+ # Make sure that since baz doesn't reconfigure liba (it also accepts
+ # the cli backend for liba) the re-evaluated existing dependents bar
+ # and the liba dependency doesn't get reconfigured.
+ #
+ $* baz 2>>~%EOE%;
+ build plan:
+ new baz/1.0.0
+ fetched baz/1.0.0
+ unpacked baz/1.0.0
+ configured baz/1.0.0
+ %info: .+baz.+ is up to date%
+ updated baz/1.0.0
+ EOE
+
+ $pkg_status -r >>EOO;
+ !bar configured 1.0.0
+ liba configured 1.0.0
+ !baz configured 1.0.0
+ liba configured 1.0.0
+ EOO
+
+ cat cfg/liba-1.0.0/build/config.build >>~%EOO%;
+ %.*
+ config.liba.backend = cli
+ EOO
+
+ # Make sure that when biz reconfigures liba (it only accepts the gui
+ # backend for liba), the re-evaluated existing dependents bar and baz
+ # are also reconfigured.
+ #
+ $* biz 2>>~%EOE%;
+ build plan:
+ reconfigure/update liba/1.0.0 (required by bar, baz, biz)
+ config.liba.backend=gui (set by biz)
+ reconfigure baz/1.0.0 (dependent of liba)
+ reconfigure bar/1.0.0 (dependent of liba)
+ new biz/1.0.0
+ disfigured bar/1.0.0
+ disfigured baz/1.0.0
+ disfigured liba/1.0.0
+ fetched biz/1.0.0
+ unpacked biz/1.0.0
+ configured liba/1.0.0
+ configured baz/1.0.0
+ configured bar/1.0.0
+ configured biz/1.0.0
+ %info: .+biz.+ is up to date%
+ %info: .+baz.+ is up to date%
+ %info: .+bar.+ is up to date%
+ updated biz/1.0.0
+ updated baz/1.0.0
+ updated bar/1.0.0
+ EOE
+
+ $pkg_status -r >>EOO;
+ !bar configured 1.0.0
+ liba configured 1.0.0
+ !baz configured 1.0.0
+ liba configured 1.0.0
+ !biz configured 1.0.0
+ liba configured 1.0.0
+ EOO
+
+ cat cfg/liba-1.0.0/build/config.build >>~%EOO%;
+ %.*
+ config.liba.backend = gui
+ EOO
+
+ $pkg_drop bar baz biz
}
: baz
@@ -12161,7 +12230,7 @@ test.arguments += --sys-no-query
$pkg_drop baz bar
}
- : bar-baz-biz
+ : bar-baz-biz-box
:
{
$clone_cfg;
@@ -12207,7 +12276,44 @@ test.arguments += --sys-no-query
config.liba.backend = gui
EOO
- $pkg_drop bar baz biz
+ # Make sure that since box doesn't reconfigure liba (it accepts any
+ # backend for liba and just reflects it in its own configuration) none
+ # of the re-evaluated existing dependents nor the liba dependency get
+ # reconfigured.
+ #
+ $* box 2>>~%EOE%;
+ build plan:
+ new box/1.0.0
+ config.box.liba_backend=gui (set by box)
+ fetched box/1.0.0
+ unpacked box/1.0.0
+ configured box/1.0.0
+ %info: .+box.+ is up to date%
+ updated box/1.0.0
+ EOE
+
+ $pkg_status -r >>EOO;
+ !bar configured 1.0.0
+ liba configured 1.0.0
+ !baz configured 1.0.0
+ liba configured 1.0.0
+ !biz configured 1.0.0
+ liba configured 1.0.0
+ !box configured 1.0.0
+ liba configured 1.0.0
+ EOO
+
+ cat cfg/liba-1.0.0/build/config.build >>~%EOO%;
+ %.*
+ config.liba.backend = gui
+ EOO
+
+ cat cfg/box-1.0.0/build/config.build >>~%EOO%;
+ %.*
+ config.box.liba_backend = gui
+ EOO
+
+ $pkg_drop bar baz biz box
}
}