packer
packer copied to clipboard
PKGBUILDs with multiple pkgnames can cause other builds to fail
Consider two packages, foo and bar. foo's PKGBUILD contains:
pkgname=foo
whereas bar's contains:
pkgname=(bar baz)
I run packer -S foo bar.
Before packer does anything else, it scrapes dependencies from the various packages' PKGBUILDs by sourcing them. After doing this, pkgname will be an array: (bar baz).
Now packer builds foo, and the first thing it does is source foo's PKGBUILD, which contains pkgname=foo. Unfortunately, bash is terrible, and this leaves pkgname still as an array, but now containing (foo baz).
$ pkgname=(bar baz)
$ echo "${pkgname[@]}"
bar baz
$ pkgname=foo
$ echo "${pkgname[@]}"
foo baz
The foo build will continue, and only at the very end will packer abort the installation with the infuriatingly nonsensical message:
error: 'baz-*.pkg.tar.xz': could not find or read package
This happens to me with mozc, which names itself (mozc ibus-mozc), producing errors about ibus-mozc-*.pkg.tar.xz not being found. This is particularly confusing because ibus-mozc is itself a separate package, so I've tried simply not installing it at the same time, which of course didn't help. (Come to think of it, if mozc can produce ibus-mozc as part of its build, why does packer end up building both?)
packer should take care to completely erase pkgname before a build.