aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-06-07 15:00:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-06-07 15:00:34 +0200
commit6a8953c64aaf7cfcd081f0750dcfb9c89aea49e7 (patch)
treece3226dfe04704f1616fa88e703b3b94e52a0699
parent545e427106ba9ebfa66db1e3bba3cf13078a213c (diff)
Diagnose non-global variable specified with --build-option (GH issue #276)
-rw-r--r--bpkg/bpkg.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx
index 4af4140..b5eaf7d 100644
--- a/bpkg/bpkg.cxx
+++ b/bpkg/bpkg.cxx
@@ -158,6 +158,17 @@ namespace bpkg
if (bo.help () || bo.version ())
fail << "--help or --version specified with --build-option";
+
+ // Make sure someone didn't specify a non-global override with
+ // --build-option, which messes our global/package-specific config
+ // variable split.
+ //
+ for (const string& v: bc.cmd_vars)
+ {
+ if (v[0] != '!')
+ fail << "non-global configuration variable '" << v
+ << "' specified with --build-option";
+ }
}
build2_cmd_vars = move (bc.cmd_vars);