Reimplement dependency order handling to solve a performance issue.
[matrix.git] / matrix / components.py
index 7f67037..bd9c970 100644 (file)
@@ -16,11 +16,11 @@ class Component(object):
        __dirty = None
 
        cached = None
        __dirty = None
 
        cached = None
-
-       rdepends = None
-       weight = None
        state = None
 
        state = None
 
+       rebuild_checked = False
+       needs_rebuild = False
+
        def __init__(self, name, branch=None, flags=[], rank=0):
                self.name = name
 
        def __init__(self, name, branch=None, flags=[], rank=0):
                self.name = name
 
@@ -58,6 +58,11 @@ class Component(object):
                return self.__dirty
 
        def add_depend(self, c):
                return self.__dirty
 
        def add_depend(self, c):
+               if self.rank < c.rank:
+                       c.rank = self.rank
+                       if config.debug:
+                               print 'Rank fixup:', c, 'inherits rank from', self
+
                self.depends.add(c)
 
        def remove_depend(self, c):
                self.depends.add(c)
 
        def remove_depend(self, c):
@@ -67,19 +72,6 @@ class Component(object):
        def get_depends(self):
                return self.depends
 
        def get_depends(self):
                return self.depends
 
-       def add_rdepend(self, c):
-               if self.rdepends is None:
-                       self.rdepends = set()
-
-               self.rdepends.add(c)
-
-       def get_rdepends(self):
-               return self.rdepends or ()
-
-       def clear_rdepends(self):
-               if self.rdepends:
-                       del self.rdepends
-
 class PlatformProvidedComponent(Component):
        """A Component that is provided by the platform.
           The sources will not be built during install."""
 class PlatformProvidedComponent(Component):
        """A Component that is provided by the platform.
           The sources will not be built during install."""
@@ -282,8 +274,3 @@ def fill_in_depends(components):
                                        depends.add(dep)
 
                components |= depends
                                        depends.add(dep)
 
                components |= depends
-
-def init_rdepends(components):
-       for c in components:
-               for dep in c.get_depends():
-                       dep.add_rdepend(c)