aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-04-20 15:36:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-04-20 15:36:02 +0200
commit30da2a90b3d433160c06643fb7ca51722fbae6b8 (patch)
tree499bc39fb967b56e8c2b93f64da4cff14f49de9d /libbuild2/variable.cxx
parent0353b231d51ab7ea5ead98ac838e7c2ba1b0df89 (diff)
Detect environment changes in ad hoc recipes
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r--libbuild2/variable.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx
index efda63d..f9e60c1 100644
--- a/libbuild2/variable.cxx
+++ b/libbuild2/variable.cxx
@@ -1158,10 +1158,19 @@ namespace build2
else if (k == "checksum")
{
if (!i->simple ())
- throw_invalid_argument (*i, nullptr, "process_path_ex checksum");
+ throw_invalid_argument (
+ *i, nullptr, "process_path_ex executable checksum");
pp.checksum = move (i->value);
}
+ else if (k == "env-checksum")
+ {
+ if (!i->simple ())
+ throw_invalid_argument (
+ *i, nullptr, "process_path_ex environment checksum");
+
+ pp.env_checksum = move (i->value);
+ }
else
throw invalid_argument (
"unknown key '" + k + "' in process_path_ex value");
@@ -1176,7 +1185,9 @@ namespace build2
auto b (ns.begin ()), i (b), e (ns.end ());
for (i += i->pair ? 2 : 1; i != e && i->pair; i += 2)
{
- if (!i->simple () || (i->value != "name" && i->value != "checksum"))
+ if (!i->simple () || (i->value != "name" &&
+ i->value != "checksum" &&
+ i->value != "env-checksum"))
break;
}
@@ -1217,6 +1228,7 @@ namespace build2
lhs.name = move (rhs.name);
lhs.checksum = move (rhs.checksum);
+ lhs.env_checksum = move (rhs.env_checksum);
}
else
{
@@ -1224,6 +1236,7 @@ namespace build2
lhs.name = rhs.name;
lhs.checksum = rhs.checksum;
+ lhs.env_checksum = rhs.env_checksum;
}
}
@@ -1252,7 +1265,8 @@ namespace build2
{
s.reserve ((x.effect.empty () ? 1 : 2) +
(x.name ? 2 : 0) +
- (x.checksum ? 2 : 0));
+ (x.checksum ? 2 : 0) +
+ (x.env_checksum ? 2 : 0));
process_path_reverse_impl (x, s);
@@ -1269,6 +1283,13 @@ namespace build2
s.back ().pair = '@';
s.push_back (name (*x.checksum));
}
+
+ if (x.env_checksum)
+ {
+ s.push_back (name ("env-checksum"));
+ s.back ().pair = '@';
+ s.push_back (name (*x.env_checksum));
+ }
}
return s;