~dricottone/huttese-apk

af19a4d6d3a1035c7537a2c90c3e60eb87b414a0 — Drew DeVault 3 years ago 500fbc6
Drop obsolete & upstreamed packages
36 files changed, 0 insertions(+), 1193 deletions(-)

D sr.ht/mercurial/APKBUILD
D sr.ht/mercurial/archive_gzip.patch
D sr.ht/pgbouncer/APKBUILD
D sr.ht/pgbouncer/pgbouncer-dirs.patch
D sr.ht/pgbouncer/pgbouncer.confd
D sr.ht/pgbouncer/pgbouncer.initd
D sr.ht/pgbouncer/pgbouncer.logrotate
D sr.ht/pgbouncer/pgbouncer.pre-install
D sr.ht/prometheus-node-exporter/APKBUILD
D sr.ht/prometheus-node-exporter/prometheus-node-exporter.confd
D sr.ht/prometheus-node-exporter/prometheus-node-exporter.initd
D sr.ht/prometheus-node-exporter/prometheus-node-exporter.pre-install
D sr.ht/prometheus-sql-exporter/APKBUILD
D sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.confd
D sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.initd
D sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.pre-install
D sr.ht/prometheus-sql-exporter/sql_exporter.yml
D sr.ht/py3-alembic/APKBUILD
D sr.ht/py3-cairocffi/APKBUILD
D sr.ht/py3-cairosvg/APKBUILD
D sr.ht/py3-cssselect2/APKBUILD
D sr.ht/py3-editor/APKBUILD
D sr.ht/py3-gitlab/APKBUILD
D sr.ht/py3-httpretty/APKBUILD
D sr.ht/py3-llfuse/APKBUILD
D sr.ht/py3-passlib/APKBUILD
D sr.ht/py3-pygithub/APKBUILD
D sr.ht/py3-pytest-flake8/APKBUILD
D sr.ht/py3-pytest-isort/APKBUILD
D sr.ht/py3-qrcode/APKBUILD
D sr.ht/py3-tinycss2/APKBUILD
D sr.ht/qemu-minimal-static/90-kvm.rules
D sr.ht/qemu-minimal-static/APKBUILD
D sr.ht/qemu-minimal-static/qemu-chroot.c
D sr.ht/qemu-minimal-static/qemu-minimal-static.pre-install
D sr.ht/qemu-minimal-static/xattr_size_max.patch
D sr.ht/mercurial/APKBUILD => sr.ht/mercurial/APKBUILD +0 -69
@@ 1,69 0,0 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mercurial
pkgver=5.3.1
pkgrel=2
pkgdesc="Scalable distributed SCM tool"
url="https://www.mercurial-scm.org"
arch="all"
license="GPL-2.0-or-later"
depends="python3"
makedepends="python3-dev"
subpackages="
	$pkgname-doc
	$pkgname-vim:vim:noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-bash-completion:bashcomp:noarch
	"
source="https://www.mercurial-scm.org/release/mercurial-$pkgver.tar.gz archive_gzip.patch"

# secfixes:
#   4.9-r0:
#   - CVE-2019-3902

build() {
	HGPYTHON3=1 python3 setup.py build
}

package() {
	HGPYTHON3=1 python3 setup.py install --root="$pkgdir"
	install -m755 contrib/hgk contrib/hg-ssh hgeditor "$pkgdir"/usr/bin

	local man
	for man in doc/*.?; do
		install -Dm644 "$man" \
			"$pkgdir"/usr/share/man/man${man##*.}/${man##*/}
	done
}

vim() {
	depends=""
	pkgdesc="Vim syntax for $pkgname"
	install_if="vim $pkgname=$pkgver-r$pkgrel"

	cd "$builddir"/contrib/vim/
	mkdir -p "$subpkgdir"/usr/share/vim/vimfiles/syntax/
	install -Dm644 HGAnnotate.vim hgtest.vim \
		"$subpkgdir"/usr/share/vim/vimfiles/syntax/
}

zshcomp() {
	depends=""
	pkgdesc="Zsh completion for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	install -Dm644 "$builddir"/contrib/zsh_completion \
		"$subpkgdir"/usr/share/zsh/site-functions/_$pkgname
}

bashcomp() {
	depends=""
	pkgdesc="Bash completion for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	install -Dm644 "$builddir"/contrib/bash_completion \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

sha512sums="3bc49ea96cb4ac0e777f667a3243917af495a001534b6b91141fc93b5c47a8eddc84331e1cb0b981fac1bf451dcfc91b8c538134983733466248fdc20afd39c6  mercurial-5.3.1.tar.gz
42974b580e5dafc562fdce9728b90f882a2cfb10c3c0adbd50d41382bd6bcf3a430be6fc81c52a3baa3955677999bf4662c5e5b5bc90891ba9c862ec27c448a2  archive_gzip.patch"

D sr.ht/mercurial/archive_gzip.patch => sr.ht/mercurial/archive_gzip.patch +0 -22
@@ 1,22 0,0 @@
# HG changeset patch
# User Ludovic Chabant <ludovic@chabant.com>
# Date 1583871438 0
#      Tue Mar 10 20:17:18 2020 +0000
# Node ID 70878db5d0ede9c39128328cfa8cb6ee758d5374
# Parent  a08bbdf839ae08ff69c6f99a289ee85b3a012f03
archive: fix crash when archiving to gzip file with Python 3.8.2+

Differential Revision: https://phab.mercurial-scm.org/D8272

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -146,7 +146,7 @@
                 self.timestamp = timestamp
             gzip.GzipFile.__init__(self, *args, **kw)
 
-        def _write_gzip_header(self):
+        def _write_gzip_header(self, *args, **kwargs):
             self.fileobj.write(b'\037\213')  # magic header
             self.fileobj.write(b'\010')  # compression method
             fname = self.name

D sr.ht/pgbouncer/APKBUILD => sr.ht/pgbouncer/APKBUILD +0 -54
@@ 1,54 0,0 @@
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=pgbouncer
pkgver=1.14.0
pkgrel=3
pkgdesc="A lightweight connection pooler for PostgreSQL"
url="https://wiki.postgresql.org/wiki/PgBouncer"
arch="all"
license="BSD"
pkgusers="pgbouncer"
pkggroups="postgres"
install="$pkgname.pre-install"
makedepends="c-ares-dev libevent-dev openssl-dev udns-dev"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://pgbouncer.github.io/downloads/files/$pkgver/$pkgname-$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	$pkgname.logrotate
	pgbouncer-dirs.patch
	"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--disable-debug
	make
}

