jhbuild r1849 - in trunk: . doc/C jhbuild jhbuild/commands jhbuild/modtypes modulesets



Author: fpeters
Date: Sat Jan 19 00:28:12 2008
New Revision: 1849
URL: http://svn.gnome.org/viewvc/jhbuild?rev=1849&view=rev

Log:
* doc/C/jhbuild.xml, jhbuild/commands/base.py, jhbuild/config.py,
jhbuild/defaults.jhbuildrc, jhbuild/modtypes/__init__.py,
jhbuild/moduleset.py, modulesets/moduleset.dtd: implemented a support
for "tags", modules are automatically tagged with the name of the
moduleset they are from, and build, update and list commands accept a
list of tags modules must match to be considered; based on idea and
patch of Colin Walters.  (closes: #460360)



Modified:
   trunk/ChangeLog
   trunk/doc/C/jhbuild.xml
   trunk/jhbuild/commands/base.py
   trunk/jhbuild/config.py
   trunk/jhbuild/defaults.jhbuildrc
   trunk/jhbuild/modtypes/__init__.py
   trunk/jhbuild/moduleset.py
   trunk/modulesets/moduleset.dtd

Modified: trunk/doc/C/jhbuild.xml
==============================================================================
--- trunk/doc/C/jhbuild.xml	(original)
+++ trunk/doc/C/jhbuild.xml	Sat Jan 19 00:28:12 2008
@@ -533,6 +533,7 @@
 	<arg>--no-network</arg>
 	<arg rep="repeat">--skip=<replaceable>module</replaceable></arg>
 	<arg>--start-at=<replaceable>module</replaceable></arg>
+	<arg>--tags=<replaceable>tags</replaceable></arg>
 	<arg>-D <replaceable>date</replaceable></arg>
 	<arg>--no-xvfb</arg>
 	<arg>--try-checkout</arg>
@@ -601,6 +602,18 @@
 	</varlistentry>
 
 	<varlistentry>
+	  <term>
+	  <option>--tags</option>=<replaceable>tag,...</replaceable></term>
+	  <listitem>
+	    <simpara>Ignore modules that do not match any of
+	    <replaceable>tag</replaceable> when following dependencies
+	    to expand the list of modules to be built.</simpara>
+	    <simpara>At the moment modules are automatically attributed a tag
+	    with the name of the module set they sit in.</simpara>
+	  </listitem>
+	</varlistentry>
+
+	<varlistentry>
 	  <term><option>-t</option>,
 	  <option>--start-at</option>=<replaceable>module</replaceable></term>
 	  <listitem>
@@ -805,6 +818,7 @@
 	<command>jhbuild list</command>
 	<arg>-r</arg>
 	<arg>-s</arg>
+	<arg>--tags=<replaceable>tags</replaceable></arg>
 	<arg rep="repeat">module</arg>
       </cmdsynopsis>
 
@@ -831,6 +845,17 @@
 	    dependencies to expand the list of modules.</simpara>
 	  </listitem>
 	</varlistentry>
+
+	<varlistentry>
+	  <term>
+	  <option>--tags</option>=<replaceable>tag,...</replaceable></term>
+	  <listitem>
+	    <simpara>Ignore modules that do not match any of
+	    <replaceable>tag</replaceable> when following dependencies
+	    to expand the list of modules to be displayed.</simpara>
+	  </listitem>
+	</varlistentry>
+
       </variablelist>
 
     </section>
@@ -999,13 +1024,14 @@
 	<command>jhbuild update</command>
 	<arg rep="repeat">--skip=<replaceable>module</replaceable></arg>
 	<arg>--start-at=<replaceable>module</replaceable></arg>
+	<arg>--tags=<replaceable>tags</replaceable></arg>
 	<arg>-D <replaceable>date</replaceable></arg>
 	<arg rep="repeat">module</arg>
       </cmdsynopsis>
 
-      <para>The <option>--skip</option>, <option>--start-at</option>
-      and <option>-D</option> options are processed the same as for
-      <command>build</command>.</para>
+      <para>The <option>--skip</option>, <option>--start-at</option>,
+      <option>--tags</option> and <option>-D</option> options are processed the
+      same as for <command>build</command>.</para>
 
     </section>
 

Modified: trunk/jhbuild/commands/base.py
==============================================================================
--- trunk/jhbuild/commands/base.py	(original)
+++ trunk/jhbuild/commands/base.py	Sat Jan 19 00:28:12 2008
@@ -41,6 +41,9 @@
             make_option('-t', '--start-at', metavar='MODULE',
                         action='store', dest='startat', default=None,
                         help='start building at the given module'),
+            make_option('--tags',
+                        action='append', dest='tags', default=[],
+                        help='build only modules with the given tags'),
             make_option('-D', metavar='DATE-SPEC',
                         action='store', dest='sticky_date', default=None,
                         help='set a sticky date when checking out modules'),
@@ -49,12 +52,14 @@
     def run(self, config, options, args):
         for item in options.skip:
             config.skip += item.split(',')
+        for item in options.tags:
+            config.tags += item.split(',')
         if options.sticky_date is not None:
             config.sticky_date = options.sticky_date
 
         module_set = jhbuild.moduleset.load(config)
         module_list = module_set.get_module_list(args or config.modules,
-                                                 config.skip)
+                config.skip, tags = config.tags)
         # remove modules up to startat
         if options.startat:
             while module_list and module_list[0].name != options.startat:
