aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-10-20 17:58:14 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-11-02 14:04:08 +0300
commit98bca26343bc015281e5ce6e456818fcdd290bbd (patch)
tree6774a0ee34b227328110e03e146d3a27012ddf44
parent4f2a74494532065205caf508f18c7521b184ee32 (diff)
Fix pkg-build not to collect repointed dependent recursivelly if its collection is postponed
-rw-r--r--bpkg/pkg-build-collect.cxx95
-rw-r--r--tests/common/dependency-alternatives/t8a/dax-1.0.0.tar.gzbin421 -> 461 bytes
-rw-r--r--tests/common/dependency-alternatives/t8a/dix-0.1.0.tar.gzbin0 -> 348 bytes
-rw-r--r--tests/common/dependency-alternatives/t8a/dux-1.0.0.tar.gzbin0 -> 353 bytes
-rw-r--r--tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gzbin350 -> 411 bytes
-rw-r--r--tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gzbin360 -> 416 bytes
-rw-r--r--tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gzbin360 -> 415 bytes
-rw-r--r--tests/pkg-build.testscript96
8 files changed, 166 insertions, 25 deletions
diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx
index 16d0b0b..8f76c0b 100644
--- a/bpkg/pkg-build-collect.cxx
+++ b/bpkg/pkg-build-collect.cxx
@@ -4955,23 +4955,27 @@ namespace bpkg
const function<find_database_function>& fdb,
const function<add_priv_cfg_function>& apc)
{
+ tracer trace ("collect_repointed_dependents");
+
for (const auto& rd: rpt_depts)
{
database& db (rd.first.db);
const package_name& nm (rd.first.name);
- auto i (map_.find (db, nm));
- if (i != map_.end ())
{
- build_package& b (i->second.package);
-
- if (!b.action || *b.action != build_package::adjust)
+ auto i (map_.find (db, nm));
+ if (i != map_.end ())
{
- if (!b.action ||
- (*b.action != build_package::drop && !b.reconfigure ()))
- b.flags |= build_package::adjust_reconfigure;
+ build_package& b (i->second.package);
- continue;
+ if (!b.action || *b.action != build_package::adjust)
+ {
+ if (!b.action ||
+ (*b.action != build_package::drop && !b.reconfigure ()))
+ b.flags |= build_package::adjust_reconfigure;
+
+ continue;
+ }
}
}
@@ -5021,23 +5025,64 @@ namespace bpkg
build_package_refs dep_chain;
- // Note: recursive.
+ package_key pk {db, nm};
+
+ // Note that the repointed dependent can well be a dependency whose
+ // recursive processing should be postponed.
//
- collect_build (o,
- move (p),
- replaced_vers,
- postponed_cfgs,
- unsatisfied_depts,
- &dep_chain,
- fdb,
- apc,
- &rpt_depts,
- &postponed_repo,
- &postponed_alts,
- &postponed_recs,
- &postponed_edeps,
- &postponed_deps,
- &unacceptable_alts);
+ auto i (postponed_deps.find (pk));
+ if (i != postponed_deps.end ())
+ {
+ // Note that here we would collect the repointed dependent recursively
+ // without specifying any configuration for it.
+ //
+ i->second.wout_config = true;
+
+ // Note: not recursive.
+ //
+ collect_build (
+ o, move (p), replaced_vers, postponed_cfgs, unsatisfied_depts);
+
+ l5 ([&]{trace << "dep-postpone repointed dependent " << pk;});
+ }
+ else
+ {
+ const postponed_configuration* pcfg (
+ postponed_cfgs.find_dependency (pk));
+
+ if (pcfg != nullptr)
+ {
+ // Note: not recursive.
+ //
+ collect_build (
+ o, move (p), replaced_vers, postponed_cfgs, unsatisfied_depts);
+
+ l5 ([&]{trace << "dep-postpone repointed dependent " << pk
+ << " since already in cluster " << *pcfg;});
+ }
+ else
+ {
+ build_package_refs dep_chain;
+
+ // Note: recursive.
+ //
+ collect_build (o,
+ move (p),
+ replaced_vers,
+ postponed_cfgs,
+ unsatisfied_depts,
+ &dep_chain,
+ fdb,
+ apc,
+ &rpt_depts,
+ &postponed_repo,
+ &postponed_alts,
+ &postponed_recs,
+ &postponed_edeps,
+ &postponed_deps,
+ &unacceptable_alts);
+ }
+ }
}
}
diff --git a/tests/common/dependency-alternatives/t8a/dax-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/dax-1.0.0.tar.gz
index 34c3aae..3c9f860 100644
--- a/tests/common/dependency-alternatives/t8a/dax-1.0.0.tar.gz
+++ b/tests/common/dependency-alternatives/t8a/dax-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/dependency-alternatives/t8a/dix-0.1.0.tar.gz b/tests/common/dependency-alternatives/t8a/dix-0.1.0.tar.gz
new file mode 100644
index 0000000..706f068
--- /dev/null
+++ b/tests/common/dependency-alternatives/t8a/dix-0.1.0.tar.gz
Binary files differ
diff --git a/tests/common/dependency-alternatives/t8a/dux-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/dux-1.0.0.tar.gz
new file mode 100644
index 0000000..23f5505
--- /dev/null
+++ b/tests/common/dependency-alternatives/t8a/dux-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz
index ce7f270..badb970 100644
--- a/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz
+++ b/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz
index 1dd802e..2a24050 100644
--- a/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz
+++ b/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gz b/tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gz
index 2427346..ddc5435 100644
--- a/tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gz
+++ b/tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript
index 006dde3..e9ea9c2 100644
--- a/tests/pkg-build.testscript
+++ b/tests/pkg-build.testscript
@@ -159,7 +159,10 @@
# | | libbaz
# | |-- bux-1.0.0.tar.gz -> bix
# | |-- dax-1.0.0.tar.gz -> libbar ? ($config.dax.extras)
+# | | libbaz
+# | |-- dix-0.1.0.tar.gz
# | |-- dix-1.0.0.tar.gz -> dax require {config.dax.extras=true}
+# | |-- dux-1.0.0.tar.gz -> dix
# | |-- fax-1.0.0.tar.gz -> libbar ^1.0.0 ? ($cxx.target.class == 'windows') config.fax.backend=libbar |
# | | libbaz ^1.0.0 ? ($cxx.target.class != 'windows') config.fax.backend=libbaz,
# | | libbiz ? ($config.fax.libbiz) config.fax.extras='[b\i$z]',
@@ -4658,9 +4661,13 @@ test.arguments += --sys-no-query
test.arguments += --plan "";
$* dax 2>>~%EOE%;
+ new libbaz/1.1.0 (required by dax)
new dax/1.0.0
+ fetched libbaz/1.1.0
+ unpacked libbaz/1.1.0
fetched dax/1.0.0
unpacked dax/1.0.0
+ configured libbaz/1.1.0
configured dax/1.0.0
%info: .+dax-1.0.0.+ is up to date%
updated dax/1.0.0
@@ -4668,6 +4675,7 @@ test.arguments += --sys-no-query
$pkg_status -r >>EOO;
!dax configured 1.0.0
+ libbaz configured 1.1.0
EOO
$* dix 2>>~%EOE%;
@@ -4690,14 +4698,102 @@ test.arguments += --sys-no-query
$pkg_status -r >>EOO;
!dax configured 1.0.0
libbar configured 1.0.0
+ libbaz configured 1.1.0
!dix configured 1.0.0
!dax configured 1.0.0
libbar configured 1.0.0
+ libbaz configured 1.1.0
EOO
$pkg_drop dax dix
}
+ : repoint-enable-indirect-dependency
+ :
+ {
+ $clone_cfg;
+
+ test.arguments += --plan "";
+
+ $* dax dux ?dix/0.1.0 2>>~%EOE%;
+ new libbaz/1.1.0 (required by dax)
+ new dax/1.0.0
+ new dix/0.1.0 (required by dux)
+ new dux/1.0.0
+ fetched libbaz/1.1.0
+ unpacked libbaz/1.1.0
+ fetched dax/1.0.0
+ unpacked dax/1.0.0
+ fetched dix/0.1.0
+ unpacked dix/0.1.0
+ fetched dux/1.0.0
+ unpacked dux/1.0.0
+ configured libbaz/1.1.0
+ configured dax/1.0.0
+ configured dix/0.1.0
+ configured dux/1.0.0
+ %info: .+dax-1.0.0.+ is up to date%
+ %info: .+dux-1.0.0.+ is up to date%
+ updated dax/1.0.0
+ updated dux/1.0.0
+ EOE
+
+ $pkg_status -r >>EOO;
+ !dax configured 1.0.0
+ libbaz configured 1.1.0
+ !dux configured 1.0.0
+ dix configured !0.1.0 available 1.0.0
+ EOO
+
+ $cfg_create -d cfg2 --name cfg2 &cfg2/***;
+ $cfg_link -d cfg cfg2;
+ $rep_add -d cfg2 $rep/t8a && $rep_fetch -d cfg2;
+
+ $* libbaz +{ --config-name cfg2 } ?dix 2>>~%EOE%;
+ % new libbaz/1.1.0 \[cfg2.\]%
+ new libbar/1.0.0 (required by dax)
+ drop libbaz/1.1.0 (unused)
+ % reconfigure/update dax/1.0.0 \(dependent of libbaz \[cfg2.\]\)%
+ config.dax.extras=true (set by dix)
+ upgrade dix/1.0.0
+ reconfigure dux (dependent of dix)
+ disfigured dux/1.0.0
+ disfigured dix/0.1.0
+ disfigured dax/1.0.0
+ disfigured libbaz/1.1.0
+ %fetched libbaz/1.1.0 \[cfg2.\]%
+ %unpacked libbaz/1.1.0 \[cfg2.\]%
+ fetched libbar/1.0.0
+ unpacked libbar/1.0.0
+ purged libbaz/1.1.0
+ fetched dix/1.0.0
+ unpacked dix/1.0.0
+ %configured libbaz/1.1.0 \[cfg2.\]%
+ configured libbar/1.0.0
+ configured dax/1.0.0
+ configured dix/1.0.0
+ configured dux/1.0.0
+ %info: .+libbaz-1.1.0.+ is up to date%
+ %info: .+dux-1.0.0.+ is up to date%
+ %updated libbaz/1.1.0 \[cfg2.\]%
+ updated dux/1.0.0
+ EOE
+
+ $pkg_status -r >>/EOO;
+ !dax configured 1.0.0
+ libbar configured 1.0.0
+ !libbaz [cfg2/] configured 1.1.0
+ !dux configured 1.0.0
+ dix configured 1.0.0
+ !dax configured 1.0.0
+ libbar configured 1.0.0
+ !libbaz [cfg2/] configured 1.1.0
+ EOO
+
+ $pkg_drop dux;
+ $pkg_drop dax
+ }
+
: reevaluate-alternatives
:
{