In order to display information in the AUR web interface, the AUR's back-end code attempts to parse PKGBUILD files and salvage package name, version, and other information from it.
PKGBUILDs are Bash scripts, and correctly parsing Bash scripts without executing them is a huge challenge, which is why makepkg is a Bash script itself: it includes the PKGBUILD of the package being built via the
source directive. AUR metadata files were created to get rid of some hacks, used by AUR package maintainers to work around incorrect parsing in the web interface. See also FS#25210, FS#15043, and FS#16394.
How it works
By adding a metadata file called ".AURINFO" or ".SRCINFO" to source tarballs to overwrite specific PKGBUILD fields. An outdated format of this file was described in the AUR 2.1.0 release announcement.
.AURINFO files are parsed line-by-line. The syntax for each line is
key[_arch] = value. Exactly one space must be on each side of the equals sign, even for an empty value, and do not include quotes around the values.
key is a field name, based on the names of the corresponding PKGBUILD Variables. Some field names may optionally be suffixed with an architecture name. Fields are grouped into sections, each headed by one of the following two field names:
- pkgbase: This is required by AUR 3, otherwise the infamous “only lowercase letters are allowed” error is reported. (Pacman uses the first pkgname if pkgbase is omitted.) Repeat pkgname if unsure. There is only one pkgbase section. The field values from this section are inherited unless overridden in the pkgname sections that follow it. An empty field value in the pkgname section cancels the inheritance.
- pkgname: There may be multiple pkgname sections.
The following field names are associated with a single value for the section:
- pkgver: package version, may be formatted as [epoch:]pkgver if the epoch field is not given separately
- pkgrel: release number of the package specific to Arch Linux
The following field names may be repeated on multiple lines in a section to add multiple values:
- license: in case of multiple licenses separate them by a space
The following field names may be repeated, and also may optionally have an architecture suffix, separated from the field name by an underscore:
- depends: dependencies, one per line
Fields with other names are ignored. Blank lines and comment lines beginning with a hash sign (#) are also ignored. Lines may be indented. This format closely matches the
.PKGINFO format that is used for binary packages in pacman/libalpm.
Working with makepkg --source
makepkg --source will not automatically include an .AURINFO file in the source tarball. To include the .AURINFO file in the source tarball, use
mkaurball from the package instead of
What does not work
- Multiple architectures (
x86_64dependencies tend to be more numerous, so just put them)
pkgbuild-introspection and mkaurball
pkgbuild-introspection is a set of tools for generating
.AURINFO files. One of the provided tools is
mkaurball, which is a script that runs
makepkg --source, generates an
.AURINFO file, and inserts it into the resulting source package.
mkaurballis a wrapper for
makepkg --source. When creating source packages for inclusion in the AUR, use
mkaurballinstead of running
- https://projects.archlinux.org/aur.git/tree/web/html/pkgsubmit.php, the code that reads the “.AURINFO” file.