[Buildbot-devel] Custom functions in master.cfg

Christoph Spielmann christoph.spielmann at machineering.de
Mon Jul 23 07:09:04 UTC 2012


Hi,

In my configuration i defined the following function to create a string 
in the form "0_Sunday",..., "6_Saturday":

from datetime import date
import locale

def createUploadTargetDirectory():
      locale.setlocale(locale.LC_ALL,'de_DE')
      d=date.today()
      return "{0}_{1}".format(((d.weekday()+1)%7),d.strftime("%A"))

I use this function in one of my buildsteps like this:

factory.addStep(DirectoryUpload(slavesrc="..\\dist\\setup",masterdest="/bla/{0}".format(createUploadTargetDirectory())))

if i type the function into the python-commandline it works as expected 
but buildbot somehow seems to always get the date from the master when 
it was restarted the last time (i assume thats when the master.cfg is 
actually loaded...)

In my twisted.log i have the following entries:

2012-07-20 15:40:57+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Friday'
2012-07-20 15:41:07+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x3bf8c20>): []
2012-07-20 16:25:49+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Freitag'
2012-07-20 16:25:56+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x29fa1b8>): []
2012-07-20 17:06:59+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Freitag'
2012-07-20 17:07:09+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x2aa0908>): []
2012-07-21 01:43:51+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Freitag'
2012-07-21 01:44:00+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x2aa9a70>): []
2012-07-21 02:22:05+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Freitag'
2012-07-21 02:22:17+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x2ab3950>): []
2012-07-22 01:43:43+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Freitag'
2012-07-22 01:43:52+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x2abb5a8>): []
2012-07-22 02:21:45+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Freitag'
2012-07-22 02:21:54+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x2abb050>): []
2012-07-23 01:43:54+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Freitag'
2012-07-23 01:44:06+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x2ccaf80>): []
2012-07-23 02:22:00+0200 [-] DirectoryUpload started, from slave 
'..\\dist\\setup' to master '/bla/5_Freitag'
2012-07-23 02:22:11+0200 [-] 
releaseLocks(<buildbot.steps.transfer.DirectoryUpload instance at 
0x2a9bb90>): []

My question is now: Is possible to achieve what i'm trying to do using 
the method i used above, or do i need to implement my own BuildStep?

Thanks in advance,

Christoph

-- 
--------------------------------------------
Dipl.-Ing. Christoph Spielmann

machineering GmbH & Co. KG
Simulation und Automatisierung
Pfrontener Platz 25a
80686 München

Tel: + 49 (0) 89 54 72 69 - 28
Mail:  christoph.spielmann at machineering.de
Web: www.machineering.de

--------------------------------------------

machineering GmbH & Co. KG, HRA 94550, Amtsgericht München
machineering Verwaltungs-GmbH, HRB 181877, Amtsgericht München
Ust-IdNr.: DE268988178
Geschäftsführung: B.Freyer

--------------------------------------------





More information about the devel mailing list