Why does pkg touch something that's clearly not installed by
pkg?
Ok, let me first repeat what others have said in this thread already:
ports are installed by
pkg(8). It's the underlying mechanism to
install them and installed ports are recorded into the package
database. There is no conceptual distinction between a package
installed from ports or a package installed from the FreeBSD package
repository.
Also unknown-repository should be a pretty good indication for pkg not to touch that package?
It would say that changing pkg's behavior on the basis of the
repository name (or lack thereof) of the
currently installed package(!) would be
insane and a POLA violation.
So in order to pkg upgrade sudo, sqlite3, firefox and curl I
have to upgrade nvidia which was clearly not part of the pkg based
installation?
pkg(8) will do its best to upgrade your system with the
available information it has. It handles package upgrades on the
basis of the configured package repositories. Since you clearly have
only setup the FreeBSD repository (or are simply using the defaults)
it will only use it to do so. A package's options can change in the
repository and
pkg(8) naturally wants to follow that change
and wants to reinstall the package.
I bet the solution to your problem would be to setup your own package
repository and point
pkg(8) to it with a higher priority than the FreeBSD one.
make package
will create a package of a port and put it
into
/usr/ports/packages (only if the directory exists,
so create it first).
pkg repo /usr/port/packages
will then
create a repository from them. And to make pkg aware of it, create
/usr/local/etc/pkg/repos/local.conf with
Code:
local: {
url: "file:///usr/ports/packages",
priority: 10,
enabled: yes
}
Now reinstall the desired packages from the local repository to make
them stick to it during upgrades (see
pkg-repository(8)):
pkg install -f -r local nvidia-driver-340 vim
It's likely that you will end up in dependency hell with this at some
point though if you don't take care to keep the local package versions
in sync with the FreeBSD repository.