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

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

Hi,

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
>     so:libc.musl-x86_64.so.1
>     so:libcrypto.so.1.1
>     so:liblzo2.so.2
>     so:libssl.so.1.1

You are indeed noting that those virtual packages (e.g so:libssl.so.1.1) 
are virtual.
However,
1. You can use those in apk-add(1), for instance, see: `apk add 
so:libssl.so.1.1` (but this has drawbacks)
2. The reason it works that way is because there may be multiple 
packages that provide `so:libssl.so.1.1`.
3. You can find the exact list of packages that provide a given virtual 
using apk-search(1). For example, `apk search -x so:libssl.so.1.1` 
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 pkgs.alpinelinux.org)? For

I suspect that the way pkgs.alpinelinux.org 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:
> https://pkgs.alpinelinux.org/package/edge/main/armhf/openvpn
> 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:

```
#!/bin/sh
for p in $(apk info -qR $1)
do
     apk search -qx $p | head -n 1
done
```

This, on my system prints out the following output for openvpn:
```
iproute2
busybox
musl
libcrypto1.1
lzo
libssl1.1
```
- 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.

[1]: https://beta.docs.alpinelinux.org/user-handbook/0.1a/Working/apk.html

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---