# -*- 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/base-cli-plugin 0.3.0 v
# Delete this on next update to use golang PortGroup's default ('archive')
github.tarball_from tarball
revision            0
name                docker-base-plugin
categories          devel
platforms           darwin
license             Apache-2
maintainers         {danchr @danchr} \
                    openmaintainer
description         Experimental Docker CLI plugin to detect base images
long_description    {*}{
    Experimental Docker CLI plugin to detect base images of local or
    remote container images. The 'docker base detect' command shows the
    following data about detected base images:\n

    * Image name and tags\n
    * Image digest\n
    * Image vulnerabilities\n
    * Age of image\n
    * Link to the commit or Dockerfile from which the image was
      created\n
    * 'Docker Official Image', 'Verified Publisher' or 'Sponsored OSS'
      - if the image is trusted content; either from Docker Official
      Images, Verified Publishers or Sponsored OSS\n
    * 'unsupported tag' - if the tag in use is not supported any
      longer (only for Docker Official Images)\n
    * 'tag moved' - if the tag in use has moved in the meantime; a new
      image was pushed using the same tag\n
}

checksums           rmd160  3b58986ac2f3f010ff692cdea85df1dc698fc753 \
                    sha256  36584680494b2c6ece18be1cc1ba31fc0264f95884a9d4393976ddf715433684 \
                    size    556120

go.offline_build    no

build.target         -o ${name} .

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-base
}

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