summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_deps.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-31 20:13:55 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:21 +1000
commitfe2c1f1e7c4eccb0f4ed849983b22839ec9f7930 (patch)
tree04dd882f338360aa528d8119a62ffa584999e10f /buildtools/wafsamba/samba_deps.py
parentd830661f222d1791a46bdd858817fa0d637cb1d3 (diff)
downloadsamba-fe2c1f1e7c4eccb0f4ed849983b22839ec9f7930.tar.gz
samba-fe2c1f1e7c4eccb0f4ed849983b22839ec9f7930.tar.bz2
samba-fe2c1f1e7c4eccb0f4ed849983b22839ec9f7930.zip
build: refactor the object reduction code
split it out into a separate function, and use the final_* attributes instead of the direct_* and indirect_* attributes
Diffstat (limited to 'buildtools/wafsamba/samba_deps.py')
-rw-r--r--buildtools/wafsamba/samba_deps.py69
1 files changed, 39 insertions, 30 deletions
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index 674dc07254..31062e71a8 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -440,18 +440,16 @@ def extended_objects(bld, t, chain):
if ret is not None: return ret
ret = set()
- ret = ret.union(t.direct_objects)
- ret = ret.union(t.indirect_objects)
+ ret = ret.union(t.final_objects)
- for lib in t.direct_libs:
+ for lib in t.final_libs:
if lib in chain:
continue
t2 = bld.name_to_obj(lib, bld.env)
chain.add(lib)
r2 = extended_objects(bld, t2, chain)
chain.remove(lib)
- ret = ret.union(t2.direct_objects)
- ret = ret.union(t2.indirect_objects)
+ ret = ret.union(t2.final_objects)
ret = ret.union(r2)
t.extended_objects = ret
@@ -576,34 +574,13 @@ def break_dependency_loops(bld, tgt_list):
objs = objs.union(diff)
setattr(t, 'includes_objects', objs)
-def calculate_final_deps(bld, tgt_list, loops):
- '''calculate the final library and object dependencies'''
- for t in tgt_list:
- # start with the maximum possible list
- t.final_libs = t.direct_libs.union(indirect_libs(bld, t, set(), loops))
- t.final_objects = t.direct_objects.union(indirect_objects(bld, t, set(), loops))
- for t in tgt_list:
- # don't depend on ourselves
- if t.sname in t.final_libs:
- t.final_libs.remove(t.sname)
- if t.sname in t.final_objects:
- t.final_objects.remove(t.sname)
+def reduce_objects(bld, tgt_list):
+ '''reduce objects by looking for indirect object dependencies'''
+ rely_on = {}
- # find any library loops
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:
- # we could break this in either direction. If one of the libraries
- # has a version number, and will this be distributed publicly, then
- # we should make it the lower level library in the DAG
- debug('deps: removing library loop %s from %s', t.sname, t2.sname)
- dependency_loop(loops, t, t2.sname)
- t2.final_libs.remove(t.sname)
-
- rely_on = {}
+ t.extended_objects = None
for type in ['BINARY', 'PYTHON', 'LIBRARY']:
for t in tgt_list:
@@ -629,6 +606,35 @@ def calculate_final_deps(bld, tgt_list, loops):
t = bld.name_to_obj(r, bld.env)
t.final_objects = t.final_objects.union(rely_on[r])
+
+def calculate_final_deps(bld, tgt_list, loops):
+ '''calculate the final library and object dependencies'''
+ for t in tgt_list:
+ # start with the maximum possible list
+ t.final_libs = t.direct_libs.union(indirect_libs(bld, t, set(), loops))
+ t.final_objects = t.direct_objects.union(indirect_objects(bld, t, set(), loops))
+
+ for t in tgt_list:
+ # don't depend on ourselves
+ if t.sname in t.final_libs:
+ t.final_libs.remove(t.sname)
+ if t.sname in t.final_objects:
+ t.final_objects.remove(t.sname)
+
+ # find any library loops
+ 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:
+ # we could break this in either direction. If one of the libraries
+ # has a version number, and will this be distributed publicly, then
+ # we should make it the lower level library in the DAG
+ debug('deps: removing library loop %s from %s', t.sname, t2.sname)
+ dependency_loop(loops, t, t2.sname)
+ t2.final_libs.remove(t.sname)
+
+
for loop in loops:
debug('deps: Found dependency loops for target %s : %s', loop, loops[loop])
@@ -647,6 +653,9 @@ def calculate_final_deps(bld, tgt_list, loops):
debug('deps: Expanded target %s by loop %s libraries %s', t.sname, loop, diff)
t.final_libs = t.final_libs.union(diff)
+ # remove objects that are also available in linked libs
+ reduce_objects(bld, tgt_list)
+
# add in any syslib dependencies
for t in tgt_list:
if not t.samba_type in ['BINARY','PYTHON','LIBRARY']: