[Buildbot-devel] how to get buildbot to build an old (i.e. tagged) version?

Brian Warner warner at lothar.com
Fri Jan 16 21:43:39 UTC 2004

> Instead I'll try subclassing ConfigurableBuildFactory. I'll start with
> a question: where should I add my code?
> I unpacked buildbot in a subdir, and when I did the python install, I
> noticed that it copies all the code to a subdirectory in the machine's
> python tree. I had to be su to do that, but of course I don't want to
> be su to add python code.

No special privileges necessary. The way I usually do it is to create a
~/lib/python directory . When you install a package (using 'python setup.py
install'), you can tell distutils to install it into somewhere other than the
default /usr/lib/ . I use 'setup.py install --home ~', which installs the
library files into ~/lib/python (or ~/lib/python2.3, I forget which), any
executable scripts into ~/bin, etc. Then I add ~/lib/python to my PYTHONPATH
and everything is picked up from there.

You can also do 'setup.py install --prefix=/usr/local', to install things to
/usr/local/lib/python2.3 (which is frequently on the built-in sys.path).
Whenever I install code that might be used by multiple people (at least
anything that isn't already packaged in debian, which is pretty rare these
days), I install it to /usr/local . I have a separate user account named
'tools' just for owning /usr/local, so I use 'sudo -u tools make install' or
whatever. Root is not involved, but neither can regular users write to
anything in /usr/local . Works well for me.

You can put your subclasses anywhere on your PYTHONPATH. You could even put
them in a file in the current directory and then start twistd like:

 PYTHONPATH=. twistd -f foo.tap

For the Twisted buildmaster I created a directory called support-master/, and
added it to the PYTHONPATH on the buildmaster-launching twistd invocation. I
put the "private.py" file in there, and it makes a convenient place to add
symlinks (like to twisted/) for making the buildmaster use a different
version of some other package than whatever's installed in /usr/lib .

Then you can create a file like "myfactory.py" and put your subclasses in it:

  from buildbot.process.base import ConfigurableBuildFactory, CVS, \
    Configure, Compile, Test, ShellCommand
  class MyBuildFactory(ConfigurableBuildFactory):
      def __init__(...)

You'll need to cut-and-paste the __init__ method, then edit it to change the
CVS step into a corresponding ShellCommand. (Not exactly the most robust
solution, but ConfigurableBuildFactory isn't designed in a way that would let
you do anything better).

Then, as long as the directory containing myfactory.py is on the
buildmaster's PYTHONPATH, your master.cfg file can do:

 from myfactory import MyBuildFactory

 f = MyBuildFactory(repository, ...)
 c['builders'].append(("name", "slavename", "bdir", f))

to pick up the new subclass.


More information about the devel mailing list