jhbuild r2067 - in trunk: . doc/C jhbuild jhbuild/commands jhbuild/frontends



Author: fpeters
Date: Sat May  3 16:25:24 2008
New Revision: 2067
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2067&view=rev

Log:
* doc/C/jhbuild.xml, jhbuild/commands/base.py, jhbuild/config.py,
jhbuild/defaults.jhbuildrc, jhbuild/frontends/buildscript.py: added a
--min-age option for build and buildone commands.  (closes: #384423)

* doc/C/jhbuild.xml: fixed Docbook correctness.



Modified:
   trunk/ChangeLog
   trunk/doc/C/jhbuild.xml
   trunk/jhbuild/commands/base.py
   trunk/jhbuild/config.py
   trunk/jhbuild/defaults.jhbuildrc
   trunk/jhbuild/frontends/buildscript.py

Modified: trunk/doc/C/jhbuild.xml
==============================================================================
--- trunk/doc/C/jhbuild.xml	(original)
+++ trunk/doc/C/jhbuild.xml	Sat May  3 16:25:24 2008
@@ -543,6 +543,7 @@
 	<arg>--no-poison</arg>
 	<arg>--force</arg>
 	<arg>--build-optional-modules</arg>
+        <arg>--min-age=<replaceable>time</replaceable></arg>
 	<arg rep="repeat">module</arg>
       </cmdsynopsis>
 
@@ -670,17 +671,34 @@
 
 	<varlistentry>
 	  <term><option>-f</option>, <option>--force</option></term>
-	  <listitem>Build the modules even if policy tells it is
-	  not required.</listitem>
+	  <listitem>
+            <simpara>Build the modules even if policy tells it is
+	    not required.</simpara>
+          </listitem>
 	</varlistentry>
 
 	<varlistentry>
 	  <term><option>--build-optional-modules</option></term>
-	  <listitem>Some modules, listed as optional dependencies, may not be
-	  required to build the target module, this option inncludes them
-	  nevertheless.</listitem>
+	  <listitem>
+            <simpara>Some modules, listed as optional dependencies, may not be
+            required to build the target module, this option inncludes them
+            nevertheless.</simpara>
+          </listitem>
 	</varlistentry>
 
+        <varlistentry>
+          <term><option>--min-time</option>=<replaceable>time</replaceable></term>
+          <listitem>
+            <simpara>Skip modules installed more recently than the given
+            relative time; the <replaceable>time</replaceable> string format
+            is a number followed by a unit, with the following units being
+            supported: seconds (s), minutes (m), hours (h) and days (d).
+            </simpara>
+            <simpara>Example: <option>--min-time=2h</option> will skip
+            modules that have been built less than two hours ago.</simpara>
+          </listitem>
+        </varlistentry>
+
       </variablelist>
 
     </section>
@@ -702,6 +720,7 @@
 	<arg>-D <replaceable>date</replaceable></arg>
 	<arg>--no-xvfb</arg>
 	<arg>--force</arg>
+        <arg>--min-age=<replaceable>time</replaceable></arg>
 	<arg choice="plain" rep="repeat">module</arg>
       </cmdsynopsis>
 
@@ -881,9 +900,11 @@
 
 	<varlistentry>
 	  <term><option>--list-optional-modules</option></term>
-	  <listitem>Some modules, listed as optional dependencies, may not be
-	  required to get to the target module, this option inncludes them
-	  nevertheless.</listitem>
+	  <listitem>
+            <simpara>Some modules, listed as optional dependencies, may not be
+            required to get to the target module, this option inncludes them
+            nevertheless.</simpara>
+          </listitem>
 	</varlistentry>
 
       </variablelist>

Modified: trunk/jhbuild/commands/base.py
==============================================================================
--- trunk/jhbuild/commands/base.py	(original)
+++ trunk/jhbuild/commands/base.py	Sat May  3 16:25:24 2008
@@ -18,7 +18,9 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 import os
+import re
 import sys
+import time
 from optparse import make_option
 
 import jhbuild.moduleset
@@ -27,6 +29,15 @@
 from jhbuild.commands import Command, register_command
 
 
+def parse_relative_time(s):
+    m = re.match(r'(\d+) *([smhd])', s.lower())
+    if m:
+        coeffs = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400}
+        return float(m.group(1)) * coeffs[m.group(2)]
+    else:
+        raise ValueError('unable to parse \'%s\' as relative time.' % s)
+
+
 class cmd_update(Command):
     """Update all modules from version control"""
 