check() {
	cd "$builddir"
	./pgbouncer --version
	make -C test
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	cd "$pkgdir"
	install -m 755 -D "$srcdir"/$pkgname.initd ./etc/init.d/$pkgname
	install -m 644 -D "$srcdir"/$pkgname.confd ./etc/conf.d/$pkgname
	install -m 644 -D "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/$pkgname
	install -m 644 -D "$builddir"/etc/$pkgname.ini ./etc/$pkgname/$pkgname.ini

	install -d -m 755 -o $pkgusers -g $pkggroups ./var/log/$pkgname
}

sha512sums="506810c9896a45d67fbc97c3027572278b3857635c222cfaa53b4f3893069cfbee2ec92facd6f387de217bb3170045410b88a7cea09a45686661a2d2ccc85271  pgbouncer-1.14.0.tar.gz
104cdaedb166e8414db0543b91e19cbe931895bc975825cc979a3dd2d5e8e4b425e962b5695970c8a7fb2c0eb4205aa1900a6d67632292a19f71f4dac221f1c1  pgbouncer.initd
808621351b0f5973427fa22f63128432b00ac20fd25af437e8148dad9e55185775aba612b6ecdd58e4a6f2450b8c7838fcace288845b9b3cd0236bbe168aa574  pgbouncer.confd
83b869466b59c1b1d6e316a9368f725181128c1f5a7af230e3fa9c58ccda1bc097db182806c1c51a5121692791ec83d9eb0f5718fb3031f521bb537001153e2d  pgbouncer.logrotate
f45170465fda5190257e3f4c10e22fe7df57657efc90bdd6a3f0727375a25143e07480ecd998995cec0ddb2ed2d472f996b21e4fe712681418215823b88d0fc3  pgbouncer-dirs.patch"

D sr.ht/pgbouncer/pgbouncer-dirs.patch => sr.ht/pgbouncer/pgbouncer-dirs.patch +0 -26
@@ 1,26 0,0 @@
diff --git a/etc/pgbouncer.ini b/etc/pgbouncer.ini
index fed4a9f..f5204c2 100644
--- a/etc/pgbouncer.ini
+++ b/etc/pgbouncer.ini
@@ -43,7 +43,7 @@
 ;;;
 
 logfile = /var/log/pgbouncer/pgbouncer.log
-pidfile = /var/run/pgbouncer/pgbouncer.pid
+pidfile =
 
 ;;;
 ;;; Where to wait for clients
@@ -55,9 +55,9 @@ listen_port = 6432
 
 ;; Unix socket is also used for -R.
 ;; On Debian it should be /var/run/postgresql
-;unix_socket_dir = /tmp
-;unix_socket_mode = 0777
-;unix_socket_group =
+unix_socket_dir = /run/postgresql
+unix_socket_mode = 0777
+unix_socket_group = postgres
 
 ;;;
 ;;; TLS settings for accepting clients

D sr.ht/pgbouncer/pgbouncer.confd => sr.ht/pgbouncer/pgbouncer.confd +0 -19
@@ 1,19 0,0 @@
# Configuration file for /etc/init.d/pgbouncer

# Location of configuration file for PgBouncer.
#cfgfile="/etc/pgbouncer/pgbouncer.ini"

# The user to run PgBouncer as.
#user=pgbouncer

# The group to run PgBouncer as.
#group=postgresql

# How long to wait in seconds for a safe shutdown. Equivalent to
# issuing 'PAUSE;' and 'SHUTDOWN;' on psql console. See pgbouncer(1).
#nice_timeout=60

# Set to 'yes' to perform an immediate shutdown if the nice shutdown
# doesn't work. Same as issuing 'SHUTDOWN;' on console. See pgbouncer(1).
#force_quit=="no"
#force_quit_timeout=2

D sr.ht/pgbouncer/pgbouncer.initd => sr.ht/pgbouncer/pgbouncer.initd +0 -92
@@ 1,92 0,0 @@
#!/sbin/openrc-run

extra_started_commands="reload"

: ${user:="pgbouncer"}
: ${group:="postgres"}
: ${cfgfile:="/etc/pgbouncer/pgbouncer.ini"}
: ${nice_timeout:=60}
: ${force_quit:="no"}
: ${force_quit_timeout:=2}

name="PgBouncer"
command="/usr/bin/pgbouncer"
command_args="-q $cfgfile"
command_background="yes"

pidfile="/run/$RC_SVCNAME.pid"
start_stop_daemon_args="
	--user $user
	--group $group"

required_files="$cfgfile"

depend() {
	use net
	after postgresql
}

start_pre() {
	local socket_dir=$(get_config unix_socket_dir)
	if [ -n "$socket_dir" ]; then
		checkpath -d -m 0775 -o postgres:postgres "$socket_dir" || return 1
	fi

	local logfile="$(get_config logfile)"
	if [ -n "$logfile" ]; then
		checkpath -f -m 0640 -o $user:$group "$logfile" || return 1
	fi
}

