Index | Thread | Search

From:
George Koehler <kernigh@gmail.com>
Subject:
Re: pkg_create: @lib without LIBname_VERSION
To:
Marc Espie <marc.espie.openbsd@gmail.com>
Cc:
ports@openbsd.org
Date:
Mon, 10 Nov 2025 14:47:05 -0500

Download raw body.

Thread
On Sat, 8 Nov 2025 17:48:22 +0100
Marc Espie <marc.espie.openbsd@gmail.com> wrote:

> If you wonder whether it should be @so's with no version at all or @lib 
> libraries, that's a secondary concern, imo. Make sure everything
> that says "@lib" has a corresponding SHARED_LIBS, then you can
> decide what you want to do.

This diff checks that each @lib has a LIBname_VERSION, but doesn't
look for '${LIBname_VERSION}'.  This works with all ports but
devel/qcad when I tried "make print-plist-all >/dev/null".  It works
with devel/libtalloc where make(1) expands a version variable before
pkg_create(1) can see it,

devel/libtalloc/Makefile:
PYTALLOC_UTIL_LIBSUFFIX=	cpython-${MODPY_MAJORMINOR}.so.${LIBpytalloc-util.cpython-${MODPY_MAJORMINOR}_VERSION}
devel/libtalloc/pkg/PLIST-python:
@lib lib/libpytalloc-util.${PYTALLOC_UTIL_LIBSUFFIX}

Is this ok?

I can't commit until devel/qcad is fixed (or marked broken), but qcad
is only one port, so I'll try to fix it after I send this mail.
--gkoehler

Index: OpenBSD/PkgCreate.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm,v
diff -u -p -r1.200 PkgCreate.pm
--- OpenBSD/PkgCreate.pm	15 Sep 2025 01:59:37 -0000	1.200
+++ OpenBSD/PkgCreate.pm	10 Nov 2025 19:39:38 -0000
@@ -771,7 +771,8 @@ sub check_version($self, $state, $unsubs
 {
 	my @l  = $self->parse($self->name);
 	if (defined $l[0]) {
-		if (!$unsubst =~ m/\$\{LIB$l[0]_VERSION\}/) {
+		my $version = $state->{subst}->value("LIB$l[0]_VERSION");
+		if (!defined($version) || $version ne "$l[1].$l[2]") {
 			$state->error(
 			    "Incorrectly versioned shared library: #1", 
 			    $unsubst);
@@ -1205,7 +1206,7 @@ sub read_fragments($self, $state, $plist
 	# XXX some things, like @comment no checksum, don't produce an object
 				my $o = &$cont($s);
 				if (defined $o) {
-					$o->check_version($state, $s);
+					$o->check_version($state, $l);
 					$self->annotate($o, $l, $file);
 				}
 			}