aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script/parser.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-04-20 22:48:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-04-21 17:15:28 +0300
commit09c231965f9f8e8f1e86f127a22f112d63ef4d9b (patch)
treee1a8689a0053099719722ba45d35aa33d229fc1e /libbuild2/build/script/parser.cxx
parent30da2a90b3d433160c06643fb7ca51722fbae6b8 (diff)
Add buildscript depdb builtin 'env' command
Diffstat (limited to 'libbuild2/build/script/parser.cxx')
-rw-r--r--libbuild2/build/script/parser.cxx29
1 files changed, 28 insertions, 1 deletions
diff --git a/libbuild2/build/script/parser.cxx b/libbuild2/build/script/parser.cxx
index 4c11688..372c622 100644
--- a/libbuild2/build/script/parser.cxx
+++ b/libbuild2/build/script/parser.cxx
@@ -481,7 +481,7 @@ namespace build2
next (t, tt);
if (tt != type::word ||
- (v != "clear" && v != "hash" && v != "string"))
+ (v != "clear" && v != "hash" && v != "string" && v != "env"))
{
fail (get_location (t))
<< "expected 'depdb' builtin command instead of " << t;
@@ -950,6 +950,33 @@ namespace build2
<< "'depdb string' argument change forcing update of "
<< ctx.env.target;});
}
+ else if (cmd == "env")
+ {
+ sha256 cs;
+ const char* pf ("invalid 'depdb env' argument: ");
+
+ try
+ {
+ // Skip <cmd>.
+ //
+ for (auto i (ns.begin () + 1); i != ns.end (); ++i)
+ {
+ string vn (convert<string> (move (*i)));
+ build2::script::verify_environment_var_name (vn, pf, ll);
+ hash_environment (cs, vn);
+ }
+ }
+ catch (const invalid_argument& e)
+ {
+ fail (ll) << pf << e;
+ }
+
+ if (ctx.dd.expect (cs.string ()) != nullptr)
+ l4 ([&] {
+ ctx.trace (ll)
+ << "'depdb env' environment change forcing update of "
+ << ctx.env.target;});
+ }
else
assert (false);
}