pkg_info -Q confusion

2023-04-14 Thread Mike Fischer
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).


Is this working as intended?

Is there a better way to look for available packages?


Thanks!
Mike



Re: pkg_info -Q confusion

2023-04-14 Thread Stuart Henderson
On 2023-04-14, Mike Fischer  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 : - 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.




Re: pkg_info -Q confusion

2023-04-14 Thread Mike Fischer
Inline…

> Am 14.04.2023 um 12:50 schrieb Stuart Henderson :
> 
> On 2023-04-14, Mike Fischer  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.

Ah, I see. Indeed I didn’t realise that was meant by the statement.


> 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

Ok, thanks. Not very comfortable but at least a possibility.


> 
>> Is this working as intended?
> 
> Yes though it's a little unfriendly.

Yep!


> 
>> Is there a better way to look for available packages?
> 
> I never found pkg_info -Q to be a useful tool.

Up to now I never had an issue. But I never noticed this limitation before. (I 
did notice the lack of being able to search for partial package names but I 
have gotten used to that.)


> Try pkglocate instead ("pkg_add pkglocatedb" first) which allows
> searching on an index that is built from : - 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.

Very helpful!

Thanks Stuart!

Mike



Re: pkg_info -Q confusion

2023-04-14 Thread Allan Streib
On Fri, Apr 14, 2023, at 05:50, Stuart Henderson wrote:
> 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 : - as a
> result it lets you do a substring match on package names, not just
> on filenames.

Also, as mentioned in packages(7) man page, there is a site at
https://openports.pl/ that can be used, though obviously that requires
internet access so may not be appropriate for all cases. I tend to
use it a lot, personally.



Re: pkg_info -Q confusion

2023-04-14 Thread Mike Fischer


> Am 14.04.2023 um 18:24 schrieb Allan Streib :
> 
> On Fri, Apr 14, 2023, at 05:50, Stuart Henderson wrote:
>> 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 : - as a
>> result it lets you do a substring match on package names, not just
>> on filenames.
> 
> Also, as mentioned in packages(7) man page, there is a site at
> https://openports.pl/ that can be used, though obviously that requires
> internet access so may not be appropriate for all cases. I tend to
> use it a lot, personally.

It does not seem to differentiate between different OpenBSD versions or 
architectures though?

I’m generally interested in what is available for the exact machine I am 
running on. But I guess at least knowing that there is a port for some version 
on some platform might be helpful — at least the inverse means I can stop 
looking now ;-)


But still thanks for reminding me of this site. I had forgotten about that.

Mike



Re: pkg_info -Q confusion

2023-04-15 Thread Antun Matanović
> I'm generally interested in what is available for the exact machine I am 
> running on.

You could use `pkg_info -a -Q` which searches all the repositories.
>From the pkg_info man page:
 -Q substring
 Show the names of all packages in the first repository of the
 package search path containing the substring in the stems of
 their package names.  A stem is a package name with all version
 and flavor suffixes removed; see pkg_add(1) for more details on
 stems.  If -a is also specified, show the names of all matching
 packages in all repositories instead.



Re: pkg_info -Q confusion

2023-04-15 Thread Mike Fischer


> Am 15.04.2023 um 23:44 schrieb Antun Matanović :
> 
>> I'm generally interested in what is available for the exact machine I am 
>> running on.
> 
> You could use `pkg_info -a -Q` which searches all the repositories.
>> From the pkg_info man page:
> -Q substring
> Show the names of all packages in the first repository of the
> package search path containing the substring in the stems of
> their package names.  A stem is a package name with all version
> and flavor suffixes removed; see pkg_add(1) for more details on
> stems.  If -a is also specified, show the names of all matching
> packages in all repositories instead.

So simple and so perfect! Thanks for that hint.

I’ll still keep pkglocate around for more complicated partial name searches but 
for most of my use cases pkg_info -aQ name is exactly what I need.

Mike