[Buildbot-devel] can't get my subclass to work!

Stephen Davis stephendavis at mac.com
Wed Jan 21 23:49:07 UTC 2004


On Jan 21, 2004, at 2:36 PM, Ed Hartnett wrote:
> class TaggedBuildFactory(ConfigurableBuildFactory):
>     def __init__(self, cvsroot, cvsmodule, tag, configure="configure", 
> configureEnv={}, compile="make all",
>                  test="make check", workdir="."):
>         steps = []
> #        steps.append((ShellCommand, {'workdir': ".",
> #                                     'command': "rm -rf %s" % 
> workdir}))
>         steps.append((ShellCommand, {'workdir': ".",
>                                      'command': "cvs -d "+cvsroot+" co 
> -r "+tag+" "+cvsmodule}))
>         steps.append((Configure, {'workdir': workdir,
>                                   'command': configure,
>                                   'env': configureEnv}))
>         steps.append((Compile, {'workdir': workdir,
>                                 'command': compile}))
>         steps.append((Test, {'workdir': workdir,
>                              'command': test}))
>         self.steps = steps
>
> Some questions and problems:
>
> 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'

As you noticed, multiple steps can't have the same name.  I just 
created a simple sub-class of ShellCommand that looks something like 
this:

class CreateCommand( ShellCommand ):
	"""Simple sub-class to return the word "create" to the build status 
display"""
	def words( self ):
		return ["create"]

You'd have to do this for each invocation of a ShellCommand.  The 
ShellCommand class should probably take a name parameter or something 
to override the default of 'shell'.

> 2 - When I run this bot from the webpage, the configure step doesn't
> work:
>
> command './configure' in dir '.'
>
> Upon execvpe ./configure ['./configure'] in environment id 141045236:
> Traceback (most recent call last):
>   File "/usr/lib/python2.2/site-packages/twisted/internet/process.py", 
> line 502, in __init__
>     os.execvpe(command, args, environment)
>   File "/usr/src/build/317580-i386/install/usr/lib/python2.2/os.py", 
> line 308, in execvpe
>     _execvpe(file, args, env)
>   File "/usr/src/build/317580-i386/install/usr/lib/python2.2/os.py", 
> line 325, in _execvpe
>     apply(func, (file,) + argrest)
> OSError: [Errno 2] No such file or directory
> program finished with exit code 1
>
> What the heck?

If I had to guess, I'd say that the working dir for the ./configure 
command isn't correct so it can't find the configure script.  Either 
that, or the configure script isn't executable after cvs checkout.  Are 
you saying that it works normally but doesn't work from the web page?  
Just checking.

Hope that helps,
stephen





More information about the devel mailing list