aboutsummaryrefslogtreecommitdiff
path: root/bpkg/utility.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-12 15:36:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-12 15:36:24 +0200
commite0c4d1dc2b6bc5ee238ea94cd0803855a337efdf (patch)
tree14d312935b6cd16bb6beea5c8945c326949d1e51 /bpkg/utility.cxx
parentf4120bea7831bfd894e03dd25e3849cd84571f8b (diff)
Set common variables in pkg-* commands on the whole configuration
This makes a difference, for example, in pkg-install where install.root is needed by prerequisites.
Diffstat (limited to 'bpkg/utility.cxx')
-rw-r--r--bpkg/utility.cxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx
index f6cbc45..57a299b 100644
--- a/bpkg/utility.cxx
+++ b/bpkg/utility.cxx
@@ -190,10 +190,11 @@ namespace bpkg
void
run_b (const common_options& co,
+ const dir_path& c,
const string& bspec,
bool quiet,
- const strings& vars1,
- const strings& vars2)
+ const strings& pvars,
+ const strings& cvars)
{
cstrings args {co.build ().string ().c_str ()};
@@ -220,10 +221,22 @@ namespace bpkg
// Add config vars.
//
- for (const string& v: vars1)
- args.push_back (v.c_str ());
+ strings storage;
+ storage.reserve (cvars.size ());
+ for (const string& v: cvars)
+ {
+ // Don't scope-qualify global variables.
+ //
+ if (v[0] != '!')
+ {
+ storage.push_back (c.string () + "/:" + v);
+ args.push_back (storage.back ().c_str ());
+ }
+ else
+ args.push_back (v.c_str ());
+ }
- for (const string& v: vars2)
+ for (const string& v: pvars)
args.push_back (v.c_str ());
// Add buildspec.