@@ -141,6 +146,9 @@
             make_option('-t', '--start-at', metavar='MODULE',
                         action='store', dest='startat', default=None,
                         help='start building at the given module'),
+            make_option('--tags',
+                        action='append', dest='tags', default=[],
+                        help='build only modules with the given tags'),
             make_option('-D', metavar='DATE-SPEC',
                         action='store', dest='sticky_date', default=None,
                         help='set a sticky date when checking out modules'),
@@ -171,6 +179,8 @@
             config.nonetwork = True
         for item in options.skip:
             config.skip += item.split(',')
+        for item in options.tags:
+            config.tags += item.split(',')
         if options.sticky_date is not None:
             config.sticky_date = options.sticky_date
         if options.noxvfb is not None:
@@ -186,7 +196,7 @@
 
         module_set = jhbuild.moduleset.load(config)
         module_list = module_set.get_module_list(args or config.modules,
-                                                 config.skip)
+                config.skip, tags = config.tags)
         # remove modules up to startat
         if options.startat:
             while module_list and module_list[0].name != options.startat:
@@ -354,14 +364,19 @@
             make_option('-s', '--skip', metavar='MODULES',
                         action='append', dest='skip', default=[],
                         help='treat the given modules as up to date'),
+            make_option('--tags',
+                        action='append', dest='tags', default=[],
+                        help='build only modules with the given tags'),
             ])
 
     def run(self, config, options, args):
         for item in options.skip:
             config.skip += item.split(',')
+        for item in options.tags:
+            config.tags += item.split(',')
         module_set = jhbuild.moduleset.load(config)
         module_list = module_set.get_module_list(args or config.modules,
-                                                 config.skip)
+                config.skip, tags = config.tags)
 
         for mod in module_list:
             if options.show_rev:

Modified: trunk/jhbuild/config.py
==============================================================================
--- trunk/jhbuild/config.py	(original)
+++ trunk/jhbuild/config.py	Sat Jan 19 00:28:12 2008
@@ -28,7 +28,7 @@
 _defaults_file = os.path.join(os.path.dirname(__file__), 'defaults.jhbuildrc')
 _default_jhbuildrc = os.path.join(os.environ['HOME'], '.jhbuildrc')
 
