[Buildbot-devel] How to modify an existing factory?

Mark A. Grondona mgrondona at llnl.gov
Fri Dec 12 21:20:41 UTC 2008

I'm not sure if this will help you, but
I have a bunch of factories that are very similar as well, and
I create them in master.cfg with a loop like:

for release in releases:
    for arch in arches:
        name = release + '-' + arch
        b = { 'name':       name,
              'builddir':   name,
              'slavenames': slaves,
              'factory':    CHAOSFactory (release, arch)
    c['builders'].append (b)

Where CHAOSFactory() is just a function that returns a factory
instance that is specific for release, arch, e.g.

def CHAOSFactory(release, arch):
    if release == 'test':
       release = 'testing'
    url = chaosURL + release
    if release == 'deb':
       url = lclocalURL
    f = factory.BuildFactory ()
    f.addStep (SVNstatic, mode='update', svnurl=url, timeout=120)
    f.addStep (CHAOSBuilder, release=release, arch=arch, timeout=6000)
    f.addStep (ResultsUpload, arch=arch)
    return f

Now this might not be optimal, because I don't really know python, 
but it did allow me to create a bunch of similar factories.

I hope that with generic properties in 0.7.9, I can simplify this
so that I need only one Factory.


> Hi all,
> I was wondering if anyone knew of an easy way to modify an existing
> factory, or step instance?
> I have several factories that are just slightly different from one
> another (e.g., one is a "release" factory, another is a "debug"
> factory, another builds a special branch, etc...). I also tend to have
> a lot of steps in a factory (I find it helpful). Rather than copy
> pasting the steps and making a minor edit, I was hoping there would be
> a way I could tweak step/factory creation.
> At first I was thinking that what I could do was create a list of all
> the steps, and then modify the list, but then I realized the list is
> filled with step instances and not strings, which makes it a little
> trickier if I want to search and replace a string in that list.
> For example:
> -------------------
> releaseLinux32_workdir = 'foo'
> branchLinux32_workdir = 'bar'
> linux_release_steps = [
> # Clean all files
>         ShellCommand(
>                 workdir=releaseLinux32_workdir,
>                 name='Cleaning All Targets',
>                 description='Cleaning All Targets',
>                 descriptionDone='Cleaned All Targets',
>                 env={'ENV_VAR' : 'releaseLinux32_workdir'}
>                 command=['clean'])]
> # I want to use all the same steps in linux_release_steps,
> # but change the references to releaseLinux32_workdir to branchLinux32_workdi
> r
> # I might also want to change other settings.
> #linux_branch_steps =
> linux_release_steps.replace('releaseLinux32_workdir',
> 'branchLinux32_workdir')
> --------------------
> I guess what I really want is a macro, and am not sure how to go about
> that in python. Does anyone have a different solution?
> Thanks,
> Mark MacVicar
> -----------------------------------------------------------------------------
> -
> 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

More information about the devel mailing list