On 2023-04-14, Mike Fischer <[email protected]> wrote:
> Usually when looking for a port to install I  use `pkg_info -Q name` to 
> search for the the port.
>
> Strangely this does not completely work for PHP on OpenBSD 7.3:
>
> `pkg_info -Q php` does not list PHP 7.4.33 and related ports which are 
> clearly available.
>
> It seems that -Q only finds ports in packages-stable/, not packages/?
> 
> pkg_info(1) does not seem to mention this limitation (or I have missed it).

That's what is meant by "in the first repository of the package search
path" but it's not very obvious.

If PKG_PATH is not set and you're on a release version, the
pkg_add-based tools (including pkg_info) construct one starting with
the packages-stable directory, in order that -stable updates are
preferred over release packages. This is (mostly) described in
pkg_add(1).

You can search just the release packages with

PKG_PATH=http://cdn.openbsd.org/pub/OpenBSD/%v/packages/%a/ pkg_info -Q php

> Is this working as intended?

Yes though it's a little unfriendly.

> Is there a better way to look for available packages?

I never found pkg_info -Q to be a useful tool.

Try pkglocate instead ("pkg_add pkglocatedb" first) which allows
searching on an index that is built from <pkgname>:<filename> - as a
result it lets you do a substring match on package names, not just
on filenames.

For a package which includes many files you'll get a lot of output
lines, so something like "pkglocate moo | cut -d: -f1 | uniq" maybe
useful, or "pkglocate moo | grep ^moo".

And if you're looking for the package containing a particular
binary, "pkglocate bin/moo" cuts out a lot of the useless stuff.


Reply via email to