From e0c4d1dc2b6bc5ee238ea94cd0803855a337efdf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 12 Apr 2016 15:36:24 +0200 Subject: 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. --- bpkg/utility.cxx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'bpkg/utility.cxx') 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. -- cgit v1.1