From: George Koehler Subject: Re: pkg_create: @lib without LIBname_VERSION To: Marc Espie Cc: Andrew Hewus Fresh , Stuart Henderson , ports@openbsd.org Date: Fri, 21 Nov 2025 00:49:56 -0500 On Thu, 20 Nov 2025 15:16:54 +0100 Marc Espie wrote: > This does tweak Subst.pm slightly to allow it NOT to substitute > a given variable. > > That way, we parse the finished product, subst EVERYTHING but the > variable we nee, AND ensure it matches precisely what we want. Needs $k changed to \Q$k\E for variables like ${LIBestdc++_VERSION}, see below. Then, along with your devel/libtalloc diff, I can build databases/pkglocatedb on amd64. The commit order would be - devel/libtalloc - this pkg_create diff - Perl 5.42 If people upgrade base but keep an old ports tree, they will be unable to build cad/qcad or devel/libtalloc until they cvs up those ports. (I committed qcad on Tue 18 Nov.) I have not yet built libtalloc. > Index: OpenBSD/PkgCreate.pm > =================================================================== > RCS file: /vide/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 20 Nov 2025 14:15:55 -0000 > @@ -771,11 +771,13 @@ sub check_version($self, $state, $unsubs > { > my @l = $self->parse($self->name); > if (defined $l[0]) { > - if (!$unsubst =~ m/\$\{LIB$l[0]_VERSION\}/) { > - $state->error( > - "Incorrectly versioned shared library: #1", > - $unsubst); > + my $k = "LIB$l[0]_VERSION"; > + my $r = $state->{subst}->do($unsubst, $k); > + if ($r =~ m/\blib\Q$l[0]\E\.so\.\$\{$k\}$/) { With \Q$k\E, this line becomes if ($r =~ m/\blib\Q$l[0]\E\.so\.\$\{\Q$k\E\}$/) { > + return; > } > + $state->error("Incorrectly versioned shared library: #1", > + $unsubst); > } else { > $state->error("Invalid shared library #1", $unsubst); > } > @@ -1205,7 +1207,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); > } > } > Index: OpenBSD/Subst.pm > =================================================================== > RCS file: /vide/cvs/src/usr.sbin/pkg_add/OpenBSD/Subst.pm,v > diff -u -p -r1.27 Subst.pm > --- OpenBSD/Subst.pm 27 May 2025 03:42:59 -0000 1.27 > +++ OpenBSD/Subst.pm 20 Nov 2025 14:09:10 -0000 > @@ -63,11 +63,14 @@ sub parse_option($self, $opt) > } > } > > -sub do($self, $s) > +sub do($self, $s, $without = undef) > { > return $s unless $s =~ m/\$/o; # no need to subst if no $ > while ( my $k = ($s =~ m/\$\{([A-Za-z_][^\}]*)\}/o)[0] ) { > my $v = $self->{$k}; > + if (defined $without && $without eq $k) { > + $v = undef; > + } > unless ( defined $v ) { $v = "\$\\\{$k\}"; } > $s =~ s/\$\{\Q$k\E\}/$v/g; > }