Re: How to make `pkg version` work fine with private pkgbase repository

From: Lexi Winter <ivy_at_freebsd.org>
Date: Wed, 08 Oct 2025 05:04:35 UTC
Yasuhiro Kimura wrote in <20251008.135359.1026187049848325621.yasu@FreeBSD.org>:
> As is explained in pkg-version(8) man page, `pkg version` summarizies
> installed versions of packages.
>[...] 
> But it doesn't seem to work well if repostory is build with
> `make (update-)packages`
>[...] 
> root@rolling-vm-freebsd5[159]# pkg version -v -n FreeBSD-kernel-generic
> FreeBSD-kernel-generic-16.snap20251008030957 ?   orphaned: base/FreeBSD-kernel-generic

using 'pkg version -vR' makes this work.  i am not entirely sure why,
but based on the description of the -R flag in the manpage, it seems
like pkg will default to consulting /usr/ports if it's available,
rather than using the repository.  this obviously doesn't work for
base packages since they don't exist in ports.

i've noticed this issue in periodic's orphaned packages report as well.
we should probably add -R there; if you think the default value of this
option should be changed in pkg(8) as well, i'd suggest filing a PR over
there.  (that seems reasonable to me, fwiw.)

> BTW, are there any common(?) or normative(?) or official(?) terms that
> mean "package built from ports tree" and "package built from src tree"
> respectively?

i would call these "ports packages" and "base packages".  this matches
the default repository names, "FreeBSD-ports" and "FreeBSD-base".