Re: Another morning lost to bad ports choices (perl upgrade, plus postgres)

From: Dan Mahoney (Ports) <freebsd_at_gushi.org>
Date: Thu, 26 Oct 2023 00:44:18 UTC
On Tue, 24 Oct 2023, Dan Mahoney (Ports) wrote:

> All,
>
> I=E2=80=99ve lost another morning to a bad choice made by ports/pkg.
>
> Maybe this is a dumb question/rant, but recently, a routine pkg upgrade=
=20
> of the dayjob=E2=80=99s RT VM (which included an upgrade to perl) decided=
 to=20
> leave me with no ability to connect.  After following the rabbit hole, I=
=20
> hit a database connect error.
>
> p5-dbd-pg was still installed, according to pkg, but none of the perl=20
> libraries could find it, because it was in the wrong perl include dir=20
> (/usr/local/lib/perl5/site_perl/mach/5.32/DBD/Pg.pm, when the perl=20
> version was 5.34)
>
> Now, postgresql13 is still in pkg, still works, and according to=20
> Freshports indirectly requires postgresql13 (by way of requining libpq),=
=20
> and it still builds cleanly if you set DEFAULT_VERSIONS+=3Dpgsql=3D13 in=
=20
> make.conf,

Rather than do nothing but complain, I decided to try and submit a patch=20
to fix this problem.  (Mat, I'm cc'ing you because you're the author of=20
anything flavors-related in /usr/ports/Updating)

I had a look at Makefile for databases/p5-DBD-Pg, and while it sets=20
uses=3Dperl pgsql, I don't see a magic way to simply cause the port to be=
=20
built with all supported versions of pgsql.

I don't see anything referring to Flavors in /usr/ports/Mk/Uses/pgsql.mk

The porter's handbook is sort of lacking on this,=20
(https://docs.freebsd.org/en/books/porters-handbook/flavors/) -- it gives=
=20
specific examples for PHP and Python, but not for a port which might just=
=20
happen to have multiple available versions with USES=3D

Lines like:

"To declare a port having multiple flavors, add FLAVORS to its Makefile.=20
The first flavor in FLAVORS is the default flavor."

and:

It can help simplify the logic of the Makefile to also define FLAVOR as:
FLAVOR?=3D=09${FLAVORS:[1]}

=2E..don't give much of an example, and reading the files in /usr/ports/Mk,=
=20
are not super straightforward.

So the questions:

Is there a trick I'm missing here?

Is there not some way to auto-populate all possible flavors of a port with=
=20
supported versions of a given package in USES?  (Ala=20
FLAVORS=3D(pgsql_versions))

(If there were, an example usage for this is probably the most obvious use=
=20
case I can think of -- a simple database driver that matches a DB=20
version).

Would this require flavors knobs to be added to=20
/usr/ports/Mk/Uses/pgsql.mk?

Do I need to define each possible postgres version and ifdefine it?

Finally, should I be asking this somewhere else?

Thanks,

-Dan

--=20

--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
FB:  fb.com/DanielMahoneyIV
LI:   linkedin.com/in/gushi
Site:  http://www.gushi.org
---------------------------