6

I have a headless FreeBSD server where some port has installed tons of X11-related packages. I would like to find out what these ports are so I can get rid of the unwanted X-related packages. Is there a way to figure this out?

7

The current accepted answer is out of date. FreeBSD has replaced its legacy packaging tools with pkgng.

Here's the new way to query the reverse-dependencies of a package:

pkg info -r <pkg name>

Example:

root@server:/usr/ports # pkg info -r python27
python27-2.7.6_4:
        python2-2_2
        talloc-2.0.8
        tevent-0.9.18
        tdb-1.2.12,1
        ldb-1.1.16
        glib-2.36.3_2
        xcb-proto-1.9
        gobject-introspection-1.36.0_2
        samba4-4.0.13
4

pkg_info answers questions like this. With the -R option it expects a name of an installed port and will display all ports that depend on that port:

pkg_info -R libXfont-1.4.3,1

You can use wildcards to avoid specifying the name with the version number:

pkg_info -R libXfont-\*

Note that this does not work recursively, and thus you need to do pkg_info -R again for each port in the resulting list until you get to the bottom of things.

Note that on servers it is often a good idea to put the following in /etc/make.conf:

WITHOUT_X11=yes

That will make most (all?) ports to skip dependencies to any X11 related stuff.

  • @ChinmayKanchi: In this community proper etiquette for expressing thanks is to upvote and accept answers. Since everything is kept as a permanent archive of question/answer pairs you don't need to clutter things up with thank you notes. Comments should only be used to add to or discuss the content of posts. – Caleb Aug 7 '11 at 7:08
0

While accepted answer is correct, there is a more robust and feature-rich variant that can provide you with more flexibility:

# pkg query %ro python27
misc/mc
devel/talloc
lang/python2
lang/python
devel/git
devel/tevent
databases/tdb
devel/py-setuptools
dns/py-dnspython
devel/py-iso8601
net/samba48

That would give you reverse dependencies for the locally installed ports. In some cases you may want to list ALL the existing dependencies on that port, in that case pkg rquery can give you that information:

# pkg rquery %ro python27|wc -l
    3758

Please consult man pkg-query for the full list of possible query flags, those should work for pkg-rquery as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.