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

Mark MacVicar mark.macvicar at gmail.com
Fri Dec 12 21:08:54 UTC 2008


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_workdir
# 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




More information about the devel mailing list