# -*- 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           github 1.0
PortGroup           python 1.0

github.setup        newren git-filter-repo 2.47.0 v
github.tarball_from releases
revision            0
categories          devel
platforms           {darwin any}

maintainers         {amake @amake} openmaintainer

license             {MIT GPL-2}
checksums           rmd160  39b205433c327c693e179e570b926c8a8f56bd49 \
                    sha256  4662cbe5918196a9f1b5b3e1211a32e61cff1812419c21df4f47c5439f09e902 \
                    size    186836

description         Quickly rewrite git repository history (filter-branch replacement)
long_description \
    A versatile tool for rewriting history like git filter-branch but without \
    the capitulation-inducing poor performance, with far more capabilities, and \
    with a design that scales usability-wise beyond trivial rewriting cases. git \
    filter-repo is now recommended by the git project instead of git \
    filter-branch.

depends_build-append \
    path:libexec/coreutils/libstdbuf.so:coreutils

depends_run         port:git

use_xz              yes

python.default_version 312

test.run            yes
test.cmd            make
test.target         test
depends_test-append port:py${python.version}-coverage

pre-test {
    reinplace "s|coverage3 |coverage-${python.branch} |" t/run_coverage
}

post-extract {
    reinplace "s|#!/usr/bin/env python3|#!${python.bin}|" git-filter-repo
}

supported_archs     noarch

use_configure       no

build {}

destroot.cmd        make
destroot.target     install
destroot.destdir
destroot.args \
    prefix=${destroot}${prefix} \
    pythondir=${destroot}${python.pkgd} \
    INSTALL=${prefix}/bin/ginstall

pre-destroot {
    xinstall -d -m 0755 ${destroot}${prefix}/libexec/git-core
    xinstall -d -m 0755 ${destroot}${python.pkgd}
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/git-doc
}
