# info on uninstalled package



## simonpie (Jul 28, 2022)

Hello all,

Here is a newbie's question.  I wanted to install wireguard.  I found  this projects which seems mature enough and it runs as a kernel module.  They give simple instruction on how to install 


> pkg install wireguard



Simple enough.  But I decided to do a `pkg search` before and I got this :


```
[charon:: 20:57:55] [~] > pkg search  wireguard 
wireguard-2,1                  Meta-port for Wireguard
wireguard-go-0.0.20220316_2,1  WireGuard implementation in Go
wireguard-kmod-0.0.20220615    WireGuard implementation for the FreeBSD kernel
wireguard-tools-1.0.20210914_1 Fast, modern and secure VPN Tunnel
wireguard-tools-lite-1.0.20210914_1 Fast, modern and secure VPN Tunnel (lite flavor)
[charon:: 21:06:57] [~] >
```

or this version with the origin


```
[charon:: 20:57:49] [~] > pkg search -o wireguard 
net/wireguard                  Meta-port for Wireguard
net/wireguard-go               WireGuard implementation in Go
net/wireguard-kmod             WireGuard implementation for the FreeBSD kernel
net/wireguard-tools            Fast, modern and secure VPN Tunnel
net/wireguard-tools            Fast, modern and secure VPN Tunnel (lite flavor)
[charon:: 20:57:55] [~] >
```

My first question is : how can I get more info on each one of those, a litle bit like `brew` would provide and without installing.

Second question, simply `wireguard` is the one suggested, but it says _Meta-port_ what ever that means.  And there is another package which has `kmod` in its name.  Which one is the good one ?  How can I tell ?


----------



## Lamia (Jul 28, 2022)

simonpie said:


> how can I get more info on each one of those, a litle bit like `brew` would p


Check freshports.org. 
See https://searx.be/search?q=freshports+wireguard


----------



## Lamia (Jul 28, 2022)

simonpie said:


> Second question, simply `wireguard` is the one suggested, but it says _Meta-port_ what ever that means. And there is another package which has `kmod` in its name. Which one is the good one ? How can I tell ?


Freshports will tell you what build and runtime dependencies, among others, that are required.


----------



## simonpie (Jul 28, 2022)

Perfect, this answered all my questions.  Here are my conclusions for other newbies that might read this.

Meta-port are effectively empty and points to other port.  And one can see that the wireguard meta-port will in fact  install wireguard-kmod and wireguard-tools packages.

There are also links to the project's web-page.

Thank you very much.


----------



## bsduck (Jul 28, 2022)

simonpie said:


> how can I get more info on each one of those


No need to open a web browser and visit FreshPorts, just use `pkg search -f`.
See pkg-search(8) and pkg-rquery(8) for more options.


----------



## simonpie (Aug 3, 2022)

Thank you, this works too.  Both solution are of useful indifferent ways.  Unless I cannot read correctly, which happens way too often, `pkg search -f wireguard` does not explicitly give the dependences.  It says :


> This package does not contain anything by itself - it is a "meta-port" that
> depends on other wireguard packages.



But, does not point to wireguard-kmod.


----------



## SirDice (Aug 3, 2022)

`pkg rquery %do wireguard`


```
Multiline patterns:
     %d[nov]
             Expands to the list of dependencies for the matched package,
             where n stands for the package name, o for the package origin,
             and v for the package version.
```


```
root@fbsd-test:~ # pkg rquery %do wireguard
net/wireguard-tools
net/wireguard-kmod
```

You can also just look at the port's Makefile (this one isn't very complex):

```
RUN_DEPENDS=	wg-quick:net/wireguard-tools
{...}
RUN_DEPENDS+=	${KMODDIR}/if_wg.ko:net/wireguard-kmod
```

A more "complete" list could be found with the `all-depends-list` target (see ports(7)):

```
root@fbsd-test:/usr/ports/net/wireguard # make all-depends-list
/usr/ports/ports-mgmt/pkg
/usr/ports/net/wireguard-tools
/usr/ports/devel/gmake
/usr/ports/devel/gettext-runtime
/usr/ports/print/indexinfo
/usr/ports/shells/bash
/usr/ports/devel/bison
/usr/ports/devel/m4
/usr/ports/print/texinfo
/usr/ports/misc/help2man
/usr/ports/devel/p5-Locale-gettext
/usr/ports/devel/gettext-tools
/usr/ports/devel/libtextstyle
/usr/ports/lang/perl5.32
/usr/ports/devel/p5-Locale-libintl
/usr/ports/converters/libiconv
/usr/ports/converters/p5-Text-Unidecode
/usr/ports/textproc/p5-Unicode-EastAsianWidth
/usr/ports/devel/readline
/usr/ports/net/wireguard-kmod
```