stop() {
	local retry="SIGINT/$nice_timeout"
	yesno "$force_quit" \
		&& retry="$retry/SIGTERM/$force_quit_timeout" \
		|| force_quit_timeout=0

	local seconds=$(( $nice_timeout + $force_quit_timeout ))

	ebegin "Stopping $seconds (this can take up to $seconds seconds)"

	start-stop-daemon --stop \
		--pidfile "$pidfile" \
		--retry "$retry" \
		--progress \
		--exec "$command"
	eend $?
}

restart() {
	local socket_dir=$(get_config unix_socket_dir)

	if [ -n "$socket_dir" ]; then
		ebegin "Performing online restart of $name"
		"$command" -R "$command_args"
		eend $?
	else
		stop && start
	fi
}

reload() {
	ebegin "Reloading $name configuration"
	start-stop-daemon --signal HUP --pidfile "$pidfile"
	eend $?
}

get_config() {
	local name="$1"
	local default="${2:-}"

	if [ ! -f "$cfgfile" ]; then
		printf '%s\n' "$default"
		return 1
	fi
	sed -En "/^\s*${name}\b/{                      # find line starting with the name
		  s/^\s*${name}\s*=?\s*([^#]+).*/\1/;  # capture the value
		  s/\s*$//;                            # trim trailing whitespaces
		  s/^['\"](.*)['\"]$/\1/;              # remove delimiting quotes
		  p
		}" "$cfgfile" \
		| grep . || printf '%s\n' "$default"
}

D sr.ht/pgbouncer/pgbouncer.logrotate => sr.ht/pgbouncer/pgbouncer.logrotate +0 -7
@@ 1,7 0,0 @@
/var/log/pgbouncer/pgbouncer.log {
	missingok
	sharedscripts
	postrotate
		/etc/init.d/pgbouncer --quiet --ifstarted reload
	endscript
}

D sr.ht/pgbouncer/pgbouncer.pre-install => sr.ht/pgbouncer/pgbouncer.pre-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S postgres || true
adduser -SDH -s /sbin/nologin -G postgres -g pgbouncer pgbouncer || true

D sr.ht/prometheus-node-exporter/APKBUILD => sr.ht/prometheus-node-exporter/APKBUILD +0 -43
@@ 1,43 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=prometheus-node-exporter
pkgver=0.18.1
pkgrel=2
pkgdesc="prometheus exporter for machine metrics"
url="https://github.com/prometheus/node_exporter"
arch="all"
license="Apache-2.0"
install="prometheus-node-exporter.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/prometheus/node_exporter/archive/v$pkgver.tar.gz
	prometheus-node-exporter.initd
	prometheus-node-exporter.confd
"
subpackages="$pkgname-openrc"
builddir="$srcdir/node_exporter-$pkgver"

build() {
	cd "$builddir"
	go build
}

check() {
	cd "$builddir"
	go test
}

package() {
	cd "$builddir"
    mkdir -p "$pkgdir"/usr/bin
    mkdir -p "$pkgdir"/etc/init.d
    mkdir -p "$pkgdir"/etc/conf.d
	install -Dm755 node_exporter "$pkgdir"/usr/bin/prometheus_node_exporter
	install -Dm755 "$srcdir"/prometheus-node-exporter.initd \
		"$pkgdir"/etc/init.d/prometheus-node-exporter
	install -Dm644 "$srcdir"/prometheus-node-exporter.confd \
		"$pkgdir"/etc/conf.d/prometheus-node-exporter
}

sha512sums="cf2b854fbec1ba39b18432cdc11ab507ebc5b2828e6b34b4f49af9b949fcd365cb3e5eb1e265d0825783810c6b1572a8b3512ec27a46e5c83f89a505590159c0  prometheus-node-exporter-0.18.1.tar.gz
fe8320b47d93c9590ccf9a3456f74b90a960fd46a7561202470687de2fc5d2caebded682d2274bec71602e694b778f282d5876400da60d716ce3d3cee5e45b99  prometheus-node-exporter.initd
a19cb380e12a292af3645de18d59ebac6ce4b521281f1761d069b5d8bd574a83c92265a3a4023e372fce7ec9bab0f1849e9953cf81801fc24576acec20afb964  prometheus-node-exporter.confd"

D sr.ht/prometheus-node-exporter/prometheus-node-exporter.confd => sr.ht/prometheus-node-exporter/prometheus-node-exporter.confd +0 -4
@@ 1,4 0,0 @@
prometheus_node_exporter_web_listen_address=127.0.0.1:9100

output_log=/var/log/prometheus-node-exporter.log
error_log=/var/log/prometheus-node-exporter.log

D sr.ht/prometheus-node-exporter/prometheus-node-exporter.initd => sr.ht/prometheus-node-exporter/prometheus-node-exporter.initd +0 -13
@@ 1,13 0,0 @@
#!/sbin/openrc-run
name="prometheus-node-exporter"
description="Prometheus node monitoring daemon"
supervisor=supervise-daemon
command=/usr/bin/prometheus_node_exporter
command_args="--web.listen-address=$prometheus_node_exporter_web_listen_address"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus || true
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus || true
}

D sr.ht/prometheus-node-exporter/prometheus-node-exporter.pre-install => sr.ht/prometheus-node-exporter/prometheus-node-exporter.pre-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^prometheus:' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus:' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null

D sr.ht/prometheus-sql-exporter/APKBUILD => sr.ht/prometheus-sql-exporter/APKBUILD +0 -52
@@ 1,52 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=prometheus-sql-exporter
pkgver=0.5
pkgrel=0
pkgdesc="Database agnostic SQL exporter for Prometheus"
url="https://github.com/free/sql_exporter"
arch="all"
license="MIT"
install="prometheus-sql-exporter.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/free/sql_exporter/archive/$pkgver.tar.gz
	prometheus-sql-exporter.initd
	prometheus-sql-exporter.confd
	sql_exporter.yml
"
subpackages="$pkgname-openrc"
builddir="$srcdir/sql_exporter-$pkgver"

build() {
	go mod init github.com/free/sql_exporter
	go mod vendor
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS" \
		-tags netgo,builtinassets \
		./cmd/sql_exporter
}

check() {
	go test ./...
}

package() {
    mkdir -p "$pkgdir"/usr/bin
    mkdir -p "$pkgdir"/etc/init.d
    mkdir -p "$pkgdir"/etc/conf.d
    mkdir -p "$pkgdir"/etc/prometheus
	install -Dm755 sql_exporter "$pkgdir"/usr/bin/prometheus_sql_exporter
	install -Dm755 "$srcdir"/prometheus-sql-exporter.initd \
		"$pkgdir"/etc/init.d/prometheus-sql-exporter
	install -Dm644 "$srcdir"/prometheus-sql-exporter.confd \
		"$pkgdir"/etc/conf.d/prometheus-sql-exporter
	install -Dm644 "$srcdir"/sql_exporter.yml \
		"$pkgdir"/etc/prometheus/sql_exporter.yml
}

sha512sums="0c260bd1f6716e1b2d8fdc9be511533279eca102e7117d71c123457aeb63613804e0762f83e6231cad94b31a63d07ad29c56d96dbeae07a3f07f1a2d28d6d7c9  prometheus-sql-exporter-0.5.tar.gz
b4c7e2229777e46fad3f30f342fd13cf3c2628a3845bc89fb8d4df9f1e058533c7344a053e5ca581edc065bdc59fed88d57787d8e2bcf9fe1b8741b2394e66a2  prometheus-sql-exporter.initd
a7d40104e925be144f9dd36e59659b0bdc1577cd433adc31a4d971fc1486c62f8485cd7b1b2d169ab01ab9e8252d89bdad70fa5a73e17b5db47b0c62f9dffe8f  prometheus-sql-exporter.confd
981b612fda17d10ded35b072eec627be429900128225f464c81bb253a73bf1f024afbff5ef138e4130163819d35874d1e80c3fffd781709bb75eb8cb7f8362de  sql_exporter.yml"

D sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.confd => sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.confd +0 -5
@@ 1,5 0,0 @@
prometheus_sql_exporter_web_listen_address=127.0.0.1:9399
prometheus_sql_exporter_config_file=/etc/prometheus/sql_exporter.yml

output_log=/var/log/prometheus-sql-exporter.log
error_log=/var/log/prometheus-sql-exporter.log

D sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.initd => sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.initd +0 -14
@@ 1,14 0,0 @@
#!/sbin/openrc-run
name="prometheus-sql-exporter"
description="Prometheus SQL monitoring daemon"
supervisor=supervise-daemon
command=/usr/bin/prometheus_sql_exporter
command_args="--web.listen-address=$prometheus_sql_exporter_web_listen_address \
	--config.file=$prometheus_sql_exporter_config_file"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus || true
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus || true
}

D sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.pre-install => sr.ht/prometheus-sql-exporter/prometheus-sql-exporter.pre-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^prometheus:' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus:' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null

D sr.ht/prometheus-sql-exporter/sql_exporter.yml => sr.ht/prometheus-sql-exporter/sql_exporter.yml +0 -25
@@ 1,25 0,0 @@
# Global defaults.
global:
  # Subtracted from Prometheus' scrape_timeout to give us some headroom and prevent Prometheus from timing out first.
  scrape_timeout_offset: 500ms
  # Minimum interval between collector runs: by default (0s) collectors are executed on every scrape.
  min_interval: 0s
  # Maximum number of open connections to any one target. Metric queries will run concurrently on multiple connections,
  # as will concurrent scrapes.
  max_connections: 3
  # Maximum number of idle connections to any one target. Unless you use very long collection intervals, this should
  # always be the same as max_connections.
  max_idle_connections: 3

# The target to monitor and the collectors to execute on it.
target:
  # Data source name always has a URI schema that matches the driver name. In some cases (e.g. MySQL)
  # the schema gets dropped or replaced to match the driver expected DSN format.
  data_source_name: 'sqlserver://prom_user:prom_password@dbserver1.example.com:1433'

  # Collectors (referenced by name) to execute on the target.
  collectors: [mssql_standard]

# Collector files specifies a list of globs. One collector definition is read from each matching file.
collector_files: 
  - "*.collector.yml"

D sr.ht/py3-alembic/APKBUILD => sr.ht/py3-alembic/APKBUILD +0 -29
@@ 1,29 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-alembic
_pyname=alembic
pkgver=1.4.2
pkgrel=0
pkgdesc="Lightweight database migration tool for usage with SQLAlchemy"
url="https://bitbucket.org/zzzeek/alembic"
arch="noarch"
license="MIT"
depends="py3-mako py3-dateutil py3-sqlalchemy py3-editor"
makedepends="python3-dev py3-setuptools py3-mock py3-pytest"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
replaces="py-alembic py2-alembic"
builddir="$srcdir/${_pyname}-${pkgver}"

build() {
	python3 setup.py build
}

check() {
	python3 setup.py check
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="82bdfe442c19033aa2b802ec49edd13ed265c00a2b5a048490a83ffa8e53587c56a90b64d554e746a9189923419c528482cb7a7c950c210e0de47b32fa7c270e  alembic-1.4.2.tar.gz"

D sr.ht/py3-cairocffi/APKBUILD => sr.ht/py3-cairocffi/APKBUILD +0 -36
@@ 1,36 0,0 @@
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Stefan Wagner <stw@bit-strickerei.de>
# Maintainer: Stefan Wagner <stw@bit-strickerei.de>
pkgname=py3-cairocffi
_pkgname=cairocffi
pkgver=1.1.0
pkgrel=1
pkgdesc="Python CFFI-based binding to Cairo and GDK-PixBuf"
url="https://pythonhosted.org/cairocffi/"
arch="noarch"
license="BSD-3-Clause"
depends="python3 py3-cffi cairo gdk-pixbuf"
checkdepends="
	py3-pytest py3-pytest-cov py3-pytest-isort py3-pytest-flake8 ttf-dejavu
"
makedepends="py3-setuptools"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-cairocffi" # For backwards compatibiltiy
provides="py-cairocffi=$pkgver-r$pkgrel" # For backwards compatibility

build() {
	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}


sha512sums="a9bc9ec5be767388aad9d06cc3b386b474dbacf097d3558b4033834cfb2f5418eede2f4b4080bec7e4725c6821f6e54d6c3366e8c4ee73bd3fa1cf444b395197  cairocffi-1.1.0.tar.gz"

D sr.ht/py3-cairosvg/APKBUILD => sr.ht/py3-cairosvg/APKBUILD +0 -34
@@ 1,34 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-cairosvg
_pyname=CairoSVG
pkgver=2.5.0
pkgrel=0
pkgdesc="Cairo-based SVG renderer for python"
url="https://cairosvg.org"
arch="noarch"
license="LGPL-3.0-or-later"
depends="
	python3 py3-tinycss2 py3-cssselect2 py3-defusedxml py3-cairocffi
	py3-webencodings
"
checkdepends="py3-pytest py3-pillow py3-pytest-flake8 py3-pytest-isort"
makedepends="python3-dev py3-setuptools cairo-dev"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir"/CairoSVG-$pkgver
replaces="py-cairosvg" # Backwards compat
provides="py-cairosvg=$pkgver-r$pkgrel" # Backwards compat

build() {
	python3 setup.py build
}

check() {
	pytest-3
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="9387273a5531f2e055871d3ccc3b770a46e549dceb443d9d7dbf3635f44da4a752f06ece2f86582f57eac08d59d78f833e1ed2e7badea340d5a0f1eb31beb24c  CairoSVG-2.5.0.tar.gz"

D sr.ht/py3-cssselect2/APKBUILD => sr.ht/py3-cssselect2/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Contributor: Drew DeVault <sir@cmpwn.com>
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-cssselect2
_pyname=cssselect2
pkgver=0.4.1
pkgrel=0
pkgdesc="CSS selectors for Python ElementTree"
url="https://pypi.org/projects/cssselect2/"
arch="noarch"
license="BSD-3-Clause"
depends="py3-tinycss2"
checkdepends="py3-pytest py3-pytest-cov py3-pytest-isort py3-pytest-flake8"
_pypiprefix="${_pyname%${_pyname#?}}"
source="
	https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz
"
builddir="$srcdir"/$_pyname-$pkgver
options="!check" # upstream tests are broken

build() {
	python3 setup.py build
}

check() {
	pytest
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="feafeec3dbe3157ee452d94cd391a09cfcb48ca8bd1563c117c77c9ceb01102c4989611ede39e433ec25d3ddda98a94c4589ccb290b79c729683e673763b42ac  cssselect2-0.4.1.tar.gz"

D sr.ht/py3-editor/APKBUILD => sr.ht/py3-editor/APKBUILD +0 -26
@@ 1,26 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-editor
_pyname=python-editor
pkgver=1.0.4
pkgrel=2
pkgdesc="Programmatically open an editor, capture the result"
url="https://github.com/fmoo/python-editor"
arch="noarch"
license="Apache"
makedepends="python3-dev py3-setuptools py3-six"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
replaces="py-editor"
builddir="$srcdir/${_pyname}-${pkgver}"
# This package is very simple and has no tests
options="$options !check"

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="c8ce2403bfe6c93935c7f4c384a8618a39cdaefe1ff5b1ff2cf4562866d8b3caa616e428c0a1634a56db934caeb474e7f84f8d5e009b9ed664189fdece8146f6  python-editor-1.0.4.tar.gz"

D sr.ht/py3-gitlab/APKBUILD => sr.ht/py3-gitlab/APKBUILD +0 -30
@@ 1,30 0,0 @@
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=py3-gitlab
_pkgname=python-gitlab
pkgver=2.2.0
pkgrel=0
pkgdesc="v4 GitLab API compliant library and cmdline tool"
options="!check" # Requires unpackaged 'httmock'
url="https://github.com/python-gitlab/python-gitlab"
arch="noarch"
license="LGPL-3.0-or-later"
depends="python3 py3-requests py3-six"
makedepends="py3-setuptools"
checkdepends="py3-pytest py3-mock"
source="https://files.pythonhosted.org/packages/source/p/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	py.test-3
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="bdf34e4b9e45f5767faf81d52caf1b800d931a105940bb80b1e58cc8efc34a319196a6aa437d49215f0f4ff24359cc2497853486698a23413b2bb3dfe169e5e3  python-gitlab-2.2.0.tar.gz"

D sr.ht/py3-httpretty/APKBUILD => sr.ht/py3-httpretty/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
pkgname=py3-httpretty
_pyname=httpretty
pkgver=1.0.2
pkgrel=0
pkgdesc="HTTP client mocking tool for Python"
url="https://github.com/gabrielfalcao/HTTPretty"
arch="noarch"
license="MIT"
depends="python3"
makedepends="python3-dev py3-setuptools"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
replaces="py-httpretty"
builddir="$srcdir"/$_pyname-$pkgver

build() {
	python3 setup.py build
}

check() {
	python3 setup.py build
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
	# Fix broken PyPI permissions
	chmod -R +r "$pkgdir"/usr/lib/python3.8/site-packages/
}

sha512sums="f9ef1c82f4fe3a31696e06228cea512664c5118b3c32910d7810d1fcf16b05d31b9b55db7bb6bd64967aadb162a2952757627439769db9117164b8248de9049c  httpretty-1.0.2.tar.gz"

D sr.ht/py3-llfuse/APKBUILD => sr.ht/py3-llfuse/APKBUILD +0 -31
@@ 1,31 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-llfuse
_pyname=llfuse
pkgver=1.3.6
pkgrel=0
pkgdesc="Python bindings for the low-level FUSE API"
url="https://pypi.org/project/llfuse/"
arch="all"
license="LGPL-3.0"
depends="python3 python3-dev cython fuse-dev"
checkdepends="py3-pytest"
makedepends="py3-setuptools"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.bz2"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	pyver=$(python3 --version | cut -d' ' -f2 | cut -d. -f1-2)
	export PYTHONPATH=build/lib.linux-$(uname -m)-$pyver/
	pytest-3
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
}

sha512sums="d67e39daf65c92ebb5bf69abb0c5dc3a88460228b5ec5ee762a11fc909369562411297e8ff9f512ee1ef539d8abec765924be581703fb7e99963c6512cb1f0bd  llfuse-1.3.6.tar.bz2"

D sr.ht/py3-passlib/APKBUILD => sr.ht/py3-passlib/APKBUILD +0 -27
@@ 1,27 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-passlib
_pyname=passlib
pkgver=1.7.2
pkgrel=1
pkgdesc="A password hashing library for Python"
url="https://code.google.com/p/passlib/"
arch="noarch"
license="BSD"
depends="python3"
makedepends="py3-setuptools"
source="https://pypi.io/packages/source/p/passlib/passlib-$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	python3 setup.py check
}

check() {
	python3 setup.py check
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
}

sha512sums="1ea0654b177b5ab2e1a7e5c3949642c34805ace6e4e4a0f82fafdb3f374edd99c667906ce598c335b668da049860648d5cbebb3e62d775898d5b0cb8cfc7bf53  passlib-1.7.2.tar.gz"

D sr.ht/py3-pygithub/APKBUILD => sr.ht/py3-pygithub/APKBUILD +0 -27
@@ 1,27 0,0 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=py3-pygithub
_pyname=PyGithub
pkgver=1.51
pkgrel=0
pkgdesc="Typed interactions with the GitHub API v3"
url="https://github.com/PyGithub/PyGithub"
arch="noarch"
license="LGPL-3.0-or-later"
depends="python3 py3-jwt py3-requests py3-deprecated"
makedepends="python3-dev py3-setuptools"
checkdepends="py3-httpretty py3-cryptography"
_pypiprefix="${_pyname%${_pyname#?}}"
source="$pkgname-$pkgver.tar.gz::https://github.com/$_pyname/$_pyname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"
options="!check" # these are broken and hard to fix

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="617b7bbc1fbd680735d5a57910ac1863cf67d9b2afc037d20fbd140a32aaa146164a76f73d76f2395aff1eee1fb13eac7a146c9cd05791b27db9a06a28d520e0  py3-pygithub-1.51.tar.gz"

D sr.ht/py3-pytest-flake8/APKBUILD => sr.ht/py3-pytest-flake8/APKBUILD +0 -28
@@ 1,28 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-pytest-flake8
_pyname=pytest-flake8
pkgver=1.0.6
pkgrel=0
pkgdesc="pytest plugin for efficiently checking PEP8 compliance"
url="https://pypi.org/project/pytest-flake8/"
arch="noarch"
license="3-Clause-BSD"
depends="py3-pytest py3-flake8"
makedepends="py3-setuptools"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="e1c76f4a170ca6fd94e27cf296b366a2a02f09e4216ded74b4724d8d19f50364caf245e4385b1cb644ead06b890df22400637773716190f673d3de254f5868f5  pytest-flake8-1.0.6.tar.gz"

D sr.ht/py3-pytest-isort/APKBUILD => sr.ht/py3-pytest-isort/APKBUILD +0 -29
@@ 1,29 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-pytest-isort
_pyname=pytest-isort
pkgver=1.0.0
pkgrel=0
pkgdesc="pytest plugin to check import ordering using isort"
url="https://pypi.org/project/pytest-isort/"
arch="noarch"
license="3-Clause-BSD"
depends="py3-pytest py3-isort"
makedepends="py3-setuptools"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	export PYTHONPATH="$(pwd)"
	pytest-3
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="e28a5c184c014b24131e02d9786c77f55281333a30a0a27c0b9227495929f216dfbacaf59e11b027ea8bb4b8be665058659cd454098facf978687fbc0580a2d8  pytest-isort-1.0.0.tar.gz"

D sr.ht/py3-qrcode/APKBUILD => sr.ht/py3-qrcode/APKBUILD +0 -30
@@ 1,30 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-qrcode
_pyname=qrcode
pkgver=6.1
pkgrel=2
pkgdesc="QR Code image generator"
url="https://github.com/lincolnloop/python-qrcode"
arch="noarch"
license="MIT"
depends="py3-pillow py3-six"
makedepends="python3-dev py3-setuptools"
_pypiprefix="${_pyname%${_pyname#?}}"
subpackages="$pkgname-doc"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
replaces="py-qrcode py2-qrcode"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	python3 setup.py check
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="4831553932442f5535cba15d5958a656b399112f0f379c28ad9b610c33d88ec6d0613dc7047a2315606e49f027bfd13a15a332ce86b80040d56e1114a0f62251  qrcode-6.1.tar.gz"

D sr.ht/py3-tinycss2/APKBUILD => sr.ht/py3-tinycss2/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Contributor: Drew DeVault <sir@cmpwn.com>
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-tinycss2
_pyname=tinycss2
pkgver=1.1.0
pkgrel=0
pkgdesc="Low-level CSS parser for Python"
url="https://pypi.python.org/pypi/tinycss2"
arch="noarch"
license="BSD-3-Clause"
depends="py3-webencodings"
checkdepends="py3-pytest py3-pytest-flake8 py3-pytest-isort py3-pytest-cov"
makedepends="python3-dev py3-setuptools"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir"/$_pyname-$pkgver
replaces="py-tinycss py2-tinycss py3-tinycss"
options="!check" # upstream tests are broken

build() {
	python3 setup.py build
}

check() {
	python3 setup.py pytest
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="218d28511802afc89a608def03084f5d460512a41d47280b5c8bfe72314c8ab3b14c98fbb0200bea6b8509c4d6f0107410d340e2d7f1830aaa92669a2699211e  tinycss2-1.1.0.tar.gz"

D sr.ht/qemu-minimal-static/90-kvm.rules => sr.ht/qemu-minimal-static/90-kvm.rules +0 -1
@@ 1,1 0,0 @@
KERNEL=="kvm", GROUP="kvm", MODE="0666"

D sr.ht/qemu-minimal-static/APKBUILD => sr.ht/qemu-minimal-static/APKBUILD +0 -88
@@ 1,88 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=qemu-minimal-static
pkgver=5.0.0
pkgrel=2
pkgdesc="A stripped down, chrooted version of qemu for untrusted guests"
url="https://qemu.org/"
arch="all"
license="GPL-2.0 LGPL-2"
makedepends="
	glib-dev
	glib-static
	libaio-dev
	libcap-dev
	libcap-ng-dev
	linux-headers
	lzo-dev
	perl
	pixman-static
	pixman-dev
	python3
	texinfo
	util-linux-dev
	vde2-dev
	zlib-dev
	zlib-static
	"
install="$pkgname.pre-install"
options="suid !strip !check" # strip fails on .img files; suid for chroot binary
source="
	https://wiki.qemu-project.org/download/qemu-$pkgver.tar.xz
	90-kvm.rules
	qemu-chroot.c
	xattr_size_max.patch
"
builddir="$srcdir/qemu-$pkgver"

prepare() {
	default_prepare
	sed -i 's/^VL_LDFLAGS=$/VL_LDFLAGS=-Wl,-z,execheap/' \
		Makefile.target
}

build() {
	./configure \
		--prefix=/ \
		--static \
		--python=/usr/bin/python3 \
		--audio-drv-list="" \
		--disable-docs \
		--disable-debug-info \
		--disable-opengl \
		--disable-virglrenderer \
		--disable-vte \
		--disable-gtk \
		--disable-sdl \
		--disable-spice \
		--disable-vnc \
		--disable-curses \
		--disable-xen \
		--disable-smartcard \
		--disable-libnfs \
		--disable-libusb \
		--disable-glusterfs \
		--disable-tools \
		--disable-werror \
		--target-list="x86_64-softmmu,i386-softmmu,aarch64-softmmu,arm-softmmu,ppc64-softmmu,s390x-softmmu,riscv64-softmmu,mips-softmmu,mipsel-softmmu,mips64el-softmmu"
	cc -o qemu-chroot "$srcdir"/qemu-chroot.c
}

package() {
	make DESTDIR="$pkgdir/usr/lib/qemu-minimal-static" install
	mkdir -p "$pkgdir"/usr/lib/qemu-minimal-static/dev
	mkdir -p "$pkgdir"/usr/lib/qemu-minimal-static/base
	mkdir -p "$pkgdir"/usr/lib/qemu-minimal-static/var/tmp
	touch "$pkgdir"/usr/lib/qemu-minimal-static/dev/null
	touch "$pkgdir"/usr/lib/qemu-minimal-static/dev/kvm
	install -Dm644 "$srcdir"/90-kvm.rules \
		"$pkgdir"/lib/udev/rules.d/90-kvm.rules
	mkdir -p "$pkgdir"/usr/bin
	install -Dm755 qemu-chroot "$pkgdir"/usr/bin/qemu-chroot
	chmod a+s "$pkgdir"/usr/bin/qemu-chroot
	rm "$pkgdir"/usr/lib/qemu-minimal-static/libexec/qemu-bridge-helper
}

sha512sums="21ef0cbe107c468a40f0fa2635db2a40048c8790b629dfffca5cd62bb1b502ea8eb133bfc40df5ecf1489e2bffe87f6829aee041cb8a380ff04a8afa23b39fcf  qemu-5.0.0.tar.xz
9b7a89b20fcf737832cb7b4d5dc7d8301dd88169cbe5339eda69fbb51c2e537d8cb9ec7cf37600899e734209e63410d50d0821bce97e401421db39c294d97be2  90-kvm.rules
996d78a60d4283b31400a808916c774e7dd80ae5827aa25966a19a8134710bf4a010f1eccc680dc6a4fdbaef953323e50674d6b857f4197d32d266ff106904c7  qemu-chroot.c
4b1e26ba4d53f9f762cbd5cea8ef6f8062d827ae3ae07bc36c5b0c0be4e94fc1856ad2477e8e791b074b8a25d51ed6d0ddd75e605e54600e5dd0799143793ce4  xattr_size_max.patch"

D sr.ht/qemu-minimal-static/qemu-chroot.c => sr.ht/qemu-minimal-static/qemu-chroot.c +0 -203
@@ 1,203 0,0 @@
#define _XOPEN_SOURCE
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <pwd.h>
#include <unistd.h>

int chroot(char *path);

struct userbind {
	char *src, *dest;
	struct userbind *next;
};

pid_t child;
char *pidpath = NULL, *root = NULL;
struct userbind *binds = NULL;

static void check(int p, char *ctx) {
	if (p) {
		return;
	}
	fprintf(stderr, "%s: %s\n", ctx, strerror(errno));
	exit(1);
}

static void usage(void) {
	fprintf(stderr, "Usage: qemu-chroot [-b <src>:<dest>] [-p <pidfile>] "
			"/bin/qemu-system-<arch> [args...]\n");
}

static void cleanup() {
	int r;
	char path[PATH_MAX + 1] = "";
	char *paths[] = {
		"/dev/null",
		"/dev/kvm",
	};
	for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); ++i) {
		snprintf(path, sizeof(path), "%s%s", root, paths[i]);
		r = umount2(path, 0);
		if (r != 0) {
			fprintf(stderr, "umount %s: %s\n", path, strerror(errno));
		}
	}

	while (binds) {
		snprintf(path, sizeof(path), "%s%s", root, binds->dest);
		r = umount2(path, 0);
		if (r != 0) {
			fprintf(stderr, "umount %s: %s\n", path, strerror(errno));
		}
		struct userbind *next = binds->next;
		free(binds);
		binds = next;
	}

	r = umount2(root, 0);
	if (r != 0) {
		fprintf(stderr, "umount %s: %s\n", root, strerror(errno));
	}
	remove(root);

	remove(pidpath);
}

