cvs server: Diffing .
cvs server: Diffing contrib
cvs server: Diffing doc
cvs server: Diffing jhbuild
Index: jhbuild/config.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/config.py,v
retrieving revision 1.21
diff -u -p -r1.21 config.py
--- jhbuild/config.py	30 Nov 2004 10:17:15 -0000	1.21
+++ jhbuild/config.py	20 Aug 2005 01:43:33 -0000
@@ -31,7 +31,7 @@ _known_keys = [ 'moduleset', 'modules', 
                 'checkoutroot', 'buildroot', 'autogenargs', 'makeargs',
                 'cvsroots', 'svnroots', 'branches',
                 'builddir_pattern', 'module_autogenargs', 'module_makeargs',
-                'interact', 'buildscript', 'nonetwork',
+                'interact', 'buildscript', 'nonetwork', 'force_build',
                 'alwaysautogen', 'nobuild', 'makeclean', 'makecheck',
                 'use_lib64', 'tinderbox_outputdir', 'sticky_date',
                 'tarballdir', 'pretty_print' ]
Index: jhbuild/defaults.jhbuildrc
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/defaults.jhbuildrc,v
retrieving revision 1.16
diff -u -p -r1.16 defaults.jhbuildrc
--- jhbuild/defaults.jhbuildrc	9 May 2005 05:48:02 -0000	1.16
+++ jhbuild/defaults.jhbuildrc	20 Aug 2005 01:43:33 -0000
@@ -44,6 +44,7 @@ module_makeargs = {}
 
 # control parts of the build process
 nonetwork     = False  # never touch the network
+force_build   = False  # by default, don't rebuild if there are no cvs changes
 alwaysautogen = False  # call autogen.sh even if a makefile is found
 nobuild       = False  # don't actually build the packages
 makeclean     = False  # run make clean before building
Index: jhbuild/main.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/main.py,v
retrieving revision 1.17
diff -u -p -r1.17 main.py
--- jhbuild/main.py	11 Dec 2004 17:29:24 -0000	1.17
+++ jhbuild/main.py	20 Aug 2005 01:43:33 -0000
@@ -61,6 +61,7 @@ Options valid for the build, buildone an
   -a, --autogen                always run autogen.sh
   -c, --clean                  run make clean before make
   -n, --no-network             skip cvs update
+  -f, --force-build            always run build step, even if there were no changes
 
 Options valid for the tinderbox command:
   -o, --output=DIR             directory to save build logs in
cvs server: Diffing jhbuild/commands
Index: jhbuild/commands/base.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/commands/base.py,v
retrieving revision 1.9
diff -u -p -r1.9 base.py
--- jhbuild/commands/base.py	23 Mar 2004 08:05:46 -0000	1.9
+++ jhbuild/commands/base.py	20 Aug 2005 01:43:33 -0000
@@ -99,9 +99,9 @@ def do_update_one(config, args):
 register_command('updateone', do_update_one)
 
 def do_build(config, args):
-    opts, args = getopt.getopt(args, 'acns:t:D:',
+    opts, args = getopt.getopt(args, 'acns:t:D:f',
                                ['autogen', 'clean', 'no-network', 'skip=',
-                                'start-at='])
+                                'start-at=', 'force-build'])
 
     startat = None
     for opt, arg in opts:
@@ -117,6 +117,8 @@ def do_build(config, args):
             startat = arg
         elif opt == '-D':
             config.sticky_date = arg
+        elif opt in ('-f', '--force-build'):
+            config.force_build = True
     module_set = jhbuild.moduleset.load(config)
     module_list = module_set.get_module_list(args or config.modules,
                                              config.skip)
cvs server: Diffing jhbuild/cut_n_paste
cvs server: Diffing jhbuild/frontends
Index: jhbuild/frontends/buildscript.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/frontends/buildscript.py,v
retrieving revision 1.7
diff -u -p -r1.7 buildscript.py
--- jhbuild/frontends/buildscript.py	9 Aug 2004 10:18:46 -0000	1.7
+++ jhbuild/frontends/buildscript.py	20 Aug 2005 01:43:34 -0000
@@ -51,10 +51,10 @@ class BuildScript:
         self.packagedb = packagedb.PackageDB(os.path.join(packagedbdir,
                                                           'packagedb.xml'))
 
