The script prepares a Podman container where the process will run into, and accepts two arguments:
- Path of the directory containing the PKGBUILD
- Path of the shell script you want the container to run to check if the package is correctly installed
The PKGBUILD (and its sources) and the optional tester script are mounted into the container through Podman's volumes abstraction.
How to run it:
./aur-pkgbuild-tester.sh \
./my-package-files \
./custom-test-installation.shOr
./aur-pkgbuild-tester.sh \
./my-package-filesThree stages:
- The container with a fresh, minimal ArchLinux installation is created
- The PKGBUILD is built inside the container
- If specified, the tester script is run inside the container
If everything succeeds and the package directory is a git repository, all git-ignored files (sources, src/, pkg/, built packages) are removed afterwards with git clean -ffdX. Set KEEP_BUILD=1 to keep them.
To spawn a minimal ArchLinux installation the script uses the archlinux:base-devel image (which is updated daily) and non-interactively installs the required packages to build the package (sudo, binutils, fakeroot).
Then, inside the container, it creates a non-root user to build the package (running makepkg as root is disallowed); if the build fails the script quits with a non-zero code, meaning that something is wrong in the PKGBUILD or the sources.
After building and installing the package, the script runs a tester script, which by default is /bin/true but that can be overridden by passing the second argument to the script. The purpose of this tester script is making sure that the application installed works correctly.