Package naming conventions (?)

From: Ronald F. Guilmette <rfg_at_tristatelogic.com>
Date: Fri, 31 Dec 2021 02:50:03 UTC
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.  Specifically, something less than 100%
of all packages seem to follow the obvious naming convention(s), and this
has caused me some minor grief.

In general, full package names end with a version number which consists
exclusively of digits, periods, commas, and underscores.  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]|,|_|\.)+$//' 

(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.)

Anyway, the above command pipeline yields a list of the base names of all
installed packages with the exception of a small number of packages that
do not conform to the "standard" (lexical structure) naming conventions
for full package names, specifically, these ones:

        fstrcmp-0.7.D001
        drm-kmod-g20190710_1
        drm-fbsd13-kmod-5.4.144.g20211013

(This is only a list of the full packages names that I am aware of that fail
to follow the standard naming conventions.  There may be others.)

Why is this an issue?  Here's why...

I just did a fresh install of 13.0-STABLE.  After that I did:

    pkg install `cat my.desired.pkgs`

where my.desired.pkgs is the name of a file containing the base names of all
of the packages that I routinely use and want installed, e.g.:

	firefox
	gimp
	gthumb
	...
	etc.

After allowing the "pkg install" command to run to completion (while I had
dinner) I wanted to verify that, in fact, all of the packages that I had
asked to have installed did in fact get installed.

If it were not for the occasional goofy/non-normal full package names
mentioned above, this would have been a simple matter of just doing the
following:

    pkg info | awk '{print $1}' | sed -E 's/-([0-9]|,|_|\.)+$//' > my.inst.pkgs
    comm -23 my.desired.pkgs my.inst.pkgs

That would have / should have yielded a list of just those packages that
I had wanted to get installed, but that for some reason did not in fact
get installed.

Unfortunately, due to the problem with there being less than 100% of all
full package names following the "standard" lexical structure of the vast
majority of all package names, the above pair of commands yielded a list
of not just the packages that failed to install successfully, but also
the goofy/non-normal package names mentioned above.

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

Maybe I just have a fetish for adherence to obvious conventions, but this
does annoy me.  And it clearly doesn't have to be this way.


Regards,
rfg