-_known_keys = [ 'moduleset', 'modules', 'skip', 'prefix',
+_known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
                 'checkoutroot', 'buildroot', 'autogenargs', 'makeargs',
                 'repos', 'branches', 'noxvfb', 'xvfbargs',
                 'builddir_pattern', 'module_autogenargs', 'module_makeargs',

Modified: trunk/jhbuild/defaults.jhbuildrc
==============================================================================
--- trunk/jhbuild/defaults.jhbuildrc	(original)
+++ trunk/jhbuild/defaults.jhbuildrc	Sat Jan 19 00:28:12 2008
@@ -17,6 +17,8 @@
 
 # modules to skip during dependency expansion
 skip = []
+# tags used as module filters
+tags = []
 
 # directories
 prefix = '/opt/gnome2'

Modified: trunk/jhbuild/modtypes/__init__.py
==============================================================================
--- trunk/jhbuild/modtypes/__init__.py	(original)
+++ trunk/jhbuild/modtypes/__init__.py	Sat Jan 19 00:28:12 2008
@@ -148,6 +148,7 @@
         self.dependencies = dependencies
         self.after = after
         self.suggests = suggests
+        self.tags = []
 
     def __repr__(self):
         return "<%s '%s'>" % (self.__class__.__name__, self.name)

Modified: trunk/jhbuild/moduleset.py
==============================================================================
--- trunk/jhbuild/moduleset.py	(original)
+++ trunk/jhbuild/moduleset.py	Sat Jan 19 00:28:12 2008
@@ -43,33 +43,7 @@
         '''add a Module object to this set of modules'''
         self.modules[module.name] = module
 
-    # functions for handling dep expansion
-    def __expand_mod_list(self, modlist, skip):
-        '''expands a list of names to a list of Module objects.  Expands
-        dependencies.  Does not handle loops in deps''' #"
-        ret = [self.modules[modname]
-                   for modname in modlist
-                       if modname not in skip]
-        i = 0
-        while i < len(ret):
-            depadd = []
-            for depmod in [self.modules[modname]
-                               for modname in ret[i].dependencies]:
-                if depmod not in ret[:i+1] and depmod.name not in skip:
-                    depadd.append(depmod)
-            if depadd:
-                ret[i:i] = depadd
-            else:
-                i = i + 1
-        i = 0
-        while i < len(ret):
-            if ret[i] in ret[:i]:
-                del ret[i]
-            else:
-                i = i + 1
-        return ret
-
-    def get_module_list(self, seed, skip=[], ignore_cycles = False):
+    def get_module_list(self, seed, skip=[], tags=[], ignore_cycles = False):
         '''gets a list of module objects (in correct dependency order)
         needed to build the modules in the seed list'''
 
@@ -111,6 +85,15 @@
             # mark skipped modules as already processed
             state[self.modules.get(modname)] = 'processed'
 
+        if tags:
+            for modname in self.modules:
+                for tag in tags:
+                    if tag in self.modules[modname].tags:
+                        break
+                else:
+                    # no tag matched, mark module as processed
+                    state[self.modules[modname]] = 'processed'
+
         def order(modules, module, mode = 'dependencies'):
             if state.get(module, 'clean') == 'processed':
                 # already seen
@@ -274,6 +257,9 @@
 
     assert document.documentElement.nodeName == 'moduleset'
     moduleset = ModuleSet()
+    moduleset_name = document.documentElement.getAttribute('name')
+    if not moduleset_name and uri.endswith('.modules'):
+        moduleset_name = os.path.basename(uri)[:-len('.modules')]    
 
     # load up list of repositories
     repositories = {}
@@ -332,7 +318,10 @@
                                'arch-archive']:
             pass
         else:
-            moduleset.add(modtypes.parse_xml_node(node, config, uri,
-                                                  repositories, default_repo))
+            module = modtypes.parse_xml_node(node, config, uri,
+                    repositories, default_repo)
+            if moduleset_name:
+                module.tags.append(moduleset_name)
+            moduleset.add(module)
 
     return moduleset

Modified: trunk/modulesets/moduleset.dtd
==============================================================================
--- trunk/modulesets/moduleset.dtd	(original)
+++ trunk/modulesets/moduleset.dtd	Sat Jan 19 00:28:12 2008
@@ -1,4 +1,6 @@
 <!ELEMENT moduleset (repository|include|autotools|metamodule|tarball|mozillamodule|distutils|perl|linux|testmodule|cvsroot|cvsmodule|waf)+>
+<!ATTLIST moduleset
+	name     CDATA  #IMPLIED>
 
 <!ELEMENT repository EMPTY>
 <!ATTLIST repository



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