jhbuild r2307 - in trunk: . jhbuild tests



Author: fpeters
Date: Sun Aug 24 16:28:08 2008
New Revision: 2307
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2307&view=rev

Log:
* jhbuild/moduleset.py, tests/tests.py: recursively check <after>
dependencies when ordering modules.  (closes: #546640)



Modified:
   trunk/ChangeLog
   trunk/jhbuild/moduleset.py
   trunk/tests/tests.py

Modified: trunk/jhbuild/moduleset.py
==============================================================================
--- trunk/jhbuild/moduleset.py	(original)
+++ trunk/jhbuild/moduleset.py	Sun Aug 24 16:28:08 2008
@@ -132,15 +132,32 @@
                 if not depmod:
                     continue
                 order([self.modules[x] for x in depmod.dependencies], depmod, 'suggests')
+            extra_afters = []
             for modname in module.after:
                 depmod = self.modules.get(modname)
+                if not depmod:
+                    # this module doesn't exist, skip.
+                    continue
                 if not depmod in all_modules and not include_optional_modules:
-                    # skipping modules that would not be built otherwise
+                    # skip modules that would not be built otherwise
                     # (build_optional_modules being the argument to force them
                     # to be included nevertheless)
+
+                    if not depmod.dependencies:
+                        # depmod itself has no dependencies, skip.
+                        continue
+
+                    # more expensive, if depmod has dependencies, compute its
+                    # full list of hard dependencies, getting it into
+                    # extra_afters, so they are also evaluated.
+                    # <http://bugzilla.gnome.org/show_bug.cgi?id=546640>
+                    dep_modules = self.get_module_list(seed=[depmod.name])
+                    for m in dep_modules:
+                        if m in all_modules:
+                            extra_afters.append(m)
                     continue
-                if not depmod:
-                    continue
+                order([self.modules[x] for x in depmod.dependencies], depmod, 'after')
+            for depmod in extra_afters:
                 order([self.modules[x] for x in depmod.dependencies], depmod, 'after')
             state[module] = 'processed'
             ordered.append(module)

Modified: trunk/tests/tests.py
==============================================================================
--- trunk/tests/tests.py	(original)
+++ trunk/tests/tests.py	Sun Aug 24 16:28:08 2008
@@ -153,6 +153,15 @@
         self.moduleset.modules['qux'].suggests = ['foo']
         self.assertEqual(self.get_module_list(['foo']), ['baz', 'bar', 'quux', 'qux', 'foo'])
 
+    def test_dependency_chain_recursive_after(self):
+        '''A chain of dependencies with a recursively defined <after> module'''
+        # see http://bugzilla.gnome.org/show_bug.cgi?id=546640
+        self.moduleset.modules['foo'] # gtk-doc
+        self.moduleset.modules['bar'].dependencies = ['foo'] # meta-bootstrap
+        self.moduleset.modules['baz'].after = ['bar'] # cairo
+        self.moduleset.modules['qux'].dependencies = ['baz'] # meta-stuff
+        self.assertEqual(self.get_module_list(['qux', 'foo']), ['foo', 'baz', 'qux'])
+
 
 class BuildTestCase(unittest.TestCase):
     def setUp(self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]