On Thu, Sep 07, 2023 at 02:03:18PM +0200, Antoine Jacoutot wrote:
> On Thu, Sep 07, 2023 at 12:24:59PM +0200, Marc Espie wrote:
> > I've been perusing the results of the build, they aren't good, then
> > again portroach isn't quite grabbing the right stuff.
> > 
> > - tweak the meter to use shorter xxxxx/xxxxx so that it fits again on the 
> > line.
> > 
> > - use fullpkgname instead of distname because that one is *always* defined.
> > (and strip v/p accordingly)
> > 
> > - switch to roach_url/roach_sites
> > 
> > - use the portsq cached table instead of the view (this goes MUCH faster
> > not surprisingly)
> > 
> > this does require an up-to-date sqlports.
> > 
> > Long term, it would be appropriate to create a temp view based on portsq
> > that contains all required fields with sensible names, so that it's
> > less painful to rename stuff in every individual query.
> > 
> > I haven't run the check, since this probably requires setting up PgSql
> > for maximum efficiency.
> 
> I'll try that on my next run.


Seems to work ok.



> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/misc/portroach/Makefile,v
> > retrieving revision 1.37
> > diff -u -p -r1.37 Makefile
> > --- Makefile        21 Jul 2023 10:57:10 -0000      1.37
> > +++ Makefile        7 Sep 2023 10:19:41 -0000
> > @@ -3,7 +3,7 @@ COMMENT=            OpenBSD ports distfile version
> >  GH_ACCOUNT=                jasperla
> >  GH_PROJECT=                portroach
> >  GH_TAGNAME=                2.0.11
> > -REVISION=          4
> > +REVISION=          5
> >  
> >  CATEGORIES=                misc
> >  
> > Index: patches/patch-Portroach_DataSrc_Ports_pm
> > ===================================================================
> > RCS file: patches/patch-Portroach_DataSrc_Ports_pm
> > diff -N patches/patch-Portroach_DataSrc_Ports_pm
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-Portroach_DataSrc_Ports_pm        7 Sep 2023 10:19:41 
> > -0000
> > @@ -0,0 +1,23 @@
> > +Index: Portroach/DataSrc/Ports.pm
> > +--- Portroach/DataSrc/Ports.pm.orig
> > ++++ Portroach/DataSrc/Ports.pm
> > +@@ -217,6 +217,10 @@ sub BuildPort
> > +   $name     = fullpkgpathtoport($fullpkgpath);
> > + 
> > +   $distname = $ports[2];
> > ++  # get rid of version/epoch markers
> > ++  $distname =~ s/v[0-9]+$//;
> > ++  $distname =~ s/p[0-9]+$//;
> > ++
> > +   foreach my $file (split /\s+/, $ports[3]) {
> > +       $file =~ s/:[A-Za-z0-9][A-Za-z0-9\,]*$//g;
> > +       push @distfiles, $file;
> > +@@ -305,7 +309,7 @@ sub BuildPort
> > +           }
> > +   }
> > + 
> > +-  info(1, $fullpkgpath, "($n_port out of $total_ports)");
> > ++  info(1, $fullpkgpath, "($n_port/$total_ports)");
> > + 
> > +   $ps->AddPort({
> > +       'name'        => $name,
> > Index: patches/patch-Portroach_SQL_pm
> > ===================================================================
> > RCS file: /cvs/ports/misc/portroach/patches/patch-Portroach_SQL_pm,v
> > retrieving revision 1.4
> > diff -u -p -r1.4 patch-Portroach_SQL_pm
> > --- patches/patch-Portroach_SQL_pm  11 Mar 2022 19:38:17 -0000      1.4
> > +++ patches/patch-Portroach_SQL_pm  7 Sep 2023 10:19:41 -0000
> > @@ -1,6 +1,81 @@
> >  Index: Portroach/SQL.pm
> >  --- Portroach/SQL.pm.orig
> >  +++ Portroach/SQL.pm
> > +@@ -73,49 +73,49 @@ $sql{portdata_update} =
> > + 
> > + # Port.pm:BuildPort()
> > + $sql{ports_select} =
> > +-    q(SELECT fullpkgpath, categories, distname, distfiles,
> > +-             master_sites, maintainer, comment, portroach,
> > ++    q(SELECT fullpkgpath, categories, fullpkgname, roach_url,
> > ++             roach_sites, maintainer, comment, portroach,
> > +        portroach_comment, homepage
> > +-        FROM ports);
> > ++        FROM portsq);
> > + 
> > + $sql{ports_select_count} =
> > +     q(SELECT COUNT(fullpkgpath)
> > +-        FROM ports);
> > ++        FROM portsq);
> > + 
> > + $sql{ports_restrict_maintainer} =
> > +-    q(SELECT fullpkgpath, categories, distname, distfiles,
> > +-             master_sites, maintainer, comment, portroach,
> > ++    q(SELECT fullpkgpath, categories, fullpkgname, roach_url,
> > ++             roach_sites, maintainer, comment, portroach,
> > +              portroach_comment, homepage
> > +-        FROM ports
> > ++        FROM portsq
> > +        WHERE maintainer like ?);
> > + 
> > + $sql{ports_restrict_maintainer_count} =
> > +     q(SELECT COUNT(fullpkgpath)
> > +-        FROM ports
> > ++        FROM portsq
> > +        WHERE maintainer like ?);
> > + 
> > + $sql{ports_restrict_category} =
> > +-    q(SELECT fullpkgpath, categories, distname, distfiles,
> > +-             master_sites, maintainer, comment, portroach,
> > ++    q(SELECT fullpkgpath, categories, fullpkgname, roach_url,
> > ++             roach_sites, maintainer, comment, portroach,
> > +              portroach_comment, homepage
> > +-        FROM ports
> > ++        FROM portsq
> > +        WHERE categories like ?);
> > + 
> > + $sql{ports_restrict_category_count} =
> > +     q(SELECT COUNT(fullpkgpath)
> > +-        FROM ports
> > ++        FROM portsq
> > +        WHERE categories like ?);
> > + 
> > + $sql{ports_restrict_port} =
> > +-    q(SELECT fullpkgpath, categories, distname, distfiles,
> > +-             master_sites, maintainer, comment, portroach,
> > ++    q(SELECT fullpkgpath, categories, fullpkgname, roach_url,
> > ++             roach_sites, maintainer, comment, portroach,
> > +              portroach_comment, homepage
> > +-        FROM ports
> > ++        FROM portsq
> > +        WHERE fullpkgpath like ?);
> > + 
> > + $sql{ports_restrict_port_count} =
> > +     q(SELECT COUNT(fullpkgpath)
> > +-        FROM ports
> > ++        FROM portsq
> > +        WHERE fullpkgpath like ?);
> > + 
> > + $sql{portdata_insert} =
> > +@@ -127,7 +127,7 @@ $sql{portdata_insert} =
> > + 
> > + $sql{sqlports_fullpkgpaths_by_maintainer} =
> > +     q(SELECT fullpkgpath
> > +-  FROM Ports
> > ++  FROM Portsq
> > +   WHERE MAINTAINER LIKE ?);
> > + 
> > + $sql{sqlports_count_ports} =
> >  @@ -311,7 +311,7 @@ $sql{portdata_fullpkgpaths} =
> >     FROM portdata);
> >   
> > Index: patches/patch-Portroach_Util_pm
> > ===================================================================
> > RCS file: patches/patch-Portroach_Util_pm
> > diff -N patches/patch-Portroach_Util_pm
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-Portroach_Util_pm 7 Sep 2023 10:19:41 -0000
> > @@ -0,0 +1,12 @@
> > +Index: Portroach/Util.pm
> > +--- Portroach/Util.pm.orig
> > ++++ Portroach/Util.pm
> > +@@ -652,7 +652,7 @@ sub info
> > +   my @items = (@_);
> > +   my ($str, $msg);
> > + 
> > +-  # 60 is chosen as 80 - length of "(xxxx out of xxxx)" (16)" - 
> > separators.
> > ++  # 60 is chosen so that "(xxxxx/xxxxx)" will fit
> > +   my $width = 30;
> > +   $width *= 2 if $full;
> > + 
> 
> -- 
> Antoine
> 

-- 
Antoine

Reply via email to