Mail archive

Re: [alpine-devel] apk and libraries that optionally replace others

From: Oliver Smith <>
Date: Wed, 16 May 2018 20:55:00 +0000

Thanks for the quick and detailed reply! With the solution you have
described, one can reliably make one package always get installed
instead of the other one. I have tried it and it works.

But our use case is slightly different: not all devices need
libdrm-tegra, so we would like all non-tegra devices to depend on the
regular libdrm package. (If we add a higher provider_priority to
libdrm-tegra, then *all* devices will use libdrm-tegra.)

Can this be done with apk as well?


William Pitcock:
> Hello,
> On Tue, May 15, 2018 at 11:08 PM, William Pitcock
> <> wrote:
>> Hello,
>> On Tue, May 15, 2018 at 3:57 PM, Oliver Smith
>> <> wrote:
>>> Hey folks,
>>> in Alpine based postmarketOS we have hit the following use case quite a
>>> few times by now, and we're wondering how to solve it properly:
>>> Packaging "testlib-b" as a _optional_ replacement for "testlib-a".
>>> Both "testlib-a" and "testlib-b" provide the same soname, which means
>>> abuild will automatically make both binary packages provide
>>> "".
>> By default this means that both packages will provide
>> with provider_priority 0. When provider_priority
>> is 0, it means to skip automatically resolving the provider. Provider
>> selection is based on a combination of priority and overall "cost" of
>> choosing that provider. apk will prefer the highest priority provider
>> with the lowest cost (dependency chain length) that can yield a
>> satiable solution.
>>> Now there is a "testapp" package, which has "testlib-a" in makedepends
>>> and links against "". Therefore abuild puts
>>> "" in the depends of "testapp". What we would like to
>>> achieve is, that whenever installing "testapp", it pulls in "testlib-a".
>>> But when "testlib-b" is already installed, it uses "testlib-b" instead
>>> of "testlib-a".
>> testlib-b (libdrm) should have provider_priority 1, testlib-a
>> (libdrm-grate) should have provider_priority greater than 1. The
>> provides field itself should be left alone. The key is to set a
>> priority on both providers, otherwise APK will treat it as a collision
>> and behave as you describe.
> For what it's worth, I am open to adding provider_priority=1 to
> libdrm. But it's not my package, so I prefer to hear from ncopa who
> maintains it first. Otherwise, you will need to rebuild the package.
> William

Received on Wed May 16 2018 - 20:55:00 UTC