[pacman-dev] Utility functions for PKGBUILDs

Aaron DeVore aaron.devore at gmail.com
Fri Jun 8 03:31:32 EDT 2012


I have noticed that the PKGBUILD's for the AUR packages that I
maintain contain a lot of duplicate code. For example, license
installation:

install -D -m644 COPYING \
    "$pkgname/usr/share/licenses/$pkgname/COPYING"

appears frequently. It would be useful to have a utility function instead:

# pkg-license <license file>
function pkg-license() {
	install -D -m644 "$1" "$pkgdir/usr/share/licenses/$pkgname/$(basename $1)"
}

That would appear in package() as:

pkg-license COPYING

Other candidates are Python 2 shebang rewriting (pkg-py2rewrite),
installing documentation (pkg-doc), Python setup.py calls
(pkg-pyinst/pkg-py3inst), and patches (pkg-patch).

Many other distros contain such functions. From what I've seen, the
functions can help make packages more concise and less error prone.

I will be taking a university course in open source software
development over the summer. We need to pick a project to work on
during the course. Would adding utility functions to makepkg/PKGBUILDs
be acceptable to Arch?

-Aaron DeVore


More information about the pacman-dev mailing list