Mail archive

Re: [alpine-user] apk info to get package depends?

From: Chloe Kudryavtsev <>
Date: Sat, 2 Mar 2019 14:48:49 -0500


On 3/2/2019 12:34 PM, John Miner wrote:
> For example, when I use --depends, it provides a list of some packages and some
> modules, not all of which can be used in "apk add":
> apk info --repository /tmp/alpine/apks/ --arch armhf --depends openvpn
> openvpn-2.4.6-r4 depends on:
> iproute2
> /bin/sh

You are indeed noting that those virtual packages (e.g
are virtual.
1. You can use those in apk-add(1), for instance, see: `apk add` (but this has drawbacks)
2. The reason it works that way is because there may be multiple
packages that provide ``.
3. You can find the exact list of packages that provide a given virtual
using apk-search(1). For example, `apk search -x`
returns "libssl1.1-1.1.1b-r0" on my machine.

> Is there a way to use apk to get the actual package names of the dependencies
> (similar to the list that appears under "Depends" on For

I suspect that the way does it is by using the
common selection mechanism.
If multiple packages provide the same virtual, the one with the higher
version number wins out.
Of course, sometimes, this can cause issues, and so may be reworked.

> example, for the above, I would want:
> Depends:
> busybox
> iproute2
> libcrypto1.1
> libssl1.1
> lzo
> musl

This obviously doesn't work, since multiple packages can provide any
given virtual.
If you're fine with selecting any possible provider (as you appear to
be), you might consider a script along the following lines:

for p in $(apk info -qR $1)
     apk search -qx $p | head -n 1

This, on my system prints out the following output for openvpn:
- which appears to roughly match what you desire.

For more details regarding apk, and how you might use it, consider
reading through the user documentation on it[1].
It's currently in-progress, and somewhat rough (unedited), but I suspect
it would still be useful to you.


Received on Sat Mar 02 2019 - 14:48:49 UTC