[Buildbot-devel] Dynamic list of logfiles

Bill Baker bbb at illinois.edu
Mon Feb 16 20:08:04 UTC 2009


I have half of that -- the slave automatically posts files to an external
web server, and the BuildStep notices in stdio and adds a link.  Straight
from master.cfg:

class LogFileShellCommand(ShellCommand):
    log_files = []
    log_files.append("config.log")
    log_files.append("build.log")

    def __init__(self, **kwargs):
        # And upcall to let the base class do its work
        ShellCommand.__init__(self, **kwargs)

    def createSummary(self, log):
        for line in log.getText().split("\n"):
            for log_file in self.log_files:
                # line format is "    log file build.log saved to http://
..."
                if (line.startswith("log file ") and line.find(" saved to ")
>= 0):
                    split = line.split(" saved to ", 1)
                    self.addURL(split[0].split("log file ")[1], split[1])

It's barely functional enough to work -- you can probably see easy ways to
make it more systematic; I think the tricky part is saving the log files --
that requires some logic on the slave side, one way or another.

On Mon, Feb 16, 2009 at 1:35 PM, Greg Ward
<gerg.ward+buildbot at gmail.com<gerg.ward%2Bbuildbot at gmail.com>
> wrote:

> Hi all --
>
> I have a ShellCommand that creates log files based on what it finds in
> its build tree.  Specifically, it's a wrapper around "rpmbuild" that
> processes <dir>/*.spec, creating one log for each .spec file
> processed.
>
> Currently, I have cobbled something together where I use a SetProperty
> step to look for the same list of *.spec files and derive the log
> filenames from that.  That's a bit gross because I'm repeating two
> bits of logic (find *.spec and transmute foo.spec to foo.log) in two
> places (the script being run and master.cfg).
>
> It has occurred to me that a ShellCommand that dynamically discovers
> log files would be really cool.  I think I want something like this:
>
>  ShellCommand(name="build-rpms",
>               command=["./buildrpms",
>                        "--spec-dir", "spec",
>                        "--log-dir", "log"],
>               logfilepattern="log/buildrpms.*.log")
>
> Then, as my buildrpms script is running, SlaveShellCommand (I think)
> would periodically look for files matching my logfilepattern and
> update the step's log files accordingly.
>
> Does this sound crazy?  Has anyone attempted this?  Is it possible
> to do entirely within master.cfg, or would I need to patch slave-side
> code?
>
> Thanks --
>
>       Greg
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20090216/3e2ec267/attachment.html>


More information about the devel mailing list