aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-command.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-08 12:44:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-08 12:44:06 +0200
commit974a8c152bf7c9a4a5ce3c45808af65657c2ff1f (patch)
treed9bbfae21920dc0c35758d803831b2b01dc28ac2 /bpkg/pkg-command.cxx
parent994b63e2b60333a83faba52dc6b044fbdbbad61b (diff)
Add --for|-f <operation> option to pkg-update and pkg-build
This allows executing build2 -for-X operations (e.g., update-for-install or update-for-test) in order to minimize the amount of stuff to be updated.
Diffstat (limited to 'bpkg/pkg-command.cxx')
-rw-r--r--bpkg/pkg-command.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/bpkg/pkg-command.cxx b/bpkg/pkg-command.cxx
index 980e593..0f54b95 100644
--- a/bpkg/pkg-command.cxx
+++ b/bpkg/pkg-command.cxx
@@ -18,6 +18,7 @@ namespace bpkg
pkg_command (const string& cmd,
const dir_path& c,
const common_options& o,
+ const string& cmd_v,
const strings& cvars,
const vector<pkg_command_vars>& ps)
{
@@ -49,7 +50,17 @@ namespace bpkg
run (); // Run previously collected packages.
if (bspec.empty ())
- bspec = cmd + '(';
+ {
+ bspec = cmd;
+
+ if (!cmd_v.empty ())
+ {
+ bspec += "-for-";
+ bspec += cmd_v;
+ }
+
+ bspec += '(';
+ }
const shared_ptr<selected_package>& p (pv.pkg);
@@ -78,6 +89,7 @@ namespace bpkg
int
pkg_command (const string& cmd,
const configuration_options& o,
+ const string& cmd_v,
cli::scanner& args)
{
tracer trace ("pkg_command");
@@ -140,7 +152,7 @@ namespace bpkg
t.commit ();
}
- pkg_command (cmd, c, o, cvars, ps);
+ pkg_command (cmd, c, o, cmd_v, cvars, ps);
if (verb)
{