From 9c8ab2b8902e65fb3538e1f93c3b53f92901b0d2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 8 Oct 2015 12:47:12 +0200 Subject: More dependency satisfaction tests and minor fixes --- bpkg/build.cxx | 23 +++++++++++++++-------- bpkg/test.sh | 23 +++++++++++++++++++---- 2 files changed, 34 insertions(+), 12 deletions(-) (limited to 'bpkg') diff --git a/bpkg/build.cxx b/bpkg/build.cxx index b91609d..d8e3bfc 100644 --- a/bpkg/build.cxx +++ b/bpkg/build.cxx @@ -332,9 +332,8 @@ namespace bpkg continue; } - const char* a (r < 0 ? "upgrade" : "downgrade"); - - fail << "unable to " << a << " package " << n << " to " << v << + fail << "unable to " << (r < 0 ? "up" : "down") << "grade " + << "package " << n << " " << sp->version << " to " << v << info << pd.name << " depends on (" << n << " " << c << ")" << info << "explicitly specify " << n << " version to manually " << "satisfy this constraint"; @@ -398,8 +397,14 @@ namespace bpkg auto rp (find_available (db, d.name, ar, d.constraint)); if (rp.first == nullptr) - fail << "unknown prerequisite " << d << " of package " << name << - info << "repository " << ar->location << " appears to be broken"; + { + diag_record dr; + dr << fail << "unknown prerequisite " << d << " of package " << name; + + if (!ar->location.empty ()) + dr << info << "repository " << ar->location << " appears to " + << "be broken"; + } // Next see if this package is already selected. If we already // have it in the configuraion and it satisfies our dependency @@ -436,16 +441,18 @@ namespace bpkg // if (collect (options, cd, db, move (dp)) && force) { - const version& v (rp.first->version); + const version& sv (dsp->version); + const version& av (rp.first->version); - bool u (v > dsp->version); + bool u (av > sv); bool c (d.constraint); diag_record dr; (u ? dr << warn : dr << fail) << "package " << name << " dependency on " << (c ? "(" : "") << d << (c ? ")" : "") << " is forcing " - << (u ? "up" : "down") << "grade of " << d.name << " to " << v; + << (u ? "up" : "down") << "grade of " << d.name << " " << sv + << " to " << av; if (!u) dr << info << "explicitly specify version downgrade to continue"; diff --git a/bpkg/test.sh b/bpkg/test.sh index 815fc89..e882535 100755 --- a/bpkg/test.sh +++ b/bpkg/test.sh @@ -91,8 +91,6 @@ function gone () fi } -if false; then - ## ## rep-create ## @@ -613,8 +611,6 @@ test pkg-purge $pkg ## High-level commands. ## -fi - ## ## build ## @@ -671,6 +667,9 @@ test pkg-purge libfoo # test rep-create ../tests/repository/1/satisfy/t2 test cfg-create --wipe + +fail build ../tests/repository/1/satisfy/libbar-1.0.0.tar.gz + test rep-add ../tests/repository/1/satisfy/t2 test rep-fetch @@ -875,3 +874,19 @@ build libbar 1.1.0 build libbaz 1.1.0 EOF test pkg-purge libfoo + +# dependent prevents upgrade/downgrade +# +test pkg-fetch libfoo 1.1.0 +test pkg-unpack libfoo +test pkg-configure libfoo +test pkg-fetch libbar 1.1.0 +test pkg-unpack libbar +test pkg-configure libbar +fail build -p ../tests/repository/1/satisfy/libfoo-1.2.0.tar.gz +fail build -p libfoo/1.0.0 +test build -p libfoo/1.1.0 <<< "build libfoo 1.1.0" +test pkg-disfigure libbar +test pkg-disfigure libfoo +test pkg-purge libbar +test pkg-purge libfoo -- cgit v1.1