#!/bin/bash
set -e

# rpm -Va is singlethreaded, this makes it fast

td="$(mktemp -d)"
cd "$td"

rpm -qa | split -l20 - qa.

(cat <<'EOF'
all: $(addprefix v., $(wildcard qa.*))

v.%: %
	-tr "\n" "\0" < $< | xargs -0 rpm -V > v.$<

EOF
) |
make -f- -j$(nproc) >&2

cat v.*
cd
rm -rf "$td"
