Re: Package naming conventions (?)

From: parv/freebsd <parv.0zero9+freebsd_at_gmail.com>
Date: Fri, 31 Dec 2021 04:03:33 UTC
On Thu, Dec 30, 2021 at 4:51 PM Ronald F. Guilmette wrote:

> I don't know if I should file a bug report on this or not.  Feedback would
> be appreciated.
>
> There is a small problem with what appears to be the "standard" naming
> convention(s) for package names.

...

You mean a *de facto*, not a written policy, on the '"standard"' convention,
which is borne out to of package versions just happen to follow a pattern,
until now.?



> In general, full package names end with a version number which consists
> exclusively of digits, periods, commas, and underscores.


Some times there are letters too.



> Thus the
> *generalized* (non-version-specific) package names for all currently
> installed packages may, generally speaking, be derived thusly:
>
>     pkg info | awk '{print $1}' | sed -E 's/-([0-9]|,|_|\.)+$//'


You could combine all the choices in a single character class:
/-[0-9,_.]+$/.



> (I am not aware of any easier way to generate such a list of the base names
> of all currently installed packages.  If I have just missed how to do that
> more easily, please let me know.)


Check out "raw" output via '--raw' option of pkg-info(8); note the "name"
field. There may be some incantation for pkg-query(8) to obtain the
information
more directly.


...

> So, what say you all?  Is this a bug or a feature?
>
...

Neither a bug, nor a feature; you might have assumed too much.


- parv

--