diff options
-rw-r--r-- | bpkg/pkg-build.cli | 18 | ||||
-rw-r--r-- | bpkg/pkg-build.cxx | 2 | ||||
-rw-r--r-- | bpkg/pkg-clean.hxx | 2 | ||||
-rw-r--r-- | bpkg/pkg-command.cxx | 16 | ||||
-rw-r--r-- | bpkg/pkg-command.hxx | 5 | ||||
-rw-r--r-- | bpkg/pkg-install.hxx | 2 | ||||
-rw-r--r-- | bpkg/pkg-test.hxx | 2 | ||||
-rw-r--r-- | bpkg/pkg-uninstall.hxx | 2 | ||||
-rw-r--r-- | bpkg/pkg-update.cli | 11 | ||||
-rw-r--r-- | bpkg/pkg-update.hxx | 5 |
10 files changed, 50 insertions, 15 deletions
diff --git a/bpkg/pkg-build.cli b/bpkg/pkg-build.cli index f322a07..042ece6 100644 --- a/bpkg/pkg-build.cli +++ b/bpkg/pkg-build.cli @@ -69,6 +69,14 @@ namespace bpkg "Assume the answer to all prompts is \cb{yes}." } + string --for|-f + { + "<operation>", + "Instead of the default \cb{update} build system operation, perform the + \cb{update-for-}<operation> variant where <operation> is normally + \cb{install} or \cb{test}." + } + bool --drop-prerequisite|-D { "Drop without confirmation prerequsite packages that were automatically @@ -93,15 +101,15 @@ namespace bpkg their prerequisites being upgraded or downgraded." } - bool --print-only|-p + bool --configure-only|-c { - "Print to \cb{STDOUT} what would be done without actually doing - anything." + "Configure all the packages but don't update." } - bool --configure-only|-c + bool --print-only|-p { - "Configure all the packages but don't update." + "Print to \cb{STDOUT} what would be done without actually doing + anything." } }; } diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index c555ca0..2dcacb7 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -1932,7 +1932,7 @@ namespace bpkg } } - pkg_update (c, o, strings (), upkgs); + pkg_update (c, o, o.for_ (), strings (), upkgs); if (verb) { diff --git a/bpkg/pkg-clean.hxx b/bpkg/pkg-clean.hxx index f1a983a..3a8fcf1 100644 --- a/bpkg/pkg-clean.hxx +++ b/bpkg/pkg-clean.hxx @@ -16,7 +16,7 @@ namespace bpkg inline int pkg_clean (const pkg_clean_options& o, cli::scanner& args) { - return pkg_command ("clean", o, args); + return pkg_command ("clean", o, "", args); } } 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) { diff --git a/bpkg/pkg-command.hxx b/bpkg/pkg-command.hxx index de6ccf9..329360d 100644 --- a/bpkg/pkg-command.hxx +++ b/bpkg/pkg-command.hxx @@ -15,9 +15,13 @@ namespace bpkg { // Common pkg-{update,clean,test,install,...} implementation. // + // If cmd_variant is not empty, then the <cmd>-for-<variant> is performed + // instead. + // int pkg_command (const string& cmd, // Without the 'pkg-' prefix. const configuration_options&, + const string& cmd_variant, cli::scanner& args); struct pkg_command_vars @@ -30,6 +34,7 @@ namespace bpkg pkg_command (const string& cmd, const dir_path& configuration, const common_options&, + const string& cmd_variant, const strings& common_vars, const vector<pkg_command_vars>&); } diff --git a/bpkg/pkg-install.hxx b/bpkg/pkg-install.hxx index 83ad4de..9102dda 100644 --- a/bpkg/pkg-install.hxx +++ b/bpkg/pkg-install.hxx @@ -17,7 +17,7 @@ namespace bpkg inline int pkg_install (const pkg_install_options& o, cli::scanner& args) { - return pkg_command ("install", o, args); + return pkg_command ("install", o, "", args); } } diff --git a/bpkg/pkg-test.hxx b/bpkg/pkg-test.hxx index dd27c9c..b9af98b 100644 --- a/bpkg/pkg-test.hxx +++ b/bpkg/pkg-test.hxx @@ -16,7 +16,7 @@ namespace bpkg inline int pkg_test (const pkg_test_options& o, cli::scanner& args) { - return pkg_command ("test", o, args); + return pkg_command ("test", o, "", args); } } diff --git a/bpkg/pkg-uninstall.hxx b/bpkg/pkg-uninstall.hxx index 2464d62..10122f4 100644 --- a/bpkg/pkg-uninstall.hxx +++ b/bpkg/pkg-uninstall.hxx @@ -17,7 +17,7 @@ namespace bpkg inline int pkg_uninstall (const pkg_uninstall_options& o, cli::scanner& args) { - return pkg_command ("uninstall", o, args); + return pkg_command ("uninstall", o, "", args); } } diff --git a/bpkg/pkg-update.cli b/bpkg/pkg-update.cli index 7922a34..1478963 100644 --- a/bpkg/pkg-update.cli +++ b/bpkg/pkg-update.cli @@ -21,7 +21,8 @@ namespace bpkg The \cb{pkg-update} command updates the previously configured (via \l{bpkg-pkg-build(1)} or \l{bpkg-pkg-configure(1)}) package. Underneath, - this command doesn't do much more than run \cb{b update}. + this command doesn't do much more than run \cb{b update} (or one of its + \c{update-for-*} variants; see \cb{--for|-f}). Additional command line variables (<vars>, normally \cb{config.*}) can be passed to the build system by either specifying them before the packages, @@ -32,5 +33,13 @@ namespace bpkg class pkg_update_options: configuration_options { "\h|PKG-UPDATE OPTIONS|" + + string --for|-f + { + "<operation>", + "Instead of the default \cb{update} build system operation, perform the + \cb{update-for-}<operation> variant where <operation> is normally + \cb{install} or \cb{test}." + } }; } diff --git a/bpkg/pkg-update.hxx b/bpkg/pkg-update.hxx index 5f62bd9..94d4dad 100644 --- a/bpkg/pkg-update.hxx +++ b/bpkg/pkg-update.hxx @@ -17,16 +17,17 @@ namespace bpkg inline int pkg_update (const pkg_update_options& o, cli::scanner& args) { - return pkg_command ("update", o, args); + return pkg_command ("update", o, o.for_ (), args); } inline void pkg_update (const dir_path& configuration, const common_options& o, + const string& cmd_variant, const strings& common_vars, const vector<pkg_command_vars>& pkgs) { - pkg_command ("update", configuration, o, common_vars, pkgs); + pkg_command ("update", configuration, o, cmd_variant, common_vars, pkgs); } } |