10

I'm trying to build a port which depends on apache-ant.

I thought I could run make build-depends-list to see all dependencies required by this port:

# make build-depends-list
/usr/ports/devel/apache-ant
/usr/ports/java/jdk16
/usr/ports/math/gmp

But after installing everything, the port had a dependency list which was a mile long:

apache-ant-1.8.1 desktop-file-utils-0.15_2 gamin-0.1.10_4 gettext-0.18.1.1 gio-fam-backend-2.26.1 glib-2.26.1_1 gmp-5.0.1 inputproto-2.0 javavmwrapper-2.3.5 kbproto-1.0.4 libX11-1.3.3_1,1 libXau-1.0.5 libXdmcp-1.0.3 libXext-1.1.1,1 libXi-1.3,1 libXtst-1.1.0 libiconv-1.13.1_1 libpthread-stubs-0.3_3 libxcb-1.7 pcre-8.12 perl-5.10.1_3 pkg-config-0.25_1 python26-2.6.6 recordproto-1.14 unzip-6.0 xextproto-7.1.1 xproto

This dependency list is a rude surprise, and I would like to know about it before I commit to installing a port.

How can I see all dependencies, and all subdependencies for a port?

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
Stefan Lasiewski
  • 22,949
  • 38
  • 129
  • 184

5 Answers5

19

You are very close. Try this instead:

make all-depends-list

That will recurse through all dependencies and print them for you. To test different build scenarios and how they affect the dependency list, try things like:

make NOPORTDOCS=yes NOPORTEXAMPLES=yes all-depends-list

make WITHOUT_X11=yes all-depends-list

Here is the full set of dependency print targets:

all-depends-list
build-depends-list
run-depends-list
package-depends-list
pretty-print-build-depends-list
pretty-print-run-depends-list

Cheers, Greg

glarkin
  • 306
  • 1
  • 3
  • Hi Greg, do you know where the dependency print targets are documented? Is there a specific man file? I don't have a question ... It's just for a deeper understanding. Thanks. –  Sep 21 '14 at 07:19
  • Nevermind. They are documented in `man ports`. –  Sep 25 '14 at 08:40
2

To list ports on which depends:

pkg_info -rx "port-name"

To list ports which require :

pkg_info -Rx "port-name"

-- Answer from this website:http://daemon-notes.com/tips (thanks to Ross)

Sven
  • 97,248
  • 13
  • 177
  • 225
End User
  • 21
  • 1
  • Thanks for the response. However, I need to point out that the `pkg_*` tools were deprecated and replaced with [pkgng](https://wiki.freebsd.org/pkgng) – Stefan Lasiewski Dec 09 '14 at 19:29
  • 1
    The command works; in pkgng you only have to remove the underscore: `pkg info -Rx 'port-name'` – Eric Jan 20 '16 at 19:58
1

You would have to recursively get all subdependencies as well. There probably are some tools for that in the ports-mgmt category...

I use portmaster(8) for port management. It always gathers (sub)dependencies before compiling and installing a port:

~> portmaster --show-work devel/apache-ant
===>>> Port directory: /usr/ports/devel/apache-ant
===>>> Starting check for all dependencies
===>>> Gathering dependency list for devel/apache-ant from ports

===>>> Installed converters/libiconv
===>>> Installed devel/gettext
===>>> NOT INSTALLED            devel/gmake
===>>> Installed devel/libcheck
...
mschuett
  • 3,066
  • 20
  • 21
1

Most dependency lists are hard to parse at a glance. I prefer using this wrapper script by helmut@charlieroot.de, because it displays a nice, nested list with both upward and downward dependencies:

$ pkg_depends.pl ruby18-bdb-0.6.5_1
Package ruby18-bdb-0.6.5_1 depends on:
    db41-4.1.25_4
    ruby-1.8.7.248_5,1
Package ruby18-bdb-0.6.5_1 is required by:
    portupgrade-2.4.7,2

Running it without arguments can produce a very long list, because it shows all dependency chains for all files, so I usually only recommend running it for a particular port.

Royce Williams
  • 1,362
  • 8
  • 16
0

few years after ...

my solution for get packages installed (for backup purpose)

I have solution for FreeBSD 12+ (bash)

for i in $( cd /usr/ports/databases/mysql80-server/ && make run-depends-list); do pkg create -o /root/packages $( echo $i | rev | cut -d '/' -f1 | rev ); done

but U can change pkg command from create to install and change run to build

for i in $( cd /usr/ports/databases/mysql80-server/ && make build-depends-list); do pkg install $( echo $i | rev | cut -d '/' -f1 | rev ); done