# -*- 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

PortSystem          1.0
PortGroup           python 1.0

name                stgit
version             0.17.1
categories          devel python
license             GPL-3
platforms           darwin
maintainers         nomaintainer
supported_archs     noarch

description         Push/pop utility on top of GIT
long_description    StGIT is a Python application providing similar \
                    functionality to Quilt (i.e. pushing/popping patches \
                    to/from a stack) on top of GIT. These operations are \
                    performed using GIT commands and the patches are stored \
                    as GIT commit objects, allowing easy merging of the StGIT \
                    patches into other repositories using standard GIT \
                    functionality. \
                    Note that StGIT is not an SCM interface on top of GIT and \
                    it expects a previously initialised GIT repository \
                    (unless it is cloned using StGIT directly). For standard \
                    SCM operations, either use plain GIT commands or the \
                    Cogito tool but it is not recommended to mix them with \
                    the StGIT commands.

homepage            http://procode.org/stgit/
master_sites        http://repo.or.cz/stgit.git/snapshot/

checksums           rmd160  60261f23324c1bb6c5165cc23a9280850ef23c34 \
                    sha256  467e2271fb48d73733aa756ed68e53525bce7c4d52a12901f3fca310ba17e310

distname            48e5cef14cea5c810833d119900cd484c2a6ca85
worksrcdir          stgit-48e5cef

depends_run         port:git

python.default_version  27

patch.pre_args      -p1

patchfiles          gerrit-integration.diff \
                    template.diff

post-patch {
    reinplace "s|@@PREFIX@@|${prefix}|g"  ${worksrcpath}/stgit/templates.py
}

set stgdocs         "${worksrcpath}/Documentation/\[a-z\]*.txt"
set stgman          ""

post-build {
    system -W ${worksrcpath} "PYTHON=${prefix}/bin/python2.7 make all"
}

post-destroot {
    move ${destroot}${python.prefix}/share/stgit/ \
        ${destroot}${prefix}/share/

    # Install what little documentation there is
    xinstall -m 644 -W ${worksrcpath} COPYING README \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 {*}[glob ${stgdocs}] \
        ${destroot}${prefix}/share/doc/${name}
    if {${stgman} != ""} {
        xinstall -m 644 {*}[glob ${stgman}] \
            ${destroot}${prefix}/share/man/man1
    }
}

variant html_man_docs \
    description {Build and install documentation in HTML and manpage format} {
    # Need to add post-destroot addition of extra docs...
    lappend stgdocs ${worksrcpath}/Documentation/*.html
    lappend stgman ${worksrcpath}/Documentation/*.1
    depends_build-append    port:asciidoc port:xmlto
    post-build {
        system -W ${worksrcpath} "PYTHON=${prefix}/bin/python2.7 make all doc"
    }
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     "${name}-(\\d+\\.\\d+\\.\\d+)"