how to select a specific package "provider" in apkbuild?
when working in postmarketOS, I came across a situation where it's desirable to always install a specific package except in some limited cases where a package is installed then some other package should be installed. Here's an example:
- package
BAR
is a reimplementation/replacement for packageFOO
- package
FOO
should be installed when somethingdepends=FOO
- a provisioning script effectively runs
apk add FOO
- the special case is if package
BAZZ
is installed, then we want packageBAR
to be installed instead ofFOO
One experiment to get this working involved using the following APKBUILD config:
APKBUILD for FOO:
...
provides=FOO
provider_priority=1
...
APKBUILD for BAR:
depends="<other stuff, but not FOO>"
...
provides=FOO
provider_priority=0
...
APKBUILD for BAZ:
...
subpackage="$pkgname-FOO"
...
FOO() {
install_if="$pkgname=$pkgver-r$pkgrel FOO"
depends="BAR"
mkdir "$subpkgdir"
}
...
When using the above, apk always selects FOO
even if BAR
is installed. Is there some other way to accomplish this purely in the APKBUILDs for these packages?