[Buildbot-devel] how to have two ShellCommands with different names...

Ed Hartnett ed at unidata.ucar.edu
Thu Jan 22 14:26:55 UTC 2004


buildbot-devel-request at lists.sourceforge.net writes:
> 1 - If I have two shell commands, (i.e. a rm and a cvs co), I get an
> error. That's why the first one is commented out above. How do I give
> them different names?
> 
> 2004/01/21 15:15 MST [-] Traceback (most recent call last):
> 	  File "/usr/lib/python2.2/site-packages/twisted/scripts/twistd.py", line 165, in startApplication
> 	    app.startApplication(application, not config['no_save'])
> 	  File "/usr/lib/python2.2/site-packages/twisted/application/app.py", line 220, in startApplication
> 	    service.IService(application).startService()
> 	  File "/usr/lib/python2.2/site-packages/twisted/application/service.py", line 194, in startService
> 	    service.startService()
> 	  File "/usr/lib/python2.2/site-packages/buildbot/master.py", line 378, in startService
> 	    self.loadTheConfigFile()
> 	--- <exception caught here> ---
> 	  File "/usr/lib/python2.2/site-packages/buildbot/master.py", line 397, in loadTheConfigFile
> 	    self.loadConfig(f)
> 	  File "/usr/lib/python2.2/site-packages/buildbot/master.py", line 490, in loadConfig
> 	    self.loadConfig_Builders(builders)
> 	  File "/usr/lib/python2.2/site-packages/buildbot/master.py", line 581, in loadConfig_Builders
> 	    builder = Builder(name, slave, builddir, factory, statusbag)
> 	  File "/usr/lib/python2.2/site-packages/buildbot/process/base.py", line 362, in __init__
> 	    self.waiting = self.newBuild()
> 	  File "/usr/lib/python2.2/site-packages/buildbot/process/base.py", line 387, in newBuild
> 	    b = self.buildFactory.newBuild()
> 	  File "/usr/lib/python2.2/site-packages/buildbot/process/base.py", line 762, in newBuild
> 	    b.setSteps(self.steps)
> 	  File "/usr/lib/python2.2/site-packages/buildbot/process/base.py", line 647, in setSteps
> 	    raise RuntimeError("duplicate step '%s'" % step.name)
> 	exceptions.RuntimeError: duplicate step 'shell'


To answer my own question, I just needed to subclass ShellCommand and
override the name attribute. This seems to work fine:

class RmCommand(ShellCommand):
    """I just need to override the name member."""
    name = "rm"
  
class TaggedBuildFactory(ConfigurableBuildFactory):
    def __init__(self, cvsroot, cvsmodule, tag, configure="configure", configureEnv={}, compile="make all",
                 test="make check", workdir="."):
        steps = []
        steps.append((RmCommand, {'workdir': ".",
                                     'command': "rm -rf %s" % workdir}))
        steps.append((ShellCommand, {'workdir': ".",
                                     'command': "cvs -d "+cvsroot+" co -r "+tag+" "+cvsmodule}))
 ...


Ed Hartnett





More information about the devel mailing list