On Tue, 24 Oct 2023, Dan Mahoney (Ports) wrote:
All,
I’ve lost another morning to a bad choice made by ports/pkg.
Maybe this is a dumb question/rant, but recently, a routine pkg upgrade
of the dayjob’s RT VM (which included an upgrade to perl) decided to
leave me with no ability to connect. After following the rabbit hole, I
hit a database connect error.
p5-dbd-pg was still installed, according to pkg, but none of the perl
libraries could find it, because it was in the wrong perl include dir
(/usr/local/lib/perl5/site_perl/mach/5.32/DBD/Pg.pm, when the perl
version was 5.34)
Now, postgresql13 is still in pkg, still works, and according to
Freshports indirectly requires postgresql13 (by way of requining libpq),
and it still builds cleanly if you set DEFAULT_VERSIONS+=pgsql=13 in
make.conf,
Rather than do nothing but complain, I decided to try and submit a patch
to fix this problem. (Mat, I'm cc'ing you because you're the author of
anything flavors-related in /usr/ports/Updating)
I had a look at Makefile for databases/p5-DBD-Pg, and while it sets
uses=perl pgsql, I don't see a magic way to simply cause the port to be
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,
(https://docs.freebsd.org/en/books/porters-handbook/flavors/) -- it gives
specific examples for PHP and Python, but not for a port which might just
happen to have multiple available versions with USES=
Lines like:
"To declare a port having multiple flavors, add FLAVORS to its Makefile.
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?= ${FLAVORS:[1]}
...don't give much of an example, and reading the files in /usr/ports/Mk,
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
supported versions of a given package in USES? (Ala
FLAVORS=(pgsql_versions))
(If there were, an example usage for this is probably the most obvious use
case I can think of -- a simple database driver that matches a DB
version).
Would this require flavors knobs to be added to
/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
--
--------Dan Mahoney--------
Techie, Sysadmin, WebGeek
Gushi on efnet/undernet IRC
FB: fb.com/DanielMahoneyIV
LI: linkedin.com/in/gushi
Site: http://www.gushi.org
---------------------------