I mostly use packages on FreeBSD, because most of them suit me just fine. Some don't suit me, however, like the vim
package, which does not include a graphical gvim
.
No problem. I can install the port instead, using portmaster editors/vim
and selecting the GTK2
option. This works fine.
However, when I run pkg upgrade
after a while, I am presented with the following:
Reinstalling vim-7.4.110_3 (options changed)
What gives? I didn't change any options, and there is no new version (not in ports, either). Is it comparing my installed port to the remote version without GTK2
?
Of course I can let pkg upgrade
do its work and install the port again afterward, but this is stupid. What is the recommended way to update a mix of packages and ports?
Best Answer
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 ranpkg upgrade
,pkg
looked at the package data forvim
, 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 thepkg 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.