# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=binwalk
pkgver=2.4.3
pkgrel=0
pkgdesc="Fast, easy to use tool for analyzing and extracting firmware images"
url="https://github.com/OSPG/binwalk/"
arch="noarch"
license="MIT"
depends="py3-pycryptodome python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/OSPG/binwalk/archive/refs/tags/v$pkgver.tar.gz"

# secfixes:
#   2.3.4-r0:
#     - CVE-2022-4510

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
521c6af602ceda22ed55cb532f1831813953a517c5059bbd6defe77a10a2ef44b22916f73f25212ef2c6cb7a3b8bb3ff9357eb4ef45dc766290e9946004b8698  binwalk-2.4.3.tar.gz
"
