Fix dependency calculation missing changed dependencies.
authorIlpo Ruotsalainen <ilpo.ruotsalainen@movial.fi>
Mon, 15 Dec 2008 16:00:06 +0000 (18:00 +0200)
committerIlpo Ruotsalainen <ilpo.ruotsalainen@movial.fi>
Mon, 15 Dec 2008 16:00:06 +0000 (18:00 +0200)
matrix/build.py

index d9d1e4f..a063e29 100644 (file)
@@ -22,9 +22,15 @@ def build(targets):
 
        components.fill_in_depends(selected)
 
+       count = 0
+
        print 'Calculating dependencies...',
        sys.stdout.flush()
-       count = analyze_build(selected)
+
+       for c in selected:
+               if analyze_build(c):
+                       count += 1
+       
        print 'done, rebuilding', count, 'components'
 
        Builder(selected, count).run()
@@ -48,34 +54,23 @@ def build_only(targets):
                raise Error('Component ' + i + ' not found')
        count = len(all)
 
-       # Set weights based on user-specified order.  Weight recalculation
-       # won't happen because the reverse dependency tree is flat.
-       #
-       # NOTE: config.jobs can still cause parallel builds!
-       #
-       weight = count
        for c in all:
-               c.weight = weight
-               weight -= 1
+               c.needs_rebuild = True
 
        Builder(all, count).run()
 
-def analyze_build(targets):
-       count = 0
-
-       for c in targets:
-               if c.rebuild_checked:
-                       continue
-
-               depcount = analyze_build(c.get_depends())
-
-               if depcount or not cache.contains(c):
+def analyze_build(c):
+       if not c.rebuild_checked:
+               if not cache.contains(c):
                        c.needs_rebuild = True
-                       count += 1 + depcount
-       
+               else:
+                       for d in c.get_depends():
+                               if analyze_build(d):
+                                       c.needs_rebuild = True
+
                c.rebuild_checked = True
-       
-       return count
+
+       return c.needs_rebuild
 
 class Builder(object):
        def __init__(self, components, count):