From 34887de6b0615f0f63f497f9020d1c059643f8ec Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 15 Apr 2010 13:59:51 +1000 Subject: build: ensure we don't recreate library loops in expansions after removing library loops from the dependeny graph, we re-add parent dependencies. We need to ensure that we don't re-add a dependency which re-creates the loop we so carefully removed. This also adds a final check for library dependency loops, and shows an appropriate error if one is found. --- buildtools/wafsamba/samba_deps.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py index fbc322383f..7beec29c1e 100644 --- a/buildtools/wafsamba/samba_deps.py +++ b/buildtools/wafsamba/samba_deps.py @@ -605,6 +605,8 @@ def reduce_objects(bld, tgt_list): t2 = bld.name_to_obj(l, bld.env) t2_obj = extended_objects(bld, t2, set()) dup = new.intersection(t2_obj) + if t.sname in rely_on: + dup = dup.difference(rely_on[t.sname]) if dup: debug('deps: removing dups from %s of type %s: %s also in %s %s', t.sname, t.samba_type, dup, t2.samba_type, l) @@ -669,8 +671,18 @@ def calculate_final_deps(bld, tgt_list, loops): diff = loops[loop].difference(t.final_libs) if t.sname in diff: diff.remove(t.sname) + if t.sname in diff: + diff.remove(t.sname) + # make sure we don't recreate the loop again! + for d in diff.copy(): + t2 = bld.name_to_obj(d, bld.env) + if t2.samba_type == 'LIBRARY': + if t.sname in t2.final_libs: + debug('deps: removing expansion %s from %s', d, t.sname) + diff.remove(d) if diff: - debug('deps: Expanded target %s by loop %s libraries %s', t.sname, loop, diff) + debug('deps: Expanded target %s by loop %s libraries (loop %s) %s', t.sname, loop, + loops[loop], diff) t.final_libs = t.final_libs.union(diff) # remove objects that are also available in linked libs @@ -697,6 +709,19 @@ def calculate_final_deps(bld, tgt_list, loops): syslibs = syslibs.union(t2.direct_syslibs) t.final_syslibs = syslibs + + # find any unresolved library loops + lib_loop_error = False + for t in tgt_list: + if t.samba_type in ['LIBRARY', 'PYTHON']: + for l in t.final_libs.copy(): + t2 = bld.name_to_obj(l, bld.env) + if t.sname in t2.final_libs: + Logs.error('ERROR: Unresolved library loop %s from %s' % (t.sname, t2.sname)) + lib_loop_error = True + if lib_loop_error: + sys.exit(1) + debug('deps: removed duplicate dependencies') -- cgit