@@ -93,7 +104,7 @@
     def run(self, config, options, args):
         if options.sticky_date is not None:
             config.sticky_date = options.sticky_date
-
+        
         module_set = jhbuild.moduleset.load(config)
         try:
             module_list = [module_set.modules[modname] for modname in args]
@@ -167,6 +178,9 @@
             make_option('--build-optional-modules',
                         action='store_true', dest='build_optional_modules', default=False,
                         help="also build soft-dependencies that could be skipped"),
+            make_option('--min-age', metavar='TIME-SPEC',
+                        action='store', dest='min_age', default=None,
+                        help='skip modules installed less than the given time ago'),
             ])
 
     def run(self, config, options, args):
@@ -196,6 +210,8 @@
             config.quiet_mode = True
         if options.force_policy:
             config.build_policy = 'all'
+        if options.min_age:
+            config.min_time = time.time() - parse_relative_time(options.min_age)
 
         module_set = jhbuild.moduleset.load(config)
         module_list = module_set.get_module_list(args or config.modules,
@@ -249,6 +265,9 @@
             make_option('-f', '--force',
                         action='store_true', dest='force_policy', default=False,
                         help="build even if policy says not to"),
+            make_option('--min-age', metavar='TIME-SPEC',
+                        action='store', dest='min_age', default=None,
+                        help='skip modules installed less than the given time ago'),
             ])
 
     def run(self, config, options, args):
@@ -270,6 +289,8 @@
             config.quiet_mode = True
         if options.force_policy:
             config.build_policy = 'all'
+        if options.min_age:
+            config.min_time = time.time() - parse_relative_time(options.min_age)
 
         module_set = jhbuild.moduleset.load(config)
         try:

Modified: trunk/jhbuild/config.py
==============================================================================
--- trunk/jhbuild/config.py	(original)
+++ trunk/jhbuild/config.py	Sat May  3 16:25:24 2008
@@ -40,7 +40,7 @@
                 'tarballdir', 'pretty_print', 'svn_program', 'makedist',
                 'makedistcheck', 'nonotify', 'cvs_program',
                 'checkout_mode', 'copy_dir', 'module_checkout_mode',
-                'build_policy', 'trycheckout',
+                'build_policy', 'trycheckout', 'min_time',
                 'nopoison', 'makecheck_advisory',
                 'quiet_mode', 'progress_bar', 'module_extra_env']
 

Modified: trunk/jhbuild/defaults.jhbuildrc
==============================================================================
--- trunk/jhbuild/defaults.jhbuildrc	(original)
+++ trunk/jhbuild/defaults.jhbuildrc	Sat May  3 16:25:24 2008
@@ -18,6 +18,11 @@
 #    have changed.
 build_policy = 'all'
 
+# skip modules installed before $min_time (in seconds since epoch)
+# for example: min_time = time.time() - 3600 will skip modules that
+# have been installed less than one hour ago.
+min_time = None
+
 # modules to skip during dependency expansion
 skip = []
 # tags used as module filters

Modified: trunk/jhbuild/frontends/buildscript.py
==============================================================================
--- trunk/jhbuild/frontends/buildscript.py	(original)
+++ trunk/jhbuild/frontends/buildscript.py	Sat May  3 16:25:24 2008
@@ -73,6 +73,13 @@
         self.module_num = 0
         for module in self.modulelist:
             self.module_num = self.module_num + 1
+
+            if self.config.min_time is not None:
+                installdate = self.packagedb.installdate(module.name)
+                if installdate > self.config.min_time:
+                    self.message('Skipping %s (installed recently)' % module.name)
+                    continue
+
             self.start_module(module.name)
             failed = False
             for dep in module.dependencies:



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