aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/bpkg-options.cli4
-rw-r--r--bpkg/manifest-utility3
-rw-r--r--bpkg/manifest-utility.cxx12
-rw-r--r--bpkg/pkg-fetch-options.cli4
-rw-r--r--bpkg/pkg-fetch.cxx12
-rw-r--r--bpkg/pkg-status-options.cli6
-rw-r--r--bpkg/pkg-status.cxx10
-rwxr-xr-xbpkg/test.sh58
8 files changed, 45 insertions, 64 deletions
diff --git a/bpkg/bpkg-options.cli b/bpkg/bpkg-options.cli
index c8a18a5..156bf99 100644
--- a/bpkg/bpkg-options.cli
+++ b/bpkg/bpkg-options.cli
@@ -37,14 +37,14 @@ namespace bpkg
bool pkg-status
{
- "<pkg>", // [<ver>]: 24
+ "<pkg>", // [/<ver>]: 24
"Print package status.",
""
};
bool pkg-fetch
{
- "<pkg> <ver>",
+ "<pkg>/<ver>",
"Fetch package archive.",
""
};
diff --git a/bpkg/manifest-utility b/bpkg/manifest-utility
index 4d127f4..ab413dc 100644
--- a/bpkg/manifest-utility
+++ b/bpkg/manifest-utility
@@ -20,9 +20,6 @@ namespace bpkg
version
parse_package_version (const char*);
- version
- parse_version (const char*); //@@ TMP
-
// First use the passed location as is. If the result is relative,
// then assume this is a relative path to the repository directory
// and complete it based on the current working directory.
diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx
index e44936f..cef55f7 100644
--- a/bpkg/manifest-utility.cxx
+++ b/bpkg/manifest-utility.cxx
@@ -51,18 +51,6 @@ namespace bpkg
return version ();
}
- version
- parse_version (const char* s)
- try
- {
- return version (s);
- }
- catch (const invalid_argument& e)
- {
- error << "invalid package version '" << s << "': " << e.what ();
- throw failed ();
- }
-
repository_location
parse_location (const char* s)
try
diff --git a/bpkg/pkg-fetch-options.cli b/bpkg/pkg-fetch-options.cli
index def4b09..afd75fb 100644
--- a/bpkg/pkg-fetch-options.cli
+++ b/bpkg/pkg-fetch-options.cli
@@ -10,14 +10,14 @@ include <bpkg/configuration-options.cli>;
"\h{SYNOPSIS}
-bpkg pkg-fetch [<options>] (<pkg> <ver>)|(-e <file>)"
+bpkg pkg-fetch [<options>] (<pkg>/<ver>)|(-e <file>)"
"\h{DESCRIPTION}
The \cb{pkg-fetch} command fetches the archive for the specified package
name and version from one of the configuration's repositories. If the
\cb{-e|--existing} option is used, then instead of the name and version
-arguments, \cb{pkg-fetch} expects a local path to the existing package
+argument, \cb{pkg-fetch} expects a local path to the existing package
archive. In this case, \cb{bpkg} will use the archive in place, without
copying it to the configuration or package cache directories. Also,
unless the \cb{-p|--purge} option is specified, \cb{bpkg} will not
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index 14022e8..daa2d5e 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -60,17 +60,17 @@ namespace bpkg
else
{
if (!args.more ())
- fail << "package name argument expected" <<
+ fail << "package name/version argument expected" <<
info << "run 'bpkg help pkg-fetch' for more information";
- string n (args.next ());
+ const char* arg (args.next ());
+ string n (parse_package_name (arg));
+ version v (parse_package_version (arg));
- if (!args.more ())
- fail << "package version argument expected" <<
+ if (v.empty ())
+ fail << "package version expected" <<
info << "run 'bpkg help pkg-fetch' for more information";
- version v (parse_version (args.next ()));
-
if (db.query_value<repository_count> () == 0)
fail << "configuration " << c << " has no repositories" <<
info << "use 'bpkg rep-add' to add a repository";
diff --git a/bpkg/pkg-status-options.cli b/bpkg/pkg-status-options.cli
index 5f1c05b..6eabf4d 100644
--- a/bpkg/pkg-status-options.cli
+++ b/bpkg/pkg-status-options.cli
@@ -10,13 +10,13 @@ include <bpkg/configuration-options.cli>;
"\h{SYNOPSIS}
-bpkg pkg-status <pkg> [<ver>]"
+bpkg pkg-status <pkg>[/<ver>]"
"\h{DESCRIPTION}
The \cb{pkg-status} command prints the status of the specified
-package or, if the <ver> argument is provided, package version.
-Note that the status is written to \cb{STDOUT}, not \cb{STDERR}.
+package or, if <ver> is specified, package version. Note that the
+status is written to \cb{STDOUT}, not \cb{STDERR}.
@@ TODO: output form and possible status values."
*/
diff --git a/bpkg/pkg-status.cxx b/bpkg/pkg-status.cxx
index c1cd12f..7894c49 100644
--- a/bpkg/pkg-status.cxx
+++ b/bpkg/pkg-status.cxx
@@ -32,18 +32,16 @@ namespace bpkg
fail << "package name argument expected" <<
info << "run 'bpkg help pkg-status' for more information";
- string n (args.next ());
+ const char* arg (args.next ());
+ string n (parse_package_name (arg));
+ version v (parse_package_version (arg));
- version v;
- if (args.more ())
- v = parse_version (args.next ());
+ level4 ([&]{trace << "package " << n << "; version " << v;});
database db (open (c, trace));
transaction t (db.begin ());
session s;
- level4 ([&]{trace << "package " << n << "; version " << v;});
-
// First search in the packages that already exist in this configuration.
//
shared_ptr<selected_package> p;
diff --git a/bpkg/test.sh b/bpkg/test.sh
index 7fa5fd9..ccc79d5 100755
--- a/bpkg/test.sh
+++ b/bpkg/test.sh
@@ -68,11 +68,9 @@ function stat ()
local c="$bpkg pkg-status -d $cfg"
if [ $# -eq 1 ]; then
- c="$c $pkg $ver"
+ c="$c $pkg/$ver"
elif [ $# -eq 2 ]; then
c="$c $1"; shift
- elif [ $# -eq 3 ]; then
- c="$c $1 $2"; shift; shift
fi
local s=`$c`
@@ -193,20 +191,20 @@ fail pkg-fetch -e ./no-such-file # archive does not exist
fail pkg-fetch # package name expected
fail pkg-fetch libhello # package version expected
-fail pkg-fetch libhello 1/2/3 # invalid package version
+fail pkg-fetch libhello/1/2/3 # invalid package version
-fail pkg-fetch libhello 1.0.0 # no repositories
+fail pkg-fetch libhello/1.0.0 # no repositories
test rep-add $rep
-fail pkg-fetch libhello 1.0.0 # no packages
+fail pkg-fetch libhello/1.0.0 # no packages
test rep-fetch
-fail pkg-fetch libhello 2+1.0.0 # not available
+fail pkg-fetch libhello/2+1.0.0 # not available
# local
#
test cfg-create --wipe
test rep-add $rep
test rep-fetch
-test pkg-fetch libhello 1.0.0
+test pkg-fetch libhello/1.0.0
test pkg-unpack libhello
test pkg-purge libhello
@@ -215,8 +213,8 @@ test pkg-purge libhello
test cfg-create --wipe
test rep-add http://pkg.cppget.org/1/hello
test rep-fetch
-#test pkg-fetch libheavy 1.0.0
-test pkg-fetch libhello 1.0.0
+#test pkg-fetch libheavy/1.0.0
+test pkg-fetch libhello/1.0.0
test pkg-unpack libhello
test pkg-purge libhello
@@ -423,11 +421,11 @@ test cfg-create --wipe
test rep-add ../tests/repository/1/depend/stable
test rep-fetch
-test pkg-fetch libbar 1.0.0
+test pkg-fetch libbar/1.0.0
test pkg-unpack libbar
fail pkg-configure libbar # no libfoo
-stat libbar 1.0.0 "unpacked"
-test pkg-fetch libfoo 1.0.0
+stat libbar/1.0.0 "unpacked"
+test pkg-fetch libfoo/1.0.0
test pkg-unpack libfoo
fail pkg-configure libbar # libfoo not configured
test pkg-configure libfoo
@@ -438,15 +436,15 @@ test pkg-disfigure libfoo
test pkg-purge libbar
test pkg-purge libfoo
-test pkg-fetch libfoo 1.0.0
+test pkg-fetch libfoo/1.0.0
test pkg-unpack libfoo
test pkg-configure libfoo
-test pkg-fetch libbar 1.1.0
+test pkg-fetch libbar/1.1.0
test pkg-unpack libbar
fail pkg-configure libbar # libfoo >= 1.1.0
test pkg-disfigure libfoo
test pkg-purge libfoo
-test pkg-fetch libfoo 1.1.0
+test pkg-fetch libfoo/1.1.0
test pkg-unpack libfoo
test pkg-configure libfoo
test pkg-configure libbar
@@ -455,15 +453,15 @@ test pkg-disfigure libfoo
test pkg-purge libfoo
test pkg-purge libbar
-test pkg-fetch libfoo 1.1.0
+test pkg-fetch libfoo/1.1.0
test pkg-unpack libfoo
test pkg-configure libfoo
-test pkg-fetch libbar 1.2.0
+test pkg-fetch libbar/1.2.0
test pkg-unpack libbar
fail pkg-configure libbar # libfoo >= 1.2.0
test pkg-disfigure libfoo
test pkg-purge libfoo
-test pkg-fetch libfoo 1.2.0
+test pkg-fetch libfoo/1.2.0
test pkg-unpack libfoo
test pkg-configure libfoo
test pkg-configure libbar
@@ -473,10 +471,10 @@ test pkg-disfigure libfoo
test pkg-purge libfoo
test pkg-purge libbar
-test pkg-fetch libfoo 1.1.0
+test pkg-fetch libfoo/1.1.0
test pkg-unpack libfoo
test pkg-configure libfoo
-test pkg-fetch libbar 1.3.0
+test pkg-fetch libbar/1.3.0
test pkg-unpack libbar
fail pkg-configure libbar # incompatible constraints
test pkg-disfigure libfoo
@@ -495,14 +493,14 @@ test rep-create ../tests/repository/1/status/unstable
# basics
#
test cfg-create --wipe
-stat libfoo 1.0.0 "unknown"
+stat libfoo/1.0.0 "unknown"
stat libfoo "unknown"
test rep-add ../tests/repository/1/status/stable
test rep-fetch
-stat libfoo 1.0.0 "available"
+stat libfoo/1.0.0 "available"
stat libfoo "available 1.0.0"
-test pkg-fetch libfoo 1.0.0
-stat libfoo 1.0.0 "fetched"
+test pkg-fetch libfoo/1.0.0
+stat libfoo/1.0.0 "fetched"
stat libfoo "fetched 1.0.0"
# multiple versions/revisions
@@ -524,10 +522,10 @@ test cfg-create --wipe
test rep-add ../tests/repository/1/status/unstable
test rep-fetch
stat libbar "available 2.0.0 1.1.0 1.0.0-1 1.0.0"
-test pkg-fetch libbar 1.0.0-1
+test pkg-fetch libbar/1.0.0-1
stat libbar "fetched 1.0.0-1; available 2.0.0 1.1.0"
test pkg-purge libbar
-test pkg-fetch libbar 2.0.0
+test pkg-fetch libbar/2.0.0
stat libbar "fetched 2.0.0"
##
@@ -599,7 +597,7 @@ test pkg-purge $pkg
test cfg-create --wipe cxx
test rep-add http://pkg.cppget.org/1/hello
test rep-fetch
-test pkg-fetch $pkg $ver
+test pkg-fetch $pkg/$ver
test pkg-unpack $pkg
test pkg-configure $pkg
test pkg-update $pkg
@@ -889,10 +887,10 @@ test pkg-purge libfoo
# dependent prevents upgrade/downgrade
#
-test pkg-fetch libfoo 1.1.0
+test pkg-fetch libfoo/1.1.0
test pkg-unpack libfoo
test pkg-configure libfoo
-test pkg-fetch libbar 1.1.0
+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