From aeda0dedb2cdb0980d976ae92e1672476b62d7ed Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 20 Mar 2020 05:50:12 +0200 Subject: Don't install ad hoc members with unassigned paths --- libbuild2/install/rule.cxx | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx index 23e1004..f1d8b8f 100644 --- a/libbuild2/install/rule.cxx +++ b/libbuild2/install/rule.cxx @@ -980,10 +980,16 @@ namespace build2 // for (const target* m (t.member); m != nullptr; m = m->member) { - if (const path* p = lookup_install (*m, "install")) + if (const file* mf = m->is_a ()) { - install_target (m->as (), *p, tp.empty () ? 1 : 2); - r |= target_state::changed; + if (!mf->path ().empty ()) + { + if (const path* p = lookup_install (*mf, "install")) + { + install_target (*mf, *p, tp.empty () ? 1 : 2); + r |= target_state::changed; + } + } } } @@ -1252,13 +1258,22 @@ namespace build2 // for (const target* m (t.member); m != nullptr; m = m->member) { - if (const path* p = lookup_install (*m, "install")) - r |= uninstall_target ( - m->as (), - *p, - tp.empty () || r != target_state::changed ? 1 : 2); + if (const file* mf = m->is_a ()) + { + if (!mf->path ().empty ()) + { + if (const path* p = lookup_install (*m, "install")) + { + r |= uninstall_target ( + *mf, + *p, + tp.empty () || r != target_state::changed ? 1 : 2); + } + } + } } + // Finally handle installable prerequisites. // r |= reverse_execute_prerequisites (a, t); -- cgit v1.1