# Contributor: Oliver Smith <ollieparanoid@postmarketos.org>
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
pkgname=mrhlpr
pkgver=1.7.3
pkgrel=0
pkgdesc="postmarketOS tools for interacting with gitlab MRs"
url="https://gitlab.postmarketos.org/postmarketOS/mrhlpr"
arch="noarch"
license="GPL-3.0-or-later"
depends="python3 git mrhlpr-common"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="pytest"
source="$pkgname-$pkgver.tar.gz::https://gitlab.postmarketos.org/postmarketos/mrhlpr/-/archive/$pkgver/mrhlpr-$pkgver.tar.gz"
options="!check" # no testsuite
subpackages="mrhlpr-common mrtest"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	install -Dm755 "$builddir"/mrtest/mrtest_nag.sh \
		-t "$pkgdir"/etc/apk/commit_hooks.d/
}

common() {
	depends="python3"
	amove usr/lib/python3*/site-packages/mrhlpr*
}

mrtest() {
	pkgdesc="Installs apks from pmaports/aports MRs"
	url="https://wiki.postmarketos.org/wiki/Mrtest"
	depends="mrhlpr-common=$pkgver-r$pkgrel"
	amove \
		usr/lib/python3*/site-packages/mrtest \
		usr/bin/mrtest \
		etc/apk/commit_hooks.d/mrtest_nag.sh
}

sha512sums="
013e8e079063efcf10e975b9cd8f34d547cc531af3b9086612905e3fdfc307e5aaed7542d35fae475ed2472d9d823adf7f882a0d59d0691d545d182e72aa4567  mrhlpr-1.7.3.tar.gz
"
