Automate PKGBUILD testing with Docker
The script prepares a Docker 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 the Docker's volumes abstraction.
How to run it:
./aur-pkgbuild-tester.sh \ ./my-package-files \ ./custom-test-installation.sh
./aur-pkgbuild-tester.sh \ ./my-package-files
- 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
To spawn a minimal ArchLinux installation the script uses the base/archlinux (which is updated daily) and non-interactively installs the required packages to build the package (
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.