[Buildbot-devel] Perforce (P4) commit trigger

Scott Lamb slamb at slamb.org
Sat Sep 2 06:50:10 UTC 2006


On 31 Aug 2006, at 01:50, Tony Walker wrote:
> Hi,
>
> I have a buildmaster with several buildslaves. Our Perforce repository
> resides on a separate machine on our network. What I would like to  
> know
> is how do I trigger a build on one of the slaves after a piece of code
> has been checked in to perforce on a particular branch. Has anyone  
> done
> this before? We use triggers quite a lot in perforce, for example, we
> have a script that emails changes to staff. So, how do I issue a  
> command
> to the buildmaster (that resides on a different machine) to start a
> build after there has been a commit?

p4poller works and is unit tested. On the other hand, if you're set  
on triggers instead of polling, you should be able to extract half of  
p4poller.P4Source into a new P4AbstractSource base class, then wrap  
it in a change-commit trigger like:

     class P4TriggerSource(P4AbstractSource):
         def __init__(self, changeset):
             P4AbstractSource.__init__(self)
             self._get_describe(changeset)

         def _process_describe(self, result, num):
             P4AbstractSource._process_describe(self, result, num)
             reactor.stop()

     src = P4TriggerSource(self.args[1])
     reactor.run()

That's totally untested, of course.

-- 
Scott Lamb <http://www.slamb.org/>





More information about the devel mailing list