diff options
-rw-r--r-- | bpkg/manifest-utility.cxx | 13 | ||||
-rw-r--r-- | bpkg/pkg-build.cxx | 2 | ||||
-rw-r--r-- | tests/pkg-build.testscript | 25 | ||||
-rw-r--r-- | tests/pkg-fetch.testscript | 2 |
4 files changed, 38 insertions, 4 deletions
diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index 8ff2090..74daf6b 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -82,11 +82,20 @@ namespace bpkg try { - return version (p); + version r (p); + + if (r.release && r.release->empty ()) + throw invalid_argument ("earliest version"); + + if (r.compare (wildcard_version, true /* ignore_revision */) == 0) + throw invalid_argument ("stub version"); + + return r; } catch (const invalid_argument& e) { - fail << "invalid package version '" << p << "': " << e; + fail << "invalid package version '" << p << "' in '" << s << "': " + << e; } } diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 590dbe9..0844ae9 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -1777,7 +1777,7 @@ namespace bpkg return dependency_constraint ("~" + vs); } // Note that the only possible reason for invalid_argument exception to - // be thrown is that minor version reached the 999 limit (see + // be thrown is that minor version reached the 99999 limit (see // standard-version.cxx for details). // catch (const invalid_argument&) diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index 7ef78ff..17fa313 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -172,6 +172,31 @@ test.options += --no-progress info: run 'bpkg help pkg-build' for more information EOE + : version + : + { + : empty + : + $clone_root_cfg; + $* libfoo/ 2>>EOE != 0 + error: empty package version in 'libfoo/' + EOE + + : earliest + : + $clone_root_cfg; + $* libfoo/1.0.0- 2>>EOE != 0 + error: invalid package version '1.0.0-' in 'libfoo/1.0.0-': earliest version + EOE + + : stub + : + $clone_root_cfg; + $* libfoo/0+1 2>>EOE != 0 + error: invalid package version '0+1' in 'libfoo/0+1': stub version + EOE + } + : unknown-package : $clone_root_cfg; diff --git a/tests/pkg-fetch.testscript b/tests/pkg-fetch.testscript index fe14662..22fcc0c 100644 --- a/tests/pkg-fetch.testscript +++ b/tests/pkg-fetch.testscript @@ -79,7 +79,7 @@ $* libfoo 2>>EOE != 0 : $clone_cfg; $* libfoo/1/2/3 2>>EOE != 0 - error: invalid package version '1/2/3': alpha-numeric characters expected in a component + error: invalid package version '1/2/3' in 'libfoo/1/2/3': alpha-numeric characters expected in a component EOE : no-repositories |