[Buildbot-devel] Create collection of build steps

Mateusz Loskot mateusz at loskot.net
Fri Sep 29 22:21:08 UTC 2006


Brian Warner wrote:
> Mateusz Loskot <mateusz at loskot.net> writes:
>> I'd like to create collection of common steps used by number of build
>> factories. Here is how I'm trying to do it:
>>
>> commonSteps["cvs"] = s(step.CVS,
>>         name="cvs",
>>         cvsroot = myRoot,
>>         cvsmodule = myModule,
>>         mode="update")
>>
>> f1 = factory.BuildFactory
>> f1.addStep(commonSteps["cvs"])
> 
> That old 's' function is creating tuples and dict-ifying the arguments in the
> same way that f.addStep does, so you need to use one or the other. Using both
> won't work.

Brian,

Thank you for this clarification.
I just misunderstood how s() works internally, now it's clear.

> I suppose we could change addStep() to recognize the (class,args) tuple
> produced by s().. 

This could help to do something like this:

step1 = s(...)
step2 = s(...)

f1.addStep(s1)
f1.addStep(s2)
...
f2.addStep(s2)  # <--- (sic!)
f2.addStep(s1)

without passing the same definition of step twice, separately
for each factory.

> I've certainly had cases where it was convenient to use s()
> to create a step description (generally a source-checkout step) and pass it
> around. In those cases I've usually done something silly like:
> 
>     def createAFactory(source):
>         f = factory.BuildFactory()
>         f.addStep(source[0], **source[1])
>         f.addStep(etc)

What about this factory creator taking list of steps and
calling f.addStep in loop to add steps from the list.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net




More information about the devel mailing list