portroach doesn't reliably use the site handler for cpan, various ports
(notably those with Foo-Bar-v1.23 format distfile names) fallback to
directory listing. For example see the "L" instead of "S" for
p5-Sys-Virt in
https://portroach.openbsd.org/antoine%20jacoutot%20%3cajacou...@openbsd.org%3E.html

Also the "is this site handled by this" regex doesn't cover some URL
formats (though afaict as long as one of the various MASTER_SITES
entries matches, it looks like it does pick it up anyway).

I think this diff should help but it's not tested. Is there any good way
to test portroach without setting up a full installation and having it
fetch a list of URLs the size of 45 aardvarks?



Index: Makefile
===================================================================
RCS file: /cvs/ports/misc/portroach/Makefile,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile
--- Makefile    11 Mar 2022 19:38:17 -0000      1.36
+++ Makefile    20 Jul 2023 09:16:06 -0000
@@ -3,7 +3,7 @@ COMMENT=                OpenBSD ports distfile version
 GH_ACCOUNT=            jasperla
 GH_PROJECT=            portroach
 GH_TAGNAME=            2.0.11
-REVISION =             3
+REVISION=              4
 
 CATEGORIES=            misc
 
Index: patches/patch-Portroach_SiteHandler_CPAN_pm
===================================================================
RCS file: 
/cvs/ports/misc/portroach/patches/patch-Portroach_SiteHandler_CPAN_pm,v
retrieving revision 1.4
diff -u -p -r1.4 patch-Portroach_SiteHandler_CPAN_pm
--- patches/patch-Portroach_SiteHandler_CPAN_pm 11 Mar 2022 19:38:17 -0000      
1.4
+++ patches/patch-Portroach_SiteHandler_CPAN_pm 20 Jul 2023 09:16:06 -0000
@@ -1,8 +1,20 @@
+not yet upstream: first hunk, addition of v? in second hunk
+
+other parts in
 
https://github.com/jasperla/portroach/commit/6c856d0fe68e17c6d8de9aa2ad730bdf45fb1778
 
 Index: Portroach/SiteHandler/CPAN.pm
 --- Portroach/SiteHandler/CPAN.pm.orig
 +++ Portroach/SiteHandler/CPAN.pm
+@@ -73,7 +73,7 @@ sub CanHandle
+ 
+       my ($url) = @_;
+ 
+-      return ($url =~ /(http|ftp):\/\/(.*?)\/CPAN\/modules\//);
++      return ($url =~ 
/(https?|ftp):\/\/(.*?\/CPAN|[a-z\.]*\.(meta)?cpan\.org)\/modules\//);
+ }
+ 
+ 
 @@ -96,14 +96,14 @@ sub GetFiles
        my ($url, $port, $files) = @_;
  
@@ -11,7 +23,8 @@ Index: Portroach/SiteHandler/CPAN.pm
 +      $metacpan = 'https://fastapi.metacpan.org/v1/release/';
  
        # Strip all the digits at the end to keep the stem of the module.
-       if ($port->{distname} =~ /(.*?)-(\d+)/) {
+-      if ($port->{distname} =~ /(.*?)-(\d+)/) {
++      if ($port->{distname} =~ /(.*?)-(v?\d+)/) {
            $module = $1;
        }
  

Reply via email to