Hi,

module_in_ports() uses a SQL statement to get the pkgpath from a
pkgstem:
            SELECT _Paths.FullPkgPath FROM _Paths
              JOIN _Ports ON _Paths.PkgPath = _Ports.FullPkgPath
             WHERE PKGSTEM = ?
               AND _Paths.Id = _Paths.PkgPath
             ORDER BY LENGTH(_Paths.FullPkgPath);
I think the _Paths.Id = _Paths.PkgPath condition is to get the pkgpath
without flavor. This works when the situation is like this (one of the
entries in _ports references the pkgpath without flavor):
  sqlite> select pkgstem, fullpkgpath from _ports where pkgstem like 
'ruby%-mini_mime';
  ruby26-mini_mime|6253
  ruby25-mini_mime|12043
  ruby27-mini_mime|12047
  sqlite> select id, fullpkgpath, pkgpath from _paths where fullpkgpath like 
'%ruby-mini_mime%';
  6253|mail/ruby-mini_mime|6253
  6254|mail/ruby-mini_mime,ruby26|6253
  12043|mail/ruby-mini_mime,ruby25|6253
  12047|mail/ruby-mini_mime,ruby27|6253
... but not if it is like this (all entries in _ports reference pkgpaths
with flavor):
  sqlite> select pkgstem, fullpkgpath from _ports where pkgstem like 
'ruby%-gpgme';
  ruby25-gpgme|9007
  ruby26-gpgme|1666
  ruby27-gpgme|9008
  sqlite> select id, fullpkgpath, pkgpath from _paths where fullpkgpath like 
'%ruby-gpgme%';
  1665|security/ruby-gpgme|1665
  1666|security/ruby-gpgme,ruby26|1665
  9007|security/ruby-gpgme,ruby25|1665
  9008|security/ruby-gpgme,ruby27|1665
I propose the patch below to get the pkgpath without flavor in either case.

Kind regards,

Thomas

diff --git infrastructure/lib/OpenBSD/PortGen/Utils.pm 
infrastructure/lib/OpenBSD/PortGen/Utils.pm
index 16f901a3c9d..0dc18d0a592 100644
--- infrastructure/lib/OpenBSD/PortGen/Utils.pm
+++ infrastructure/lib/OpenBSD/PortGen/Utils.pm
@@ -62,10 +62,10 @@ sub _module_sth
        } ) or die "failed to connect to database: $DBI::errstr";

        return $dbh->prepare(q{
-           SELECT _Paths.FullPkgPath FROM _Paths
-             JOIN _Ports ON _Paths.PkgPath = _Ports.FullPkgPath
+           SELECT _PkgPaths.FullPkgPath FROM _Paths AS _PkgPaths
+             JOIN _Paths ON _Paths.PkgPath = _PkgPaths.Id
+             JOIN _Ports ON _Ports.FullPkgPath = _Paths.Id
             WHERE PKGSTEM = ?
-              AND _Paths.Id = _Paths.PkgPath
             ORDER BY LENGTH(_Paths.FullPkgPath)
        });
 }

Reply via email to