abuild ignores invalid install= variables in subpackages
Example APKBUILD:
# Maintainer: Example <example@example.org>
pkgname=foo
pkgver=1
pkgrel=0
pkgdesc="Example"
url="https://example.org"
arch="noarch"
license="GPL"
subpackages="$pkgname-sub1"
options="!check"
package() {
mkdir -p "$pkgdir"
}
sub1() {
install="foo_sub.post-install"
mkdir -p "$subpkgdir"
}
foo_sub.post-install
is just an empty file in this example
Build output:
localhost:~/abuild-test$ abuild -r
>>> foo: Building luca/foo 1-r0 (using abuild 3.6.0-r1) started Mon, 16 Nov 2020 20:40:56 +0100
>>> foo: Checking sanity of /home/luca/abuild-test/APKBUILD...
>>> foo: Analyzing dependencies...
>>> foo: Installing for build: build-base
WARNING: Ignoring /home/luca/packages//luca/x86_64/APKINDEX.tar.gz: No such file or directory
(1/1) Installing .makedepends-foo (20201116.194057)
OK: 2235 MiB in 584 packages
>>> foo: Cleaning up srcdir
>>> foo: Cleaning up pkgdir
>>> foo: Entering fakeroot...
>>> foo-sub1*: Running split function sub1...
>>> foo-sub1*: Preparing subpackage foo-sub1...
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
>>> foo-sub1*: Running postcheck for foo-sub1
>>> foo*: Running postcheck for foo
>>> foo*: Preparing package foo...
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
>>> foo-sub1*: Tracing dependencies...
>>> foo-sub1*: Package size: 4.0 KB
>>> foo-sub1*: Compressing data...
>>> foo-sub1*: Create checksum...
>>> foo-sub1*: Create foo-sub1-1-r0.apk
>>> foo*: Tracing dependencies...
>>> foo*: Package size: 4.0 KB
>>> foo*: Compressing data...
>>> foo*: Create checksum...
>>> foo*: Create foo-1-r0.apk
>>> foo: Build complete at Mon, 16 Nov 2020 20:40:57 +0100 elapsed time 0h 0m 1s
>>> foo: Cleaning up srcdir
>>> foo: Cleaning up pkgdir
>>> foo: Uninstalling dependencies...
(1/1) Purging .makedepends-foo (20201116.194057)
OK: 2235 MiB in 583 packages
>>> foo: Updating the luca/x86_64 repository index...
>>> foo: Signing the index...
I've traced this behavior back to this code https://gitlab.alpinelinux.org/alpine/abuild/-/blob/8ceca11831a3990a14f92ab6aeb83a4b1d54be2b/abuild.in#L1128-1130
Would this install=
line be placed in the parent, the sanity check would catch this:
>>> ERROR: foo: foo_sub.post-install: install script does not match pkgname or any subpackage
As far as I understand this piece of code, it exists because it's possible to declare install
scripts in both parent and subpackages - and subpackages need to ignore install directives meant for different subpackages or the parent. This leads to this annoying situation though.
I've also noticed that the triggers
variable are only supposed to be used in the main package as indicated in the APKBUILD Reference:
The triggers variable must include the triggers for subpackages too if they have any.