It's also not that tough to update portbump to use v5.40 and signatures
at the same time.  I'm not certain that all the signatures are correct,
I didn't test all the flags or paths.


Index: infrastructure/bin/portbump
===================================================================
RCS file: /cvs/ports/infrastructure/bin/portbump,v
retrieving revision 1.24
diff -u -p -r1.24 portbump
--- infrastructure/bin/portbump 21 Dec 2024 11:40:34 -0000      1.24
+++ infrastructure/bin/portbump 7 Feb 2025 23:26:41 -0000
@@ -17,31 +17,22 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 package Util;
-use strict;
-use warnings;
+use v5.40;
 
-BEGIN {
-       require Exporter;
-       our @EXPORT = qw(plibs phash w_stem);
-}
-
-sub plibs {
-       my $prefix = shift;
-       print STDERR "$prefix: ".join(", ", @_)."\n";
+sub plibs($prefix, @libs) {
+       print STDERR "$prefix: ".join(", ", @libs)."\n";
 }
 
 # prints hash in compact form, for debugging purposes
-sub phash {
-       my $h = shift;
+sub phash($h) {
        "{ ".join (", ", map {
                $_."=>".(ref($h->{$_}) eq 'HASH' ? phash($h->{$_}) : $h->{$_})
        } (sort keys %{$h})) . " }";
 }
 
-sub spc_per_tab { 8 }
+sub spc_per_tab :prototype() { 8 }
 
-sub expand_tabs {
-       my $line = shift;
+sub expand_tabs($line) {
        while ($line =~ /\t/) {
                my $pos = $-[0] + spc_per_tab - 1;
                $pos -= $pos % spc_per_tab;
@@ -50,8 +41,7 @@ sub expand_tabs {
        return $line;
 }
 
-sub w_stem {
-       my @v = @_;
+sub w_stem(@v) {
        for (@v) {
                s,^.*/,,;
                s,^([^/<>=]+)(?:[<>=].*)$,$1,;
@@ -62,10 +52,7 @@ sub w_stem {
 #################################################################
 
 package PortHandler;
-use strict;
-use warnings;
-
-BEGIN { 'Util'->import(qw(w_stem)); }
+use v5.40;
 
 # Here is a list of variables that REVISION's are usually placed
 # near to. Update if you see the "can't find a suitable place for
@@ -98,17 +85,15 @@ my @_REV_NEIGHBORS_WEAK = qw(
 );
 my $_rev_neighbors_plain_all = join('|', @_REV_NEIGHBORS, 
@_REV_NEIGHBORS_WEAK);
 
-sub run_make_in
+sub run_make_in($self, $dir, @args)
 {
-       my $self = shift;
-       my $dir = shift;
        my $pid = open(my $pipe, "-|");
        if (!defined $pid) {
                die "Couldn't start pipe: $!";
        }
        if ($pid == 0) {
                $ENV{SUBDIR}=$dir if defined $dir;
-               exec {'make'} ('make', @_);
+               exec {'make'} ('make', @args);
                exit(1);
        }
        my @lines = <$pipe>;
@@ -119,14 +104,12 @@ sub run_make_in
        return @lines;
 }
 
-sub run_make
+sub run_make($self, @args)
 {
-       my $self = shift;
-       return $self->run_make_in(undef, @_);
+       return $self->run_make_in(undef, @args);
 }
 
-sub new {
-       my ($class, $dir, $tweak_wantlib, $lib_depends_tgt) = @_;
+sub new($class, $dir, $tweak_wantlib, $lib_depends_tgt = undef) {
        die "lib depends target specified without WANTLIB tweaking"
            if !$tweak_wantlib and defined($lib_depends_tgt);
 
@@ -265,18 +248,15 @@ sub new {
        return $self;
 }
 
-sub verbose {
-       my $self = shift;
+sub verbose($self, $set = undef) {
        my $rv = $self->{verbose};
-       $self->{verbose} = $_[0] if defined $_[0];
+       $self->{verbose} = $set if defined $set;
        return $rv;
 }
 
 # Formats and returns string of "var = value" with whitespace adjustment
 # done like in the sample given line.
-sub _adj_whitespace {
-       my ($self, $var, $value, $wssample) = @_;
-       
+sub _adj_whitespace($self, $var, $value, $wssample = undef) {
        unless (defined($wssample) and
                $wssample =~ /^( *)([A-Za-z0-9_+-]+)(\s*)[\+\?\!]*=(\s*)/) {
                return "$var =\t$value";
@@ -316,9 +296,7 @@ sub _adj_whitespace {
        return $line.$value;
 }
 
-sub _is_mpkg_port {
-       my $self = shift;
-
+sub _is_mpkg_port($self) {
        for my $subpkg (keys %{$self->{mpkgs}}) {
                next if $subpkg eq "";
                next if $subpkg eq "-";
@@ -327,10 +305,8 @@ sub _is_mpkg_port {
        return 0;
 }
 
-sub _add_new_revs {
-       my ($self, $out, $lineno, $bumppkgs) = (shift, shift, shift, shift);
-
-       # Note: $lineno is the input file's line number, not output's one.
+# Note: $lineno is the input file's line number, not output's one.
+sub _add_new_revs($self, $out, $lineno, $bumppkgs) {
 
        if ($self->{maxrevsin}->{count} > 1) {
                return 0 unless $lineno == $self->{maxrevsin}->{blockend};
@@ -357,10 +333,7 @@ sub _add_new_revs {
 }
 
 # un-expand ${MOD*}
-sub _unexpand_mod_wantlib {
-       my $self = shift;
-       my @libs = @_;
-
+sub _unexpand_mod_wantlib($self, @libs) {
        for my $m (keys %{$self->{wantlib_mod}}) {
                my $nlibs = keys %{$self->{wantlib_mod}->{$m}};
                if ($nlibs == 0) {
@@ -377,10 +350,7 @@ sub _unexpand_mod_wantlib {
        return @libs;
 }
 
-sub _put_wantlib_lines {
-       my ($self, $out, $bumppkgs, $wl_add, $wl_del, $empty_line)
-           = @_;
-
+sub _put_wantlib_lines($self, $out, $bumppkgs, $wl_add, $wl_del, $empty_line) {
        my $recreate = exists $self->{wantlib_extra};
        my %wl_del_hash;
        if ($recreate) {
@@ -554,8 +524,7 @@ sub _put_wantlib_lines {
        return $nlines;
 }
 
-sub _init_wantlib {
-       my ($self, $subpkg) = @_;
+sub _init_wantlib($self, $subpkg) {
        my $rv = 0;
        if (!exists $self->{wantlib}->{$subpkg}) {
                $rv = 1;
@@ -575,9 +544,7 @@ sub _init_wantlib {
 # Search for places where new REVISION and WANTLIB marks should be added,
 # in given makefile, and with what whitespace.
 #
-sub process_makefile {
-       my ($self, $in) = (shift, shift);
-
+sub process_makefile($self, $in) {
        # subpkg => {
        #   line => number of line where subpackage is mentioned
        #   wssample => a line from block to look for whitespace sample in
@@ -805,9 +772,9 @@ sub process_makefile {
        }
 }
 
-{ my %manual_noticed;
-sub _update_shlibs {
-       my ($self, $shline) = @_;
+sub _update_shlibs($self, $shline) {
+       state %manual_noticed;
+
        my @splitres = split(/\s+/, $shline);
        my $nchanges = 0;
        if (scalar(@splitres) % 2 != 0) {
@@ -829,12 +796,10 @@ sub _update_shlibs {
                }
        }
        return $nchanges;
-} }
-
-sub update {
-       my ($self, $in, $out, $bumppkgs, $bumprevs, $removerevs, $bumpshlibs,
-           $wl_add, $wl_del) = @_;
+}
 
+sub update($self, $in, $out, $bumppkgs, $bumprevs, $removerevs, $bumpshlibs,
+           $wl_add, $wl_del) {
        if ($self->{tweak_wantlib}) {
                for my $subpkg (keys %$bumppkgs) {
                        next unless exists $bumppkgs->{$subpkg};
@@ -956,14 +921,12 @@ sub update {
 #################################################################
 
 package main;
-use strict;
-use warnings;
-use v5.14;
+use v5.40;
 
 use OpenBSD::Getopt;
 
-sub usage {
-       print join("\n", @_) if scalar @_;
+sub usage(@args) {
+       print join("\n", @args) if scalar @args;
        print STDERR
 "usage: portbump [-dMmrnv] [-o outfile] [-W lib] [-w lib] [dir ...]\n";
        exit 1;

Reply via email to