Sunday, 13 May 2012

Buildbot and mutliple SVN projects

So as you all know by now I have been using buildbot to compile and upload code to my arduino.

This took so work as my SVN repo is laed out as follows;
SVN / Project 1 / branches
                / tags
                / trunk
    / Project 2 / branches
                / tags
                / trunk
 
So 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))

Saturday, 28 April 2012

Globelock SVN is now working correctly

So I plan on using my Galaxy Tab to do the code development on for the Arduino code.
I located a a nice little utility called Anjedi.It allows for checkout, editing and commit back.

I found that it did not support the way I had setup Apache + SVN on the server.
Found a few changes and now it works.

If you want to place projects on the server and have write access I can set it up under this configuration :)

Sunday, 22 April 2012

More Arduino X10 work

So I have now made an subversion repository available for the X10 work I have been doing as I am looking forward to returning to development and extending the libraries that it uses. Access is via the following url (hosted on EC2 servers) and all feedback is welcomed.

https://globelock.dyndns.info/svn/arduino/

Any changes can be posted back as a comment to the blog and I will incorporate them for you :)