aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-09-06 16:23:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-09-06 16:23:52 +0200
commit9c3b6aabdb4d1f7196eea5c4d3a60999b09a1d55 (patch)
treeeea14a090d9d664a2a24f2d18b71a9134abe557a
parentc5019d100308fd3e330678ec223d3891ed61d3c8 (diff)
Add pkg-status --all|-a and --link optionsstatus-all
-rw-r--r--bpkg/pkg-status.cli21
-rw-r--r--bpkg/pkg-status.cxx21
2 files changed, 33 insertions, 9 deletions
diff --git a/bpkg/pkg-status.cli b/bpkg/pkg-status.cli
index d45c4ae..59609ec 100644
--- a/bpkg/pkg-status.cli
+++ b/bpkg/pkg-status.cli
@@ -25,11 +25,12 @@ namespace bpkg
or, if <ver> is specified, package versions. If no packages were
specified, then \cb{pkg-status} prints the status of all the held
packages (which are the packages that were explicitly built; see
- \l{bpkg-pkg-build(1)}). Additionally, the status of immediate or all
- dependencies of the above packages can be printed by specifying the
- \c{\b{--immediate}|\b{-i}} or \c{\b{--recursive}|\b{-r}} options,
- respectively. Note that the status is written to \cb{stdout}, not
- \cb{stderr}.
+ \l{bpkg-pkg-build(1)}). The latter mode can be modified to print the
+ status of all the packages by specifying the \c{\b{--all}|\b{-a}} option.
+ Additionally, the status of immediate or all dependencies of the above
+ packages can be printed by specifying the \c{\b{--immediate}|\b{-i}} or
+ \c{\b{--recursive}|\b{-r}} options, respectively. Note that the status is
+ written to \cb{stdout}, not \cb{stderr}.
The status output format is regular with components separated with
spaces. Each line starts with the package name and version (if specified)
@@ -165,6 +166,16 @@ namespace bpkg
{
"\h|PKG-STATUS OPTIONS|"
+ bool --all|-a
+ {
+ "Print the status of all the packages, not just held."
+ }
+
+ bool --link
+ {
+ "Also print the status of held/all packages from linked configurations."
+ }
+
bool --immediate|-i
{
"Also print the status of immediate dependencies."
diff --git a/bpkg/pkg-status.cxx b/bpkg/pkg-status.cxx
index a376d38..2b05086 100644
--- a/bpkg/pkg-status.cxx
+++ b/bpkg/pkg-status.cxx
@@ -338,14 +338,19 @@ namespace bpkg
}
else
{
- // Find all held packages in this and all the dependency
- // configurations.
+ // Find held/all packages in this and, if --link specified, all the
+ // dependency configurations.
//
+ query q;
+
+ if (!o.all ())
+ q = query::hold_package;
+
for (database& ldb: db.dependency_configs ())
{
for (shared_ptr<selected_package> s:
pointer_result (
- ldb.query<selected_package> (query::hold_package)))
+ ldb.query<selected_package> (q)))
{
pkgs.push_back (package {ldb,
s->hold_package ? ldb : db,
@@ -354,11 +359,19 @@ namespace bpkg
move (s),
nullopt /* constraint */});
}
+
+ if (!o.link ())
+ break;
}
if (pkgs.empty ())
{
- info << "no held packages in the configuration";
+ if (o.all ())
+ info << "no packages in the configuration";
+ else
+ info << "no held packages in the configuration" <<
+ info << "use --all|-a to see status of all packages";
+
return 0;
}
}