On Wed, May 7, 2025 at 14:52 H. Hartzer <h...@hartzer.sh> wrote: > > Stuart Henderson wrote: > > pkg_info -Pa > > > > One way to do it is write the pkgpaths to a file and "cd /usr/ports; > > SUBDIRLIST=/tmp/pkgpaths make fetch" (that wouldn't pull in distfiles > > for dependencies though). > > Thank you! For some reason, I had been running pkg_info -aQ 'keyword' to > search for packages. I guess the -a wasn't necessary, and I assumed it > meant all packages.
This is a common misconception and a confusing aspect of pkg_info(1)'s options and options parsing. The '-a' option[0] lists the installed packages, but can't be combined with pkg-name arguments. The '-Q' option[1] takes a substring argument and searches in only the first repository of the package search path for package names containing that substring. The important thing to note is that the first repository is the "packages/" subdirectory, which will be the -release packages (or the -current packages, if running snapshots). If you're running -release and want the search to include -stable packages (i.e. the "packages-stable/" subdirectory; which `pkg_add -u` will include), then you can add the '-a' option. Confusingly, this is _not_ the same '-a' option as mentioned above. One can't use `pkg_info -Qa substring` because the 'a' would be parsed as the substring, so one would use`pkg_info -aQ substring` to search package names for the substring (as you've been doing.) As you've also since noticed, `pkg_info -Pa` will show the pkgpath(7) for all installed packages. [0] <https://man.openbsd.org/pkg_info#a> [1] <https://man.openbsd.org/pkg_info#Q> Morgan >