aboutsummaryrefslogtreecommitdiff
path: root/bpkg
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-08-23 20:37:00 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-09-25 11:35:25 +0300
commitb48bd809a4760bc6e8718adc38837fe62bce1c20 (patch)
tree8830d33b211191f6f080d758802450479746758d /bpkg
parent668ffb5d3258945e35f8f6e62d0395aacc219e23 (diff)
Fix pkg-build not to issue 'unable to reconfigure dependent' instead of 'unable to up/downgrade package' error message
Diffstat (limited to 'bpkg')
-rw-r--r--bpkg/pkg-build.cxx61
-rw-r--r--bpkg/pkg-configure.cxx8
2 files changed, 41 insertions, 28 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index fa3d762..79f89bb 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -6374,6 +6374,38 @@ namespace bpkg
return &i->second;
};
+ // In the simulation mode unconstrain all the unsatisfactory
+ // dependencies, if any, while configuring the dependent (see
+ // build_packages::collect_order_dependents() for details).
+ //
+ // Note: must be called at most once.
+ //
+ auto unconstrain_deps = [simulate,
+ &p,
+ deps = vector<package_key> ()] () mutable
+ {
+ if (simulate)
+ {
+ unsatisfied_dependent* ud (
+ simulate->find_dependent (package_key (p.db, p.name ())));
+
+ if (ud != nullptr)
+ {
+ assert (deps.empty ());
+
+ deps.reserve (ud->dependencies.size ());
+
+ for (const auto& d: ud->dependencies)
+ {
+ const build_package& p (*d.first);
+ deps.emplace_back (p.db, p.name ());
+ }
+ }
+ }
+
+ return !deps.empty () ? &deps : nullptr;
+ };
+
if (ap != nullptr)
{
assert (*p.action == build_package::build);
@@ -6434,7 +6466,8 @@ namespace bpkg
prereqs (),
simulate,
fdb,
- configured_state);
+ configured_state,
+ unconstrain_deps ());
}
}
else // Existing dependent.
@@ -6469,28 +6502,6 @@ namespace bpkg
const dependencies& deps (p.skeleton->available->dependencies);
- // In the simulation mode unconstrain all the unsatisfactory
- // dependencies, if any, while configuring the dependent.
- //
- vector<package_key> unconstrain_deps;
-
- if (simulate)
- {
- unsatisfied_dependent* ud (
- simulate->find_dependent (package_key (pdb, p.name ())));
-
- if (ud != nullptr)
- {
- unconstrain_deps.reserve (ud->dependencies.size ());
-
- for (const auto& d: ud->dependencies)
- {
- const build_package& p (*d.first);
- unconstrain_deps.emplace_back (p.db, p.name ());
- }
- }
- }
-
// @@ Note that on reconfiguration the dependent looses the
// potential configuration variables specified by the user on
// some previous build, which can be quite surprising. Should we
@@ -6509,9 +6520,7 @@ namespace bpkg
simulate,
fdb,
configured_state,
- (!unconstrain_deps.empty ()
- ? &unconstrain_deps
- : nullptr));
+ unconstrain_deps ());
}
t.commit ();
diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx
index 53c104e..c145b28 100644
--- a/bpkg/pkg-configure.cxx
+++ b/bpkg/pkg-configure.cxx
@@ -422,9 +422,13 @@ namespace bpkg
// In the reconfiguration mode ban the usage of the selected
// alternative dependency configuration variables in the subsequent
- // enable and reflect clauses.
+ // enable and reflect clauses, unless we are also unconstraining
+ // dependencies (which indicates it's a relaxed mode that precedes
+ // a drop or failure with better diagnostics).
//
- if (alts == nullptr && !manual && (da.prefer || da.require))
+ if (alts == nullptr && !manual &&
+ unconstrain_deps == nullptr &&
+ (da.prefer || da.require))
{
for (const dependency& d: da)
banned_var_prefixes.push_back (