# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=umoci
pkgver=0.4.7
pkgrel=30
pkgdesc="umoci modifies Open Container images"
url="https://umo.ci/"
arch="all"
license="Apache-2.0"
makedepends="go"
options="!check" # has no check
source="umoci-$pkgver.tar.gz::https://github.com/opencontainers/umoci/archive/v$pkgver.tar.gz
	update-go-mod.patch"
builddir="$srcdir/src/github.com/opencontainers/$pkgname"

# secfixes:
#   0.4.7-r0:
#     - CVE-2021-29136

export GOPATH="$srcdir"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

prepare() {
	mkdir -p ${builddir%/*}
	mv "$srcdir"/$pkgname-$pkgver "$builddir"/
	default_prepare
	go mod vendor
}

build() {
	export GOPATH="$srcdir"
	go build -o bin/$pkgname ./cmd/$pkgname
}

package() {
	install -Dm755 bin/$pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
bb76c6c74766bc6558fa414b66a626194c60a9dee49aee050ad459590675bd79032b8e8c390439c0aa74c09abc921a6789fac57fc996ef958a376bc1c675d9fc  umoci-0.4.7.tar.gz
2ab749004692568e9f24c5d8c211993a61867158b379efa06b4f348e5fc27436dd51d86e3c1ba937b5d1a11a20935a3109953cc8b28825032b42fdaf4be669a1  update-go-mod.patch
"
