From 61a7600c6e2bd900b36eb94b1f9dae6a9b374db9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 9 Nov 2018 12:36:02 +0200 Subject: Clean up command line variable handling in pkg-configure, pkg- This reflects the change we've made in the build system to the semantics in this area a while ago. --- bpkg/pkg-command.cxx | 33 +++++++++------------------------ bpkg/pkg-command.hxx | 2 +- bpkg/pkg-configure.cli | 4 ++-- 3 files changed, 12 insertions(+), 27 deletions(-) (limited to 'bpkg') 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 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} [] [...]} + \c{\b{bpkg pkg-configure} [] [...] } \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:}[/]} syntax. If the package version () is not specified, then it is -- cgit v1.1