# Check for all port dependencies



## ccc (May 5, 2010)

hi

Howto check for all port dependencies?


----------



## ondra_knezour (May 5, 2010)

If you mean check, if all library dependecies are satisfied, *pkg_libchk* from sysutils/bsdadminscripts works fine for me.


----------



## DutchDaemon (May 5, 2010)

And if you mean "which port depends on which ports", either run [cmd=]pkg_info -rR <portglob>[/cmd] for an installed port, or run [cmd=]make build-depends-list && make run-depends-list[/cmd] in a port directory under /usr/ports. 

Finally: if you wonder which dependencies you still need to install for a port, run [cmd=]make missing[/cmd] in a port directory under /usr/ports.


----------



## avilla@ (May 5, 2010)

DutchDaemon said:
			
		

> And if you mean "which port depends on which ports", either run [cmd=]pkg_info -rR <portglob>[/cmd] for an installed port, or run [cmd=]make build-depends-list && make run-depends-list[/cmd] in a port directory under /usr/ports.



and `$ make all-depends-list` will list all the dependencies, including grandchildren and so on going down the tree


----------



## ccc (May 5, 2010)

Thx, but howto check for all already installed, dependent packages from a port?


----------



## graudeejs (May 5, 2010)

simple solution

```
$ portmaster --show-work x11-wm/fvwm2-devel
```
it will show all dependancies that are not installed and that will be installed, if you run portmaster without --show-work, it'll also show which dependencies will be updated 

Note, might not be the best solution, since it doesn't check if all packages have all files, maybe some files were deleted etc.....


----------



## billgates (Jun 20, 2010)

does FreeBSD have a archlinux equivalent of 


```
#pacman -Ql package
```

- this will query the package database and List all files owned by a given package. 

eg:

```
root@myhost ~#pacman -Ql mlocate
mlocate /etc/
mlocate /etc/cron.daily/
mlocate /etc/cron.daily/updatedb
mlocate /etc/updatedb.conf
mlocate /usr/
mlocate /usr/bin/
mlocate /usr/bin/locate
mlocate /usr/bin/slocate
mlocate /usr/bin/updatedb
mlocate /usr/share/
mlocate /usr/share/locale/
mlocate /usr/share/locale/ast/
.....
```


----------



## phoenix (Jun 20, 2010)

pkg_info().  Look for the -L switch.  And the -x switch.


----------



## jb_fvwm2 (Jun 20, 2010)

Also, the pkg-plist in the /port/ can be useful.  One
can for example, `grep` it ...

```
grep bin /usr/ports/security/sudosh/pkg-plist
```


----------



## manilaboy1vic (Dec 15, 2014)

Is there a way to see the reverse of `make build-depends-list && make run-depends-list`?

For example, I want to remove linux_base-f10-10_9.  I want to know if any of the other ports depend on it.

For example, what will break once I delete linux_base-f10-10_9?


----------



## wblock@ (Dec 15, 2014)

`pkg info -r [i]pkgname[/i]` shows everything that requires _pkgname_.  -d is the opposite, showing everything that _pkgname_ depends on.


----------



## kpa (Dec 15, 2014)

manilaboy1vic said:


> Is there a way to see the reverse of `make build-depends-list && make run-depends-list`?
> 
> For example, I want to remove linux_base-f10-10_9.  I want to know if any of the other ports depend on it.
> 
> For example, what will break once I delete linux_base-f10-10_9?



It's not easy to figure out which ports are going to depend on a particular port until the ports get built and installed. The cross-reference information that would be needed just isn't there in the ports tree in any kind of pre-computed way, it would have to be done by searching the whole ports tree for references to the particular port by running `make all-depends-list` or `make run-depends-list` on every port except the one that is being examined.

Edit: The dependency information is available in INDEX-* files so they can be used to speed up the process.


----------



## free-and-bsd (Apr 7, 2016)

manilaboy1vic said:


> Is there a way to see the reverse of `make build-depends-list && make run-depends-list`?
> 
> For example, I want to remove linux_base-f10-10_9.  I want to know if any of the other ports depend on it.
> 
> For example, what will break once I delete linux_base-f10-10_9?


I know it's been a while, but I've come across a similar question. Actually a simple script can help to deal with that:

```
#!/usr/local/bin/bash
pkg info -ao | awk '{ print $2 }' |
while read line
do
cd /usr/ports/$line
if [ -n "$(make run-depends-list | grep linux_base-f10)" ]; then
  echo "$line depends on linux_base-f10"
fi
done
```
Since all run dependencies, unlike _build_ dependencies, are kept in place and are found among the installed packages, there must be no problem about it.


----------



## SirDice (Apr 7, 2016)

Since the script only checks installed ports you might as well use `pkg info -r linux_base-f10`

pkg-info(8):

```
-r, --required-by
             Display the list of packages which require pkg-name.
```


----------



## free-and-bsd (Apr 7, 2016)

Yea, so it says. But I was a bit mistrusting it after it failed to show me why certain packages were persistently rebuilt (by portmaster) after removal, while "no installed package needed them" according to the `pkg -r ...` output.


----------



## zirias@ (Apr 7, 2016)

free-and-bsd said:


> Yea, so it says. But I was a bit mistrusting it after it failed to show me why certain packages were persistently rebuilt (by portmaster) after removal, while "no installed package needed them" according to the `pkg -r ...` output.


Probably because another rebuilt port needs them to _build_. `pkg` will only show runtime dependencies, which is enough for binary packages.


----------



## SirDice (Apr 8, 2016)

Yes, exactly. It shows runtime and library dependencies. Not the build dependencies (which aren't needed for a package).


----------



## free-and-bsd (Apr 8, 2016)

So that is why my script above instead of just `pkg -r ...`, it originally contained all-depends-list instead of run-depends-list.


----------



## SirDice (Apr 8, 2016)

Your script only shows run dependencies (run-depends-list).


----------



## free-and-bsd (Apr 8, 2016)

Sorry, it originally contained all-depends-list or build-depends-list  Forgot to mention.


----------



## SirDice (Apr 8, 2016)

In this case it probably won't matter, as far as I know emulators/linux_base-f10 is never a build or library dependency. It's only a run dependency. But I haven't checked all 25.000+ ports


----------



## free-and-bsd (Apr 8, 2016)

SirDice said:


> In this case it probably won't matter, as far as I know emulators/linux_base-f10 is never a build or library dependency. It's only a run dependency. But I haven't checked all 25.000+ ports


Right, I don't see how it could be a build-dependency. But my script was written with webkit2-gtk3 and other longbuilders in mind.


----------



## Vladimir Botka (May 31, 2016)

`pkg check --dependencies`


----------



## free-and-bsd (Jun 4, 2016)

Vladimir Botka said:


> `pkg check --dependencies`


Well, it says: 100%. Looks good, but not very informative, eh? You must have meant

```
pkg info --dependencies <pkgname>
```


----------

