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

go.setup            github.com/docker/index-cli-plugin 0.0.35 v
# Delete this on next update to use golang PortGroup's default ('archive')
github.tarball_from tarball
revision            0
name                docker-index-plugin
categories          devel
platforms           darwin
license             Apache-2
maintainers         {danchr @danchr} \
                    openmaintainer
description         Docker CLI plugin for indexing images
long_description    {*}{
    Docker CLI tool to create image SBOMs as well as analyze packages
    for known vulnerabilities using the Atomist data plane.
}

checksums           ${distname}${extract.suffix} \
                    rmd160  2cd0771e2af18af97bc39edafe42d698be1a5851 \
                    sha256  cf354ed55beab75af2c6edd531327a209bd2eb1ac46712325d5b8054d5b985e6 \
                    size    149637

go.offline_build    no

build.target         -o ${name} ./cmd/docker-index

depends_run         port:docker

post-patch {
    reinplace "/version *=/s/\"\[^\"]*\"/\"${go.version}\"/" \
        ${worksrcpath}/internal/version.go
    reinplace "/commit *=/s/\"\[^\"]*\"/\"MacPorts ${version}_${revision}${portvariants}\"/" \
        ${worksrcpath}/internal/version.go
}

destroot {
    xinstall -d ${destroot}${prefix}/libexec/docker/cli-plugins
    xinstall -m 755 ${worksrcpath}/${name} ${destroot}${prefix}/libexec/docker/cli-plugins/docker-index
}

github.livecheck.regex  {([^"r]+)}