But this is going to show a bunch of _build_ dependencies too. The package isn't going to depend on those.


----------



## Erichans (Aug 3, 2022)

As shown above pkg-rquery(8) is used for "precise queries", targeting a specific remote pkg-name; also there is the pkg alias `rall-depends`. Note that where pkg-query(8) searches the _local_ pkg repository/database, both pkg-rquery(8) and pkg-search(8) apply to the _remote _repository.



simonpie said:


> [...] `pkg search -f wireguard` does not explicitly give the dependences. [...]
> But, does not point to wireguard-kmod.


pkg-search(8) is more of a general nature where it targets a pattern. As such `pkg search -f wireguard` also returns info about the alternative Go implementation of wireguard, net/wireguard-go. With that in mind, pkg-search(8) can retrieve the dependencies with an Output Modifier Option (*-Q* _query modifier_):

```
[1] % pkg search -Q depends-on wireguard
wireguard-2,1
Comment        : Meta-port for Wireguard
Depends on     :
    wireguard-tools-1.0.20210914_1
    wireguard-kmod-0.0.20220615
wireguard-go-0.0.20220316_2,1
Comment        : WireGuard implementation in Go
wireguard-kmod-0.0.20220615
Comment        : WireGuard implementation for the FreeBSD kernel
wireguard-tools-1.0.20210914_1
Comment        : Fast, modern and secure VPN Tunnel
Depends on     :
    bash-5.1.16
wireguard-tools-lite-1.0.20210914_1
Comment        : Fast, modern and secure VPN Tunnel (lite flavor)
[2] % pkg rall-depends wireguard
wireguard-tools-1.0.20210914_1
wireguard-kmod-0.0.20220615
[3] % pkg alias rall-depends
rall-depends          'rquery %dn-%dv'
```
In commands [2] & [3] the pkg alias `rall-depends` (defined in /etc/pkg.conf) works as a substitute for the specific `pkg rquery`.

Instead of `pkg search -Q depends-on wireguard` you can use `pkg search --depends-on wireguard` or `pkg search -d wireguard`. These formats have the (small) advantage—in this case—that you can see the direct recursive dependencies of net/wireguard-tools: it depends on shells/bash. Note however that only happens to work here (for only one dependency level deeper) because net/wireguard-tools is also being matched by "wireguard" in `pkg search -Q depends-on wireguard`; therefore, it does not show on which packages shells/bash depends.

If you want a listing of all recursive dependencies of a remote package then, you'll have to write your own script for that; you could make use of pkg-query(8):

```
*%?[drCOLBbA]*
         Returns 0 if the list is empty and 1 if the list has information
         to display

         *d*    for dependencies
         [...]
```

For local packages—already installed and administered to the local package database—you can rely on pkg-query(8) or `all-depends-list` target (see ports(7)), as mentioned in the previous message. Note also the various options that predefined pkg aliases will give you: see `pkg alias | grep depend`. However, for recursive dependencies you have to resort to script programming or make use of databases/sqlite3/. To get started for this specific topic, have a look at the SQL query for the reverse dependencies of a package here.


----------



## simonpie (Aug 3, 2022)

Thank you, as ever RTFM ( `man pkg-search` ) is the key.

Effectively, `pkg search -do` gives a nice output :


```
[charon:: 8:29:35] [~] > pkg search -do wireguard
net/wireguard
Comment        : Meta-port for Wireguard
Depends on     :
    wireguard-tools-1.0.20210914_1
    wireguard-kmod-0.0.20220615
net/wireguard-go
Comment        : WireGuard implementation in Go
net/wireguard-kmod
Comment        : WireGuard implementation for the FreeBSD kernel
net/wireguard-tools
Comment        : Fast, modern and secure VPN Tunnel
Depends on     :
    bash-5.1.16
net/wireguard-tools
Comment        : Fast, modern and secure VPN Tunnel (lite flavor)
[charon:: 8:29:40] [~] >
```


----------

