[Buildbot-devel] custom checkout command run in shell

Benoit Sigoure tsuna at lrde.epita.fr
Mon Nov 27 07:58:18 UTC 2006

Quoting Brian Warner <warner-buildbot at lothar.com>:
> f at rtfs.org writes:
>>> f1.source = s(step.ShellCommand, command=[ r'C:\Python24\pyton.exe'
>>>                                          , C:\clearcase_checkout.py
>>>                                          , WithProperties("%s",
>>> "revision")
>>>                                          ])
>> But I still have some trouble. I force the builds by running the command:
>>         cmd = "buildbot sendchange --master="+change['master']+"
>> Which works great, and the log says that the revision is set.
>> But still I only get the empty string for the WithProperties("%s",
>> "revision")
>> ind the shell command.
>> Any ideas how I can get the revision string?
> The problem here is that it turns out that the 'revision' property is only
> set when you force a build of a specific revision. If the build is triggered
> because of changes, it doesn't get set. The reason for this is that there
> could be multiple Changes that go into a build: the source-checkout step
> (like source.CVS or source.SVN) is responsible for using all of the Changes
> (and the revision numbers inside them) to decide what revision to use for the
> checkout. This keeps all the per-VC information isolated to the
> source-checkout step, but it also means that you can't use the "revision"
> property the way you want to.
> There is another property, the "got_revision" property, which is set to
> whatever revision was obtained by the source-checkout step, regardless of
> whether the build occurred because of Changes or because someone forced a
> build. But this won't help your situation either, because you don't have a
> source-checkout step to provide it.

Ah OK I get it now. I think you should explicitely state this under
because it's
rather confusing and got_revision isn't *that* explicit :P

> I'd suggest creating a ShellCommand subclass that looks at the list of
> Changes that went into the build and modifies the command you're running
> accordingly. Something roughly like this:
> class MyCheckout(ShellCommand):
>    def start(self):
>        ss = self.build.getSourceStamp()
>        if s.revision:
>            revision = s.revision
>        elif s.changes:
>            revision = figureOutWhatRevisionToUse(s.changes)
>        self.command = [ r'C:\Python24\python.exe',
>                         r'C:\clearcase_checkout.py',
>                         revision ]
>        ShellCommand.start(self)
> hope that helps,
> -Brian

By the way, what's the best place to put the Python extensions we write 
for the
buildbot? In the same directory as master.cfg? Where buildbot is installed?


SIGOURE Benoit aka Tsuna
  /EPITA\ Promo 2008, LRDE

More information about the devel mailing list