Fix issues with parallel builds.
authorIlpo Ruotsalainen <ilpo.ruotsalainen@movial.fi>
Fri, 12 Dec 2008 14:54:47 +0000 (16:54 +0200)
committerIlpo Ruotsalainen <ilpo.ruotsalainen@movial.fi>
Fri, 12 Dec 2008 14:54:47 +0000 (16:54 +0200)
a) Building packages too early due to incorrect dependency check.
b) Huge CPU churn when nothing could be built due to dependencies being busy.

matrix/build.py

index bc52f0f..69f3728 100644 (file)
@@ -145,20 +145,25 @@ class Builder(object):
        def can_start_job(self):
                return len(self.jobs) < config.jobs
 
+       def check_depends(self, components):
+               for c in components:
+                       if c.needs_rebuild and c.state != 'done':
+                               return False
+
+               return True
+
+
        def find_build_job(self, components):
                for c in components:
-                       if c.state or not c.needs_rebuild:
+                       if not c.needs_rebuild or c.state:
                                continue
 
-                       dep_job = self.find_build_job(c.get_depends())
-
-                       if dep_job:
-                               return dep_job
+                       if not self.check_depends(c.get_depends()):
+                               continue
 
                        return c
 
                return None
-                               
 
        def start_build(self, c):
                if not c.source.exists():