diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-11-09 12:36:02 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-11-09 12:36:02 +0200 |
commit | 61a7600c6e2bd900b36eb94b1f9dae6a9b374db9 (patch) | |
tree | 6e6c4653600bf5be2d5fbf68a489b21a11eed5cb | |
parent | 25fdb8f5d54a5a789d5b9eac0247cf95b7296e89 (diff) |
Clean up command line variable handling in pkg-configure, pkg-<command>
This reflects the change we've made in the build system to the semantics
in this area a while ago.
-rw-r--r-- | bpkg/pkg-command.cxx | 33 | ||||
-rw-r--r-- | bpkg/pkg-command.hxx | 2 | ||||
-rw-r--r-- | bpkg/pkg-configure.cli | 4 |
3 files changed, 12 insertions, 27 deletions
diff --git a/bpkg/pkg-command.cxx b/bpkg/pkg-command.cxx index 863e351..6b82c29 100644 --- a/bpkg/pkg-command.cxx +++ b/bpkg/pkg-command.cxx @@ -29,39 +29,22 @@ namespace bpkg l4 ([&]{trace << "command: " << cmd;}); - // Set common vars on the configuration scope. + // This one is a bit tricky: we can only update all the packages at once + // if they don't have any package-specific variables. But let's try to + // handle this with the same logic (being clever again). // - cstrings gvars; - strings lvars; - lvars.reserve (cvars.size ()); - - for (const string& v: cvars) - { - // Don't scope-qualify global variables. - // - if (v[0] == '!') - gvars.push_back (v.c_str ()); - - // Use path representation to get the trailing slash. - // - else - lvars.push_back (c.representation () + v); - } - - // This one is a bit tricky: we can only update all the packages at once if - // they don't have any package-specific variables. But let's try to handle - // this with the same logic (being clever again). + // @@ If the build system supported command line variable grouping, then + // we could always build at once. // string bspec; - auto run = [&trace, &o, &lvars, &gvars, &bspec] ( - const strings& vars = strings ()) + auto run = [&trace, &o, &cvars, &bspec] (const strings& vars = strings ()) { if (!bspec.empty ()) { bspec += ')'; l4 ([&]{trace << "buildspec: " << bspec;}); - run_b (o, verb_b::normal, gvars, lvars, vars, bspec); + run_b (o, verb_b::normal, cvars, vars, bspec); bspec.clear (); } }; @@ -155,6 +138,8 @@ namespace bpkg // First read the common variables. // + // @@ TODO: redo using argument groups. + // auto read_vars = [&args](strings& v) { for (; args.more (); args.next ()) diff --git a/bpkg/pkg-command.hxx b/bpkg/pkg-command.hxx index a08188b..9b56142 100644 --- a/bpkg/pkg-command.hxx +++ b/bpkg/pkg-command.hxx @@ -33,7 +33,7 @@ namespace bpkg struct pkg_command_vars { shared_ptr<selected_package> pkg; - strings vars; + strings vars; // Package-specific command line vars. }; void diff --git a/bpkg/pkg-configure.cli b/bpkg/pkg-configure.cli index 994e0d6..27977d7 100644 --- a/bpkg/pkg-configure.cli +++ b/bpkg/pkg-configure.cli @@ -15,7 +15,7 @@ namespace bpkg "\h|SYNOPSIS| - \c{\b{bpkg pkg-configure} [<options>] <pkg> [<cfg-var>...]} + \c{\b{bpkg pkg-configure} [<options>] [<cfg-var>...] <pkg>} \h|DESCRIPTION| @@ -26,7 +26,7 @@ namespace bpkg A source code package inherits the common \cb{build2} configuration values that were specified when creating the configuration (\l{bpkg-cfg-create(1)}). Additional, package-specific configuration - variables can be specified after the package name. + variables can be specified before the package name. A system package is specified using the \c{\b{sys:}<pkg>[/<ver>]} syntax. If the package version (<ver>) is not specified, then it is |