On Fri, Apr 17, 2020 at 05:20:13AM +0200, Thomas L. wrote: > On Thu, 16 Apr 2020 19:15:08 -0700 > Andrew Hewus Fresh <and...@afresh1.com> wrote: > > Committed, thanks! Would have been nice if you had included a gem > > that wouldn't portgen before but will now, but I believe this is > > correct. > > I noted this with the activerecord gem. It seems to portgen with this, > but portgen fails to notice that activesupport is already ported as > devel/ruby-activesupport, so this is not complete. portgen creates the > Makefile below.
The problem is that ruby ports create a PKGSTEM that includes the "FLAVOR" it is using, which is the Ruby version it is using. $ cd /usr/ports/devel/ruby-activesupport && make show=PKGSTEM ruby26-activesupport One solution is to look at the "path" to the module, which is likely to be "$subdir/$prefix-$module". This would be similar to the patch I sent out a while ago that did a "glob" of /usr/ports/*/$prefix-$module looking for the correct thing. It was sadly rejected due to the a few ports not being named that way. How does this work? Index: infrastructure/lib/OpenBSD/PortGen/Utils.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Utils.pm,v retrieving revision 1.6 diff -u -p -r1.6 Utils.pm --- infrastructure/lib/OpenBSD/PortGen/Utils.pm 15 Dec 2019 00:18:04 -0000 1.6 +++ infrastructure/lib/OpenBSD/PortGen/Utils.pm 17 Apr 2020 15:41:19 -0000 @@ -62,9 +62,9 @@ sub _module_sth } ) or die "failed to connect to database: $DBI::errstr"; return $dbh->prepare(q{ - SELECT _Paths.FullPkgPath FROM _Paths + SELECT DISTINCT _Paths.FullPkgPath FROM _Paths JOIN _Ports ON _Paths.PkgPath = _Ports.FullPkgPath - WHERE PKGSTEM = ? + WHERE ( PKGSTEM = ? OR _Paths.FullPkgPath LIKE "%/" || ? ) AND _Paths.Id = _Paths.PkgPath ORDER BY LENGTH(_Paths.FullPkgPath) }); @@ -84,7 +84,7 @@ sub module_in_ports push @stems, $prefix . lc($module) if $module =~ /\p{Upper}/; foreach my $stem (@stems) { - $sth->execute($stem); + $sth->execute($stem, $stem); my ($path, @extra) = map {@$_} @{ $sth->fetchall_arrayref }; warn "Found paths other than $path: @extra\n" if @extra;