Hi all,
When package splitting was implemented in makepkg, it was done so under
two premises:
1) Arch Linux did not split packages out of principle, and there would
be very few exceptions
2) KDE was the target package to be split, and its build system provided
nice make targets for doing so
This meant we targetted splitting packages where upstream provided
direct methods for installing the split components. So looking like:
pkgname=('pkg1' 'pkg2')
package_pkg1() {
cd "$pkgbase-$pkgver"
make DESTDIR="$pkgdir/" install-pkg1
}
package_pkg2() {
cd "$pkgbase-$pkgver"
make DESTDIR="$pkgdir/" install-pkg2
}
As time went by, Arch started splitting packages more - mostly to avoid
pulling large dependencies onto a system for wider components.
Packagers even started using (abusing) optional dependencies to avoid
splitting. The current splitting approach leads to monstrosities like
the Arch Linux gcc PKGBUILD [1] (of which I completely blame the current
packagers and take no responsibility!). Recently, some packagers have
been using a custom _pick function [2] to allow them to move specified
files from the first package's "make install" and save them for a later
split package. The _pick approach is more similar to how rpm/deb
approaches work, but relies on the (non-guaranteed) stability of makepkg
internals.
I have roughly implemented an additional approach to package splitting
that will improve this situation. Essentially, the "make install" is
done in the stash() function, and the files are stashed for future use
in packaging. The individual package_*() functions then provide the
files to include in the package in a "filelist" array. This array
allows the '*' wildcard, and '!' to exclude files. A simple example:
pkgname=('foo' 'foo-docs')
stash() {
cd $pkgbase-$pkgver
make DESTDIR=$stashdir install
}
package_foo() {
filelist=('*'
'!usr/share/docs/')
...
}
package_foo-docs() {
filelist=('usr/share/docs/')
...
}
I'm seeking feedback on this approach before I finish the implementation
and push this. Either replying to the email, or on the gitlab snippet [3].
Thanks!
Allan
[1]
https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/blob/main/PKGBUILD?ref_type=heads
[2]
https://gitlab.archlinux.org/archlinux/packaging/packages/gvfs/-/blob/main/PKGBUILD?ref_type=heads
[3] https://gitlab.archlinux.org/-/snippets/3770