[Buildbot-devel] Using a Factory with Another Factory

Jonathan Perkins perkinjo at cse.ohio-state.edu
Sat Dec 6 01:12:01 UTC 2008


Ben:
Thanks!  This worked like a charm.

On Thu, Dec 04, 2008 at 05:53:35PM -0500, Ben Hearsum wrote:
> It doesn't quite work this way. You can try something like:
> factory1 = factory.BuildFactory()
> ...
> factory2 = factory.BuildFactory()
> ...
>
> factory1.steps.extend(factory2.steps)
>
> Ultimately, it would be _awesome_ to be be able to easily combine one  
> factory with another. I filed a ticket on this that I haven't had time  
> to work on yet :(
> http://buildbot.net/trac/ticket/317
>
> On 4-Dec-08, at 5:40 PM, Razvan Lupusoru wrote:
>
>> Hello,
>>
>> I am trying to load a factory within another factory. This is done  
>> like
>> this:
>> ####
>> factory_gcc_EM64T = factory.BuildFactory()
>> factory_gcc_EM64T.addStep(ShellCommand(command=["/bin/env"],
>>                                        env={'NOWINSTALLPATH':
>> 'gen2-gcc-em64t'}))
>> factory_gcc_EM64T.addStep(compileAndBuildFactory) # Add compilation
>> abilities
>>
>> compileAndBuildFactory= factory.BuildFactory()
>> compileAndBuildFactory.addStep(SVN(mode='update', baseURL=SVN_URL,
>> defaultBranch='trunk'))
>> ####
>>
>> The reason I am doing this is because I need my first factory to set
>> some environment variables which will be used by  
>> compileAndBuildFactory
>> so that it stays a generic factory that I can reuse. The configuration
>> file passes the buildbot checkconfig option. However, whenever I start 
>> a
>> build, I get the error: SetupBuild Exception
>> This is from the twisted.log file:
>> ####
>> 2008/12/04 16:40 EST [Broker,0,192.168.103.1] <Build
>> Gen2-GCC-EMT64>.startBuild
>> 2008/12/04 16:40 EST [Broker,0,192.168.103.1] error while creating  
>> step,
>> factory=<buildbot.process.factory.BuildFactory insta
>> nce at 0x2b7b36c80d88>, args={}
>> 2008/12/04 16:40 EST [Broker,0,192.168.103.1] Build.setupBuild failed
>> 2008/12/04 16:40 EST [Broker,0,192.168.103.1] Traceback (most recent
>> call last):
>>          File
>> "/usr/lib64/python2.4/site-packages/twisted/internet/defer.py", line
>> 229, in callback
>>            self._startRunCallbacks(result)
>>          File
>> "/usr/lib64/python2.4/site-packages/twisted/internet/defer.py", line
>> 294, in _startRunCallbacks
>>            self._runCallbacks()
>>          File
>> "/usr/lib64/python2.4/site-packages/twisted/internet/defer.py", line
>> 307, in _runCallbacks
>>            self.result = callback(self.result, *args, **kw)
>>          File
>> "/usr/lib/python2.4/site-packages/buildbot/process/builder.py", line
>> 635, in _startBuild_2
>>            d = build.startBuild(bs, self.expectations, sb)
>>        --- <exception caught here> ---
>>          File
>> "/usr/lib/python2.4/site-packages/buildbot/process/base.py", line 300,
>> in startBuild
>>            self.setupBuild(expectations) # create .steps
>>          File
>> "/usr/lib/python2.4/site-packages/buildbot/process/base.py", line 351,
>> in setupBuild
>>            step = factory(**args)
>>        exceptions.AttributeError: BuildFactory instance has no  
>> __call__
>> method
>> ####
>>
>> Is my syntax for loading a factory within a factory wrong? Is there  
>> any
>> better way to set some environment variables based on what which  
>> builder
>> is called and then do some generic steps?
>>
>> Thank you,
>>
>> ------------------------------------------------------------------------------
>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,  
>> Nevada.
>> The future of the web can't happen without you.  Join us at MIX09 to  
>> help
>> pave the way to the Next Web now. Learn more and register at
>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>> _______________________________________________
>> Buildbot-devel mailing list
>> Buildbot-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/buildbot-devel

-- 
Jonathan Perkins
http://www.cse.ohio-state.edu/~perkinjo




More information about the devel mailing list