# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem              1.0
PortGroup               python 1.0

name                    buildbot
version                 0.8.12
revision                7
categories              devel python
platforms               darwin
supported_archs         noarch
license                 GPL-2
maintainers             ryandesign openmaintainer

description             compile/test cycle automation system

long_description        The BuildBot is a system to automate the compile/test \
                        cycle required by most software projects to validate \
                        code changes.

homepage                http://buildbot.net/
master_sites            https://pypi.python.org/packages/source/b/buildbot/
dist_subdir             ${name}

checksums               md5     c61fa219942f8a1ed43cdbc1e4ef0187 \
                        rmd160  3ec4f77befce8993c0ddca4416a494201be52fa5 \
                        sha256  c6b66976dff712268566574d57131ec15e5682f6d4390cd5c8559bab0980c4d6

python.default_version  27

depends_lib-append      port:py${python.version}-dateutil \
                        port:py${python.version}-jinja2 \
                        port:py${python.version}-sqlalchemy \
                        port:py${python.version}-sqlalchemy-migrate \
                        port:py${python.version}-twisted

patchfiles-append       patch-allowRecent_SQA_Migrate.diff \
                        patch-buildbot-status-web-console.py.diff \
                        patch-buildbot-status-web-grid.py.diff \
                        patch-buildbot-status-web-waterfall.py.diff \
                        patch-buildbot-steps-trigger.py.diff

build.env               NO_INSTALL_REQS=1

set sharedir            ${prefix}/share/${subport}
set docdir              ${prefix}/share/doc/${subport}
set plistfile           org.macports.buildmaster.template.plist

post-extract {
    file mkdir ${worksrcpath}/macports
    copy ${filespath}/${plistfile} ${worksrcpath}/macports/${plistfile}
}

post-patch {
    reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/${plistfile}
}

post-destroot {
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} README COPYING CREDITS NEWS UPGRADING \
        ${destroot}${docdir}
    xinstall -d ${destroot}${sharedir}
    xinstall -m 755 ${worksrcpath}/macports/${plistfile} \
        ${destroot}${sharedir}
}

# note some tests need py-mock
#depends_test            port:py${python.version}-mock
test.run                yes
test.env                PYTHONPATH=.
test.cmd                ${prefix}/bin/trial-${python.branch}
test.target             buildbot.test

livecheck.type          regex
livecheck.url           https://pypi.python.org/pypi/${name}/
livecheck.regex         {buildbot\/(\d+\.\d+(?:\.\d+))\"}
#livecheck.regex        {buildbot\/(\d+\.\d+(?:\.\d+)(?:b\d))}

notes "
An example launchd plist file is available in ${sharedir}. After you have\
created your build master, edit the UserName and WorkingDirectory fields to\
appropriate values. As the root user, copy it to /Library/LaunchDaemons and\
instruct launchd to run it with:

sudo launchctl load -w /Library/LaunchDaemons/your.plist.name
"