jhbuild r2571 - in trunk: . jhbuild/buildbot jhbuild/commands jhbuild/frontends



Author: fpeters
Date: Thu Dec 11 13:06:00 2008
New Revision: 2571
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2571&view=rev

Log:
* jhbuild/buildbot/factory.py, jhbuild/commands/base.py,
jhbuild/commands/bot.py, jhbuild/frontends/buildscript.py: added a new
cleanone command, called from buildbot, so local buildslave settings
(makeclean = False) are used.



Modified:
   trunk/ChangeLog
   trunk/jhbuild/buildbot/factory.py
   trunk/jhbuild/commands/base.py
   trunk/jhbuild/commands/bot.py
   trunk/jhbuild/frontends/buildscript.py

Modified: trunk/jhbuild/buildbot/factory.py
==============================================================================
--- trunk/jhbuild/buildbot/factory.py	(original)
+++ trunk/jhbuild/buildbot/factory.py	Thu Dec 11 13:06:00 2008
@@ -38,8 +38,7 @@
         self.addStep(JHBuildCheckCommand, moduleset=self.moduleset, module=self.module)
 #	self.addStep(JHBuildModulePathCommand, moduleset=self.moduleset, module=self.module, action='module-reports.sh', 
 #                     haltOnFailure = False, actionName='coverage')
-	self.addStep(JHBuildModulePathCommand, moduleset=self.moduleset, module=self.module, action='make clean', 
-                     haltOnFailure = False, actionName='clean')
+	self.addStep(JHBuildCommand, stage='clean', moduleset=self.moduleset, module=self.module)
 
     def newBuild(self, request):
         return factory.BuildFactory.newBuild(self, request)

Modified: trunk/jhbuild/commands/base.py
==============================================================================
--- trunk/jhbuild/commands/base.py	(original)
+++ trunk/jhbuild/commands/base.py	Thu Dec 11 13:06:00 2008
@@ -131,6 +131,42 @@
 register_command(cmd_updateone)
 
 
+class cmd_cleanone(Command):
+    doc = _('Clean one or more modules')
+
+    name = 'cleanone'
+    usage_args = '[ options ... ] [ modules ... ]'
+
+    def __init__(self):
+        Command.__init__(self, [
+            make_option('--honour-config',
+                        action='store_true', dest='honour_config', default=False,
+                        help=_('honour the makeclean setting in config file')),
+            ])
+
+    def run(self, config, options, args):
+        if options.honour_config is False:
+            config.makeclean = True
+        module_set = jhbuild.moduleset.load(config)
+        try:
+            module_list = [module_set.get_module(modname, ignore_case = True) for modname in args]
+        except KeyError, e:
+            raise FatalError(_("A module called '%s' could not be found.") % e)
+
+        if not module_list:
+            self.parser.error(_('This command requires a module parameter.'))
+
+        if not config.makeclean:
+            print >> sys.stderr, uencode(
+                    _('I: clean command called while makeclean is set to False, skipped.'))
+            return 0
+
+        build = jhbuild.frontends.get_buildscript(config, module_list)
+        return build.clean()
+
+register_command(cmd_cleanone)
+
+
 def check_bootstrap_updateness(config):
     '''Check install date of bootstrap modules, and compare them to
        the bootstrap moduleset file last modification date.

Modified: trunk/jhbuild/commands/bot.py
==============================================================================
--- trunk/jhbuild/commands/bot.py	(original)
+++ trunk/jhbuild/commands/bot.py	Thu Dec 11 13:06:00 2008
@@ -149,6 +149,9 @@
                 config.makecheck = True
                 config.forcecheck = True
                 config.build_policy = 'all'
+            elif args[0] == 'clean':
+                command = 'cleanone'
+                args.append('--honour-config')
             else:
                 command = args[0]
             os.environ['TERM'] = 'dumb'

Modified: trunk/jhbuild/frontends/buildscript.py
==============================================================================
--- trunk/jhbuild/frontends/buildscript.py	(original)
+++ trunk/jhbuild/frontends/buildscript.py	Thu Dec 11 13:06:00 2008
@@ -21,7 +21,7 @@
 import os
 
 from jhbuild.utils import packagedb
-from jhbuild.errors import FatalError
+from jhbuild.errors import FatalError, CommandError
 
 class BuildScript:
     def __init__(self, config, module_list):
@@ -65,6 +65,27 @@
         '''
         raise NotImplementedError
 
+    def start_clean(self):
+        '''Hook to perform actions at start of clean.'''
+        pass
+
+    def end_clean(self):
+        '''Hook to perform actions at end of clean.'''
+        pass
+
+    def clean(self):
+        self.start_clean()
+
+        for module in self.modulelist:
+            try:
+                module.do_clean(self)
+            except CommandError:
+                self.message(_('Failed to clean %s') % module.name)
+
+        self.end_clean()
+        return 0
+
+
     def build(self):
         '''start the build of the current configuration'''
         self.start_build()



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