You can use ports and packages simultaneously, both use the same package database in /var/db/pkg
.
Actually, packages are generated by the ports system. For example, make package
will install a port and generate the binary package for it. Also you can create a package from the currently installed port with the pkg_create -b
command.
You need to remember that pkg
and ports register installed software in the same place (an SQLite database in /var/db/pkg
). Neither system records any additional information that a particular piece of software was installed as a pre-compiled package, or as a port. Thus, once a piece of software is installed by either approach, the tools have no way of knowing how it was installed.
When you selected GTK2 support for the editors/vim
port, that was registered in the package database. When you later ran pkg upgrade
, pkg
looked at the package data for vim
, and found that GTK2 support had been enabled in the installed version, whereas it is not enabled in the pre-compiled package. pkg upgrade
is doing exactly what it should - finding any installed packages that are different from the available pre-compiled packages, and attempting to upgrade them. Those differences can be in version number, dependency graph, compile-time options, etc.
The proper way to prevent pkg
from considering a port or package (once installed, there is no difference, as far as the tools are concerned) that you want to protect is to use the pkg lock
command.
Alternatively, if you find yourself changing options on a number of ports, you might consider installing poudriere
and maintaining your own package repository. It takes a bit of setting up, and works best if your build host has a ZFS storage pool, although it will work if you don't have ZFS; it is a very flexible and convenient way to manage custom software builds.
Best Answer
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:
Example: