This took so work as my SVN repo is laed out as follows;
SVN / Project 1 / branches / tags / trunk / Project 2 / branches / tags / trunkSo how do you make buildbot "see" the change in a project and compile just that project? You use a file splitter.
In the master.cfg you place a file splitter like the following one
########## Custom file spliter def my_file_splitter(path): print "path " + path pieces = path.split('/') if pieces[0] == 'trunk': branch = None pieces.pop(0) # remove 'trunk' elif pieces[0] == 'branches': pieces.pop(0) # remove 'branches' # grab branch name branch = None projectname = None return elif pieces[0] == 'RETIRED': branch = None projectname = None return else: branch = pieces.pop(0) projectname = pieces.pop(0) print branch print projectname return (branch, '/'.join(pieces))This splits the path to find where the change is and ignores any change but trunk.
This splitter is called by the Poller on the repo like like the following
SVNPoller( "svn://localhost/data/svn/arduino/" , cachepath="/tmp/arduino" , pollinterval=30 , split_file=my_file_splitter )Once this is all time it time to setup the build factory to use the properties of the splitter.
arduino = BuildFactory() arduino.addStep(ShellCommand(command=["pwd"],workdir= WithProperties("build/%s", 'branch'), usePTY=True)) arduino.addStep(ShellCommand(command=["rm","-fr",WithProperties("%s*", 'branch')],workdir="build/",usePTY=True)) arduino.addStep(ShellCommand(command=["svn", "co", WithProperties("svn://localhost/data/svn/arduino/%s" ,'branch') , Property('branch')],workdir="build/",usePTY=True)) arduino.addStep(ShellCommand(command=["pwd"],workdir= WithProperties("build/%s", 'branch'), usePTY=True)) arduino.addStep(ShellCommand(command=["ls", "-l"],workdir= WithProperties("build/%s", 'branch'),usePTY=True)) arduino.addStep(ShellCommand(command=["trunk/build.sh"],workdir= WithProperties("build/%s", 'branch'), usePTY=True))
No comments:
Post a Comment