aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/install
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/install')
-rw-r--r--libbuild2/install/operation.cxx2
-rw-r--r--libbuild2/install/rule.cxx25
2 files changed, 18 insertions, 9 deletions
diff --git a/libbuild2/install/operation.cxx b/libbuild2/install/operation.cxx
index 6ae2819..8c59ac1 100644
--- a/libbuild2/install/operation.cxx
+++ b/libbuild2/install/operation.cxx
@@ -81,7 +81,7 @@ namespace build2
update_id, // Note: not update_for_install_id.
install_id,
op_update.name,
- nullptr, // Outer operation variable is always used.
+ op_update.var_name,
op_update.name_do,
op_update.name_doing,
op_update.name_did,
diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx
index db9c64a..3ed61f3 100644
--- a/libbuild2/install/rule.cxx
+++ b/libbuild2/install/rule.cxx
@@ -37,6 +37,17 @@ namespace build2
return r.simple () && r.string () == "false" ? nullptr : &r;
}
+ // Note that the below rules are called for both install and
+ // update-for-install.
+ //
+ static inline const variable&
+ var_install (context& ctx)
+ {
+ return ctx.current_outer_ovar != nullptr
+ ? *ctx.current_outer_ovar
+ : *ctx.current_inner_ovar;
+ }
+
// alias_rule
//
const alias_rule alias_rule::instance;
@@ -127,7 +138,7 @@ namespace build2
//
// Note: not the same as lookup_install() above.
//
- auto l ((*pt)[ctx.current_ovar]); // "install"
+ auto l ((*pt)[var_install (ctx)]);
if (l && cast<path> (l).string () == "false")
{
l5 ([&]{trace << "ignoring " << *pt << " (not installable)";});
@@ -249,7 +260,7 @@ namespace build2
//
// Note: not the same as lookup_install() above.
//
- auto l ((*mt)[ctx.current_ovar]); // "install"
+ auto l ((*mt)[var_install (ctx)]);
if (l && cast<path> (l).string () == "false")
{
l5 ([&]{trace << "ignoring " << *mt << " (not installable)";});
@@ -300,7 +311,7 @@ namespace build2
// through and also diagnose any invalid values.
//
if (p.vars.empty () ||
- cast_empty<path> (p.vars[t.ctx.current_ovar]).string () != "true")
+ cast_empty<path> (p.vars[var_install (t.ctx)]).string () != "true")
return nullptr;
}
@@ -389,7 +400,7 @@ namespace build2
//
// Note: not the same as lookup_install() above.
//
- auto l ((*pt)[ctx.current_ovar]); // "install"
+ auto l ((*pt)[var_install (ctx)]);
if (l && cast<path> (l).string () == "false")
{
l5 ([&]{trace << "ignoring " << *pt << " (not installable)";});
@@ -1043,7 +1054,7 @@ namespace build2
//
if (!tp.empty ())
{
- install_target (t, cast<path> (t[ctx.current_ovar]), 1); // "install"
+ install_target (t, cast<path> (t[var_install (ctx)]), 1);
r |= target_state::changed;
}
@@ -1312,9 +1323,7 @@ namespace build2
target_state r (target_state::unchanged);
if (!tp.empty ())
- r |= uninstall_target (t,
- cast<path> (t[ctx.current_ovar]), // "install"
- 1);
+ r |= uninstall_target (t, cast<path> (t[var_install (ctx)]), 1);
// Then installable ad hoc group members, if any. To be anally precise,
// we would have to do it in reverse, but that's not easy (it's a