[Buildbot-devel] split_file

Ian Peters-Campbell mahatmamanic at gmail.com
Fri Feb 27 00:20:27 UTC 2009


Hey all,

I am about a day and a half from being done with quite the glorious buildbot
installation, and I realized that I had not properly grokked the SVNPoller
split_file.  After reading through the example, I went to write a split file
function, and either I came up with something that is (I think) simpler than
the examples, or alternatively I am way off base with my understanding of
how it works.  If the former then maybe this can help others, and if the
latter maybe others can help me :)

Here is what I wrote for the file splitter:

branches = []

def fileSplitter(path):
    """\
    Returns the branch/file tuples necessary for the poller/schedulers to
    kick off the correct scheduled builds
    """
    for branch in branches:
        if path.startswith(branch):
            return (branch, path.split(branch)[1])

    return None

fileSplitter is then passed as the split_file of the SVNPoller when it is
created.


Then, each time I build a scheduler, I do something like:


scheduler = Scheduler(projectName, branch, stableTimer, builderNames)
branches.append(branch)

Now each time a change is made fileSplitter should look through the list of
branches that apply to my specific projects, and return the proper tuple if
the change occurred in one of them.  If the change occurred outside one of
the project locations I specifically care about, then it is ignored.

Does my aproach here make sense, or am I missing something?  If this follows
it seems like an easier way to parse branch names than splitting and
reforming the strings.

Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20090226/aa88516e/attachment.html>


More information about the devel mailing list