-    def execute(self, command, hint=None):
+    def execute(self, command, filter=None):
         '''executes a command, and returns the error code.
-        The optional argument is to give a hint about the type of output
-        that will be produced.'''
+        The filter argument specifies a class which has a filter
+        method for transforming the output produced'''
         raise NotImplementedError
 
     def build(self):
Index: jhbuild/frontends/terminal.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/frontends/terminal.py,v
retrieving revision 1.19
diff -u -p -r1.19 terminal.py
--- jhbuild/frontends/terminal.py	27 Jun 2005 03:31:59 -0000	1.19
+++ jhbuild/frontends/terminal.py	20 Aug 2005 01:43:34 -0000
@@ -85,16 +85,14 @@ class TerminalBuildScript(buildscript.Bu
             action_target = module.name
         self.message('%s %s' % (action, action_target), module_num)
 
-    def execute(self, command, hint=None):
+    def execute(self, command, filter=None):
         '''executes a command, and returns the error code'''
         if isinstance(command, (str, unicode)):
             print command
         else:
             print ' '.join(command)
 
-        # get rid of hint if pretty printing is disabled.
-        if not self.config.pretty_print: hint = None
-        if hint == 'cvs':
+        if not (filter is None):
             stdout = subprocess.PIPE
             stderr = subprocess.STDOUT
         else:
@@ -105,27 +103,19 @@ class TerminalBuildScript(buildscript.Bu
             close_fds=True,
             stdin=subprocess.PIPE, stdout=stdout, stderr=stderr)
 
-        if hint == 'cvs':
-            conflicts = []
-            def format_line(line, error_output, conflicts=conflicts):
+        if not (filter is None):
+            def filter_line(line, was_stderr):
                 if line[-1] == '\n': line = line[:-1]
-                if line.startswith('C '):
-                    conflicts.append(line)
+                (line, highlight) = filter.filter(line)
+                if highlight == 'error':
                     print '%s%s%s' % (t_colour[12], line, t_reset)
-                elif line.startswith('M '):
+                elif highlight == 'important':
                     print '%s%s%s' % (t_colour[10], line, t_reset)
-                elif line.startswith('? '):
+                elif highlight == 'notice':
                     print '%s%s%s' % (t_colour[8], line, t_reset)
                 else:
                     print line
-            cmds.pprint_output(p, format_line)
-            if conflicts:
-                sys.stdout.write('\nConflicts during checkout:\n')
-                for line in conflicts:
-                    sys.stdout.write('%s  %s%s\n'
-                                     % (t_colour[12], line, t_reset))
-                # make sure conflicts fail
-                if p.returncode == 0: p.returncode = 1
+            cmds.pprint_output(p, filter_line)
         else:
             try:
                 p.communicate()
cvs server: Diffing jhbuild/frontends/icons
cvs server: Diffing jhbuild/modtypes
Index: jhbuild/modtypes/base.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/modtypes/base.py,v
retrieving revision 1.18
diff -u -p -r1.18 base.py
--- jhbuild/modtypes/base.py	14 May 2005 19:09:53 -0000	1.18
+++ jhbuild/modtypes/base.py	20 Aug 2005 01:43:34 -0000
@@ -182,6 +182,7 @@ class AutogenModule(Package):
         error = None
         if buildscript.execute(cmd) != 0:
             error = 'could not make module'
+            buildscript.packagedb.mark_failed(self.name)
         else:
             buildscript.packagedb.add(self.name, self.get_revision() or '')
         return (self.STATE_DONE, error, [])
@@ -224,11 +225,29 @@ class CVSModule(AutogenModule):
         srcdir = self.get_srcdir(buildscript)
         builddir = self.get_builddir(buildscript)
         buildscript.set_action('Checking out', self)
-        res = cvsroot.update(buildscript, self.cvsmodule,
-                             self.revision, buildscript.config.sticky_date,
-                             checkoutdir=self.checkoutdir)
-
-        if buildscript.config.nobuild:
+        res = 1
+        did_update = True
+        try:
+            did_update = cvsroot.update(buildscript, self.cvsmodule,
+                                        self.revision, buildscript.config.sticky_date,
+                                        checkoutdir=self.checkoutdir)
+            res = 0
+        except cvs.CVSConflictException, e:
+            sys.stdout.write("Conflicts during update\n")
+            for line in e.get_conflicts():
+                sys.stdout.write('%s  %s%s\n'
+                                 % (t_colour[12], line, t_reset))
+        except cvs.CVSException, e:
+            res = e.get_retval() 
+         
+        previous_install = buildscript.packagedb.check(self.name)
+
+        # If the previous installation has succeeded, and there are no
+        # cvs updates, we're done
+        if res == 0 and (not buildscript.config.force_build) \
+               and previous_install and (not did_update):
+            nextstate = self.STATE_DONE
+        elif buildscript.config.nobuild:
             nextstate = self.STATE_DONE
         elif buildscript.config.alwaysautogen or \
                  not os.path.exists(os.path.join(builddir, 'Makefile')):
cvs server: Diffing jhbuild/utils
Index: jhbuild/utils/cvs.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/utils/cvs.py,v
retrieving revision 1.10
diff -u -p -r1.10 cvs.py
--- jhbuild/utils/cvs.py	23 Jun 2005 14:07:31 -0000	1.10
+++ jhbuild/utils/cvs.py	20 Aug 2005 01:43:34 -0000
@@ -105,9 +105,46 @@ def check_root(dirname):
     root_file = os.path.join(dirname, 'CVS', 'Root')
     return open(root_file, 'r').read().strip()
 
+class CVSUpdateProcessFilter:
+    def __init__(self):
+        self.conflicts = []
+        self.did_update_flag = False
+    
+    def filter(self, line):
+        if line.startswith('C '):
+            self.conflicts.append(line)
+            self.did_update_flag = True
+            return (line, 'error')
+        elif line.startswith('M '):
+            return (line, 'important')
+        elif line.startswith('? '):
+            return (line, 'notice')
+        elif line.startswith('U ') or line.startswith('A ') or line.startswith('P '):
+            self.did_update_flag = True
+            return (line, 'none')
+        else:
+            return (line, 'none')
+
+    def get_conflicts(self):
+        return self.conflicts
+
+    def has_conflicts(self):
+        return len(self.conflicts) > 0
+
+    def did_update(self):
+        return self.did_update_flag
+
+class CVSException(Exception):
+    def get_retval(self):
+        return self.args[0]
+
+class CVSConflictException(Exception):
+    def get_conflicts(self):
+        return self.args[0]
+
 class CVSRoot:
     '''A class to wrap up various CVS operations.'''
-    
+
     def __init__(self, cvsroot, checkoutroot):
         self.cvsroot = cvsroot
         self.localroot = checkoutroot
@@ -140,7 +177,10 @@ class CVSRoot:
 
     def update(self, buildscript, module, revision=None, date=None,
                checkoutdir=None):
-        '''Perform a "cvs update" (or possibly a checkout)'''
+        '''Perform a "cvs update" (or possibly a checkout); return
+        whether or not an update was actually performed. Throw a
+        CVSException on cvs command failure, and a
+        CVSConflictException on conflicts'''
         dir = self.getcheckoutdir(module, checkoutdir)
         if not os.path.exists(dir):
             return self.checkout(buildscript, module,
@@ -167,4 +207,15 @@ class CVSRoot:
 
         cmd.append('.')
 
-        return buildscript.execute(cmd, 'cvs')
+        filter = CVSUpdateProcessFilter()
+
+        retval = buildscript.execute(cmd, filter=filter)
+        if filter.has_conflicts():
+            raise CVSConflictException(filter.get_conflicts())
+        if retval != 0:
+            raise CVSException("cvs update returned status %d" % (retval,))
+        return filter.did_update() 
+        
+
+        
+            
Index: jhbuild/utils/packagedb.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/utils/packagedb.py,v
retrieving revision 1.3
diff -u -p -r1.3 packagedb.py
--- jhbuild/utils/packagedb.py	10 Apr 2004 13:17:04 -0000	1.3
+++ jhbuild/utils/packagedb.py	20 Aug 2005 01:43:34 -0000
@@ -51,8 +51,9 @@ class PackageDB:
             if node.nodeName != 'entry': continue
             package = node.getAttribute('package')
             version = node.getAttribute('version')
+            failed = (node.getAttribute('failed') != '')
             installed = _parse_isotime(node.getAttribute('installed'))
-            self.entries[package] = (version, installed)
+            self.entries[package] = (version, installed, failed)
         document.unlink()
 
     def _write_cache(self):
@@ -61,11 +62,13 @@ class PackageDB:
         node = document.createTextNode('\n')
         document.documentElement.appendChild(node)
         for package in self.entries:
-            version, installed = self.entries[package]
+            version, installed, failed = self.entries[package]
             node = document.createElement('entry')
             node.setAttribute('package', package)
             node.setAttribute('version', version)
             node.setAttribute('installed', _format_isotime(installed))
+            if failed:
+                node.setAttribute('failed', 'true')
             document.documentElement.appendChild(node)
 
             node = document.createTextNode('\n')
@@ -77,16 +80,22 @@ class PackageDB:
     def add(self, package, version):
         '''Add a module to the install cache.'''
         now = time.time()
-        self.entries[package] = (version, now)
+        self.entries[package] = (version, now, False)
+        self._write_cache()
+
+    def mark_failed(self, package):
+        '''Flag a module as having failed installation'''
+        now = time.time()
+        self.entries[package] = (version, now, True)
         self._write_cache()
 
     def check(self, package, version=None):
         '''Check whether a particular module is installed.'''
         if not self.entries.has_key(package): return False
-        p_version, p_installed = self.entries[package]
+        p_version, p_installed, p_failed = self.entries[package]
         if version:
             if version != p_version: return False
-        return True
+        return not p_failed
 
     def installdate(self, package, version=None):
         '''Get the install date for a particular module.'''
cvs server: Diffing modulesets
cvs server: Diffing patches
cvs server: Diffing scripts