static void sig(int s) {
	kill(child, s);
}

int main(int argc, char *argv[]) {
	FILE *pidfile = NULL;

	char c;
	while ((c = getopt(argc, argv, "b:p:h")) != -1) {
		switch (c) {
		case 'b':;
			char *src = strtok(optarg, ":");
			char *dest = strtok(NULL, ":");
			struct userbind *bind = calloc(1, sizeof(struct userbind));
			bind->src = src;
			bind->dest = dest;
			bind->next = binds;
			binds = bind;
			break;
		case 'p':
			if (pidfile != NULL) {
				fprintf(stderr, "-p may only be specified once");
				return 1;
			}
			pidpath = optarg;
			pidfile = fopen(pidpath, "w");
			check(pidfile != NULL, "open pid file for write");
			break;
		case 'h':
			usage();
			return 0;
		default:
			usage();
			return 1;
		}
	}

	argc -= optind;
	argv += optind;

	char tmp[] = "/tmp/qemu-chroot.XXXXXX";
	root = mkdtemp(tmp);
	check(root != NULL, "mkdtemp");

	struct passwd *nobody = getpwnam("nobody");
	check(nobody != NULL, "getpwnam");

	int r;
	r = mount("/usr/lib/qemu-minimal-static", root, "", MS_BIND, NULL);
	check(r == 0, "bind mount /usr/lib/qemu-minimal-static");

	char *paths[] = {
		"/dev/null",
		"/dev/kvm",
	};
	char path[PATH_MAX + 1] = "";
	for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); ++i) {
		snprintf(path, sizeof(path), "%s%s", root, paths[i]);
		r = mount(paths[i], path, "", MS_BIND, NULL);
		if (r != 0) {
			fprintf(stderr, "bind mount %s: %s\n", paths[i], strerror(errno));
			return 1;
		}
	}

	struct userbind *b = binds;
	while (b) {
		snprintf(path, sizeof(path), "%s%s", root, b->dest);
		r = mount(b->src, path, "", MS_BIND, NULL);
		if (r != 0) {
			fprintf(stderr, "bind mount %s: %s\n", b->src, strerror(errno));
			return 1;
		}
		b = b->next;
	}

	struct sigaction sa = {0};
	sigemptyset(&sa.sa_mask);
	sa.sa_handler = sig;
	sa.sa_flags = SA_RESTART;

	r = sigaction(SIGINT, &sa, NULL);
	check(r != -1, "sigaction");

	r = sigaction(SIGTERM, &sa, NULL);
	check(r != -1, "sigaction");

	child = fork();
	check(child != -1, "fork");
	if (child == 0) {
		if (pidfile != NULL) {
			fclose(pidfile);
		}

		r = chroot(root);
		check(r == 0, "chroot");

		r = setgid(nobody->pw_gid);
		check(r == 0, "setgid");
		r = setegid(nobody->pw_gid);
		check(r == 0, "setegid");
		r = setuid(nobody->pw_uid);
		check(r == 0, "setuid");
		r = seteuid(nobody->pw_uid);
		check(r == 0, "seteuid");

		if (setuid(0) != -1) {
			fprintf(stderr, "Unable to drop root, bailing out\n");
			return 1;
		}

		r = execv(argv[0], &argv[0]);
		check(r == 0, "execv");
	}

	if (pidfile != NULL) {
		fprintf(pidfile, "%d\n", child);
		fclose(pidfile);
	}

	int status;
	do {
		pid_t wpid = waitpid(child, &status, WUNTRACED | WCONTINUED);
		check(wpid != -1, "waitpid");
	} while (!WIFEXITED(status) && !WIFSIGNALED(status));

	cleanup();

	return WEXITSTATUS(status);
}

D sr.ht/qemu-minimal-static/qemu-minimal-static.pre-install => sr.ht/qemu-minimal-static/qemu-minimal-static.pre-install +0 -7
@@ 1,7 0,0 @@
#!/bin/sh

addgroup -S -g 34 kvm 2>/dev/null
addgroup -S -g 36 qemu 2>/dev/null
adduser -S -u 36 -G kvm -s /sbin/nologin qemu

exit 0

D sr.ht/qemu-minimal-static/xattr_size_max.patch => sr.ht/qemu-minimal-static/xattr_size_max.patch +0 -15
@@ 1,15 0,0 @@
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index faebd91..a0f15b6 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -25,6 +25,10 @@
 #include "trace.h"
 #include "migration/migration.h"
 
+#ifdef __linux__
+#include <linux/limits.h> /* for XATTR_SIZE_MAX */
+#endif
+
 int open_fd_hw;
 int total_open_fd;
 static int open_fd_rc;