# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=emacs-repology
pkgver=1.2.4
_gitrev=a6b41709525e60bdac807f153a3199003ee9d50f
pkgrel=0
_pkgreal=repology
pkgdesc="Repology API access via Elisp"
url="https://elpa.gnu.org/packages/repology.html"
arch="noarch"
license="GPL-3.0-or-later"
depends="cmd:emacs"
makedepends="emacs-nox"
source="https://github.com/emacsmirror/repology/archive/$_gitrev/emacs-repology-$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$_gitrev"

prepare() {
	default_prepare

	mkdir -v test
	mv -v repology-tests.el test/
}

build() {
	emacs -batch -q -no-site-file -L . \
		-f batch-byte-compile \
		./*.el
}

check() {
	emacs -batch -q -no-site-file -L . -L test \
		-l repology-tests -f ert-run-tests-batch-and-exit
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal/

	cd "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
af23239b50859385c1692f4a05d885cba775672cbdd45582232ab3c155b8799f086586e15b6cc606635115283aa5675267016436a7bbf442b52e45f6aa571d40  emacs-repology-1.2.4.tar.gz
"
