diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-05-03 16:04:56 +0200 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-05-03 17:16:47 +0200 |
commit | b3d8a7136a4c71fa73baa745f7e2ef137d82ce46 (patch) | |
tree | dd606a9c849ed5b0a0a41c09310c238197248cff /buildtools | |
parent | 8bc5194b048d050b2d3ff30a5636f1567ec19e1e (diff) | |
download | samba-b3d8a7136a4c71fa73baa745f7e2ef137d82ce46.tar.gz samba-b3d8a7136a4c71fa73baa745f7e2ef137d82ce46.tar.bz2 samba-b3d8a7136a4c71fa73baa745f7e2ef137d82ce46.zip |
build: added a check for group ordering within target dependencies
If target A depends on target B, then target B must not be in a later
build group from target A
Pair-Programmed-With: Thomas Nagy
Diffstat (limited to 'buildtools')
-rw-r--r-- | buildtools/wafsamba/samba_deps.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py index e0c76e48ec..d00fe7f4e5 100644 --- a/buildtools/wafsamba/samba_deps.py +++ b/buildtools/wafsamba/samba_deps.py @@ -282,6 +282,49 @@ def check_orpaned_targets(bld, tgt_list): Logs.warn("Target %s of type %s is unused by any other target" % (t.sname, type)) +def check_group_ordering(bld, tgt_list): + '''see if we have any dependencies that violate the group ordering + + It is an error for a target to depend on a target from a later + build group + ''' + + def group_name(g): + tm = bld.task_manager + return [x for x in tm.groups_names if id(tm.groups_names[x]) == id(g)][0] + + for g in bld.task_manager.groups: + gname = group_name(g) + for t in g.tasks_gen: + t.samba_group = gname + + grp_map = {} + idx = 0 + for g in bld.task_manager.groups: + name = group_name(g) + grp_map[name] = idx + idx += 1 + + targets = LOCAL_CACHE(bld, 'TARGET_TYPE') + + ret = True + for t in tgt_list: + tdeps = getattr(t, 'add_objects', []) + getattr(t, 'uselib_local', []) + for d in tdeps: + t2 = bld.name_to_obj(d, bld.env) + if t2 is None: + continue + map1 = grp_map[t.samba_group] + map2 = grp_map[t2.samba_group] + + if map2 > map1: + Logs.error("Target %r in build group %r depends on target %r from later build group %r" % ( + t.sname, t.samba_group, t2.sname, t2.samba_group)) + ret = False + + return ret + + def show_final_deps(bld, tgt_list): '''show the final dependencies for all targets''' @@ -914,6 +957,10 @@ def check_project_rules(bld): Logs.error("Duplicate sources present - aborting") sys.exit(1) + if not check_group_ordering(bld, tgt_list): + Logs.error("Bad group ordering - aborting") + sys.exit(1) + show_final_deps(bld, tgt_list) debug('deps: project rules checking completed - %u targets checked', |