aboutsummaryrefslogtreecommitdiff
path: root/bpkg
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-12-05 19:27:11 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-12-05 19:34:12 +0300
commit46f9d7673a464273f815aa9ec1e74bfef24398c9 (patch)
tree2858142282c695db61397dd27131eab22663c575 /bpkg
parenta565ec35289fb37da1369d0f9fd73e59f1d5b9dd (diff)
Don't fail implicitly up/down-grading dependency, unless it's version is held
We used to also fail when downgrading non-system dependencies. Now we warn when up/down-grading package-held dependencies, instead.
Diffstat (limited to 'bpkg')
-rw-r--r--bpkg/pkg-build.cxx28
1 files changed, 17 insertions, 11 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 9096026..7002b0f 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -975,13 +975,14 @@ namespace bpkg
bp.constraints.emplace_back (name.string (), *dp.constraint);
// Now collect this prerequisite. If it was actually collected
- // (i.e., it wasn't already there) and we are forcing an upgrade
- // and the version is not held, then warn, unless we are running
- // quiet. Downgrade or upgrade of a held version -- refuse.
+ // (i.e., it wasn't already there) and we are forcing a downgrade or
+ // upgrade, then refuse for a held version, warn for a held package,
+ // and print the info message otherwise, unless the verbosity level is
+ // less than two.
//
// Note though that while the prerequisite was collected it could have
// happen because it is an optional package and so not being
- // pre-collected earlier. Meanwhile the package version was specified
+ // pre-collected earlier. Meanwhile the package was specified
// explicitly and we shouldn't consider that as a dependency-driven
// up/down-grade enforcement.
//
@@ -996,19 +997,24 @@ namespace bpkg
if (p != nullptr && force && !dep_optional)
{
- const version& av (p->available_version ());
-
- // Fail if downgrade non-system package or held.
+ // Fail if the version is held. Otherwise, warn if the package is
+ // held.
//
- bool u (av > dsp->version);
- bool f (dsp->hold_version || (!u && !dsp->system ()));
+ bool f (dsp->hold_version);
+ bool w (!f && dsp->hold_package);
- if (verb || f)
+ if (f || w || verb >= 2)
{
+ const version& av (p->available_version ());
+
+ bool u (av > dsp->version);
bool c (d.constraint);
+
diag_record dr;
- (f ? dr << fail : dr << warn)
+ (f ? dr << fail :
+ w ? dr << warn :
+ dr << info)
<< "package " << name << " dependency on "
<< (c ? "(" : "") << d << (c ? ")" : "") << " is forcing "
<< (u ? "up" : "down") << "grade of " << *dsp << " to ";