aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/pkg-build.cxx48
-rw-r--r--tests/pkg-build.testscript10
-rw-r--r--tests/pkg-system.testscript26
3 files changed, 61 insertions, 23 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 4217b76..156506b 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -10473,9 +10473,19 @@ namespace bpkg
if (apr.empty ())
{
+ string n (arg_string (pa, false /* options */));
+
diag_record dr (fail);
- dr << "unknown package " << arg_string (pa, false /* options */);
- check_any_available (repo_configs, t, &dr);
+ dr << "unknown package " << n;
+ if (sys)
+ {
+ // Feels like we can't end up here if the version was specified
+ // explicitly.
+ //
+ dr << info << "consider specifying " << n << "/*";
+ }
+ else
+ check_any_available (repo_configs, t, &dr);
}
if (pdb != nullptr)
@@ -10526,6 +10536,8 @@ namespace bpkg
bool found (true);
bool sys_advise (false);
+ bool sys (arg_sys (pa));
+
// If the package is not available from the repository we can try to
// create it from the orphaned selected package. Meanwhile that
// doesn't make sense for a system package. The only purpose to
@@ -10533,7 +10545,7 @@ namespace bpkg
// package is not in the repository then there is no dependent for it
// (otherwise the repository would be broken).
//
- if (!arg_sys (pa))
+ if (!sys)
{
// If we failed to find the requested package we can still check if
// the package name is present in the repositories and if that's the
@@ -10576,13 +10588,10 @@ namespace bpkg
}
}
//
- // No explicit version was specified by the user (not relevant for a
- // system package, see above).
+ // No explicit version was specified by the user.
//
else
{
- assert (!arg_sys (pa));
-
if (ap != nullptr)
{
assert (!ap->stub ());
@@ -10619,15 +10628,30 @@ namespace bpkg
if (!sys_advise)
{
- dr << "unknown package " << pa.name;
+ // Note that if the package is not system and its version was
+ // explicitly specified, then we can only be here if no version of
+ // this package is available in source from the repository
+ // (otherwise we would advise to configure it as a system package;
+ // see above). Thus, let's not print it's version constraint in
+ // this case.
+ //
+ // Also note that for a system package we can't end up here if the
+ // version was specified explicitly.
+ //
+ string n (package_string (pa.name, nullopt /* vc */, sys));
+
+ dr << "unknown package " << n;
// Let's help the new user out here a bit.
//
- check_any_available (*pdb, t, &dr);
+ if (sys)
+ dr << info << "consider specifying " << n << "/*";
+ else
+ check_any_available (*pdb, t, &dr);
}
else
{
- assert (!arg_sys (pa));
+ assert (!sys);
dr << arg_string (pa, false /* options */)
<< " is not available in source";
@@ -10644,7 +10668,7 @@ namespace bpkg
//
if (ap == nullptr)
{
- assert (sp != nullptr && sp->system () == arg_sys (pa));
+ assert (sp != nullptr && sp->system () == sys);
auto rp (make_available_fragment (o, *pdb, sp));
ap = move (rp.first);
@@ -10679,7 +10703,7 @@ namespace bpkg
true, // Hold package.
pa.constraint.has_value (), // Hold version.
{}, // Constraints.
- arg_sys (pa),
+ sys,
keep_out,
pa.options.disfigure (),
false, // Configure-only.
diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript
index 6a33757..198e319 100644
--- a/tests/pkg-build.testscript
+++ b/tests/pkg-build.testscript
@@ -2175,7 +2175,10 @@ test.options += --no-progress
$rep_fetch $rep/t0c;
$* '?libbux' 2>'error: unknown package libbux' != 0;
- $* '?sys:libbux' 2>'error: unknown package sys:libbux' != 0;
+ $* '?sys:libbux' 2>>EOE != 0;
+ error: unknown package sys:libbux
+ info: consider specifying sys:libbux/*
+ EOE
$* '?libbar/1.3' 2>'error: unknown package libbar/1.3' != 0;
$* '?libbar[5 7]' 2>"error: unknown package 'libbar [5 7]'" != 0
}
@@ -2242,7 +2245,10 @@ test.options += --no-progress
%.+
EOE
- $* libfoo '?sys:libhello' 2>'error: unknown package sys:libhello' != 0;
+ $* libfoo '?sys:libhello' 2>>EOE != 0;
+ error: unknown package sys:libhello
+ info: consider specifying sys:libhello/*
+ EOE
$* "sys:libhello/2.0@$rep/t0a" --trust-yes 2>>~%EOE% != 0;
%.+
diff --git a/tests/pkg-system.testscript b/tests/pkg-system.testscript
index e300afd..fc4f707 100644
--- a/tests/pkg-system.testscript
+++ b/tests/pkg-system.testscript
@@ -52,10 +52,9 @@ rep_remove += -d cfg 2>!
{
$clone_cfg;
- $pkg_build 'sys:libbar' 2>>/EOE != 0;
- error: unknown package libbar
- info: configuration cfg/ has no repositories
- info: use 'bpkg rep-add' to add a repository
+ $pkg_build 'sys:libbar' 2>>EOE != 0;
+ error: unknown package sys:libbar
+ info: consider specifying sys:libbar/*
EOE
$pkg_build 'sys:libbar/1' 2>>EOE;
@@ -851,7 +850,8 @@ rep_remove += -d cfg 2>!
EOE
$pkg_build 'sys:libbar' 2>>EOE != 0;
- error: unknown package libbar
+ error: unknown package sys:libbar
+ info: consider specifying sys:libbar/*
EOE
$pkg_build foo 'sys:libbar/1' 2>>EOE != 0;
@@ -899,10 +899,18 @@ rep_remove += -d cfg 2>!
# Fail as libbar while being selected is still unknown (not present in t3
# repo).
#
- $pkg_build 'sys:libbar' 2>'error: unknown package libbar' != 0;
- $pkg_build foo 'sys:libbar' 2>'error: unknown package libbar' != 0;
- $pkg_status foo 1>'!foo configured 2';
- $pkg_status libbar 1>'libbar configured,system !2';
+ $pkg_build 'sys:libbar' 2>>EOE != 0;
+ error: unknown package sys:libbar
+ info: consider specifying sys:libbar/*
+ EOE
+
+ $pkg_build foo 'sys:libbar' 2>>EOE != 0;
+ error: unknown package sys:libbar
+ info: consider specifying sys:libbar/*
+ EOE
+
+ $pkg_status foo 1>'!foo configured 2';
+ $pkg_status libbar 1>'libbar configured,system !2';
# Build foo and ?sys:libbar/3.
#