[Buildbot-devel] Access the source stamp from a shell command

Dobes Vandermeer dobesv at gmail.com
Sat Sep 17 01:30:48 UTC 2005


I'd like to be able to insert the revision that buildbot is at into
the environment of the shell commands I run, so I can sync to that
revision (it probably has other uses).  I've made it as far as adding
this code in ShellCommand:

    def start(self, errorMessage=None):
        # merge in anything from Build.slaveEnvironment . Earlier steps
        # (perhaps ones which compile libraries or sub-projects that need to
        # be referenced by later steps) can add keys to
        # self.build.slaveEnvironment to affect later steps.
        slaveEnv = self.build.slaveEnvironment
        if self.build.source.revision is not None:
            slaveEnv['BUILDBOT_SOURCE_REVISION'] =
str(self.build.source.revision)
        elif self.build.source.changes:
            slaveEnv['BUILDBOT_SOURCE_REVISION'] = str(max([c.revision
for c in self.build.source.changes]))
        slaveEnv['BUILDBOT_SOURCE_BRANCH'] = str(self.build.source.branch)
        slaveEnv['BUILDBOT_BUILD_REASON'] = str(self.build.reason)


Unfortunately, neither revision not changes is ever non-empty!

Is there another way for me to get at this information?

I'm using the buildbot in CVS, and perforce.

Thanks!




More information about the devel mailing list