[Buildbot-devel] Modifying shell commands at runtime

Tommy Kudirka tkdeaddovedonoteat at live.com
Fri Jul 10 17:15:34 UTC 2009


> I found a 'doStepIf' parameter for buildsteps in the source code, which would be much better for what I'm trying to do, but it doesn't seem to be working right.
More details on my problem: I'm using a 'bothBuildsReady' function that takes an argument from the builder that says which build is finished. It checks the local file to see if the other build is finished or not. If it is, the local file is emptied and the function returns True. If the other build is not done, the function writes which build is done to the local file and returns False:
def bothBuildsReady(oneOrTwo):    fr = open('C:\\test.txt', 'r')    fr.seek(0)    if fr.readline() == 'one':        if oneOrTwo == 'one':            fr.close()            return False        elif oneOrTwo == 'two':            fr.close()            fw = open('C:\\test.txt', 'w')  # opening a file in 'write' mode clears it            fw.close()            return True    fr.seek(0)    if fr.readline() == 'two':        if oneOrTwo == 'one':            fr.close()            fw = open('C:\\test.txt', 'w')            fw.close()            return True        elif oneOrTwo == 'two':            fr.close()            return False    else:        fr.close()        fw = open('C:\\test.txt', 'w')        fw.seek(0)        fw.write(str(oneOrTwo))        return False

I assign that function to a 'doStepIf' parameter for the buildsteps that call the .bat that submits the new builds. On one of the builders the submit buildstep is always skipped and on the other the buildstep is always run. Even if I swap the arguments given to bothBuildsReady(), the buildsteps follow that same pattern. My master.cfg looks like this:
...fReleaseOne.addStep(ShellCommand(command=['call', 'C:/bothBuildsReady.bat'],  #this .bat submits the new builds                                 description='check-in',                                 descriptionDone='check-in',                                flunkOnFailure=False,                    doStepIf=bothBuildsReady('one')), useProgress=False)    #always skips...fReleaseTwo.addStep(ShellCommand(command=['call', 'C:/bothBuildsReady.bat'],                                 description='check-in',                                 descriptionDone='check-in',                                 flunkOnFailure=False,                    doStepIf=bothBuildsReady('two')),useProgress=False)    #always runs...
What am I doing wrong? I just found out doStepIf is new for 0.7.11 (I'm using 0.7.11-RC2, which fixes an IRC bug I had) so maybe that has something do do with it?
Thanks,Tommy
_________________________________________________________________
Windows Live™: Keep your life in sync. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_BR_life_in_synch_062009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20090710/84304465/attachment.html>


More information about the devel mailing list