2 Commits 536757e8e2 ... 104a1395e7

Author SHA1 Message Date
  Alex Schroeder 104a1395e7 ban-contributors: use Net::IP to parse CIDR 3 years ago
  Alex Schroeder ceb4c3a9cc Release process: master → main 3 years ago
2 changed files with 7 additions and 5 deletions
  1. 3 1
      modules/ban-contributors.pl
  2. 4 4
      stuff/release

+ 3 - 1
modules/ban-contributors.pl

@@ -171,6 +171,7 @@ sub NewBanContributorsWriteRcLog {
 
 package BanContributors;
 use Net::Whois::Parser qw/parse_whois/;
+use Net::IP;
 
 sub get_range {
   my $ip = shift;
@@ -181,7 +182,8 @@ sub get_range {
     my @result;
     $_ = $response->{$_};
     for (ref eq 'ARRAY' ? @$_ : $_) {
-      push(@result, $1, $2) if /($re) *- *($re)/;
+      $ip = Net::IP->new($_);
+      push(@result, $ip->ip, $ip->last_ip) if $ip;
     }
     return @result if @result;
   }

+ 4 - 4
stuff/release

@@ -33,7 +33,7 @@ EOT
 
 my $min = version->parse(shift || "2.3.0");
 
-my @tags = grep { /(\d+\.\d+\.\d+)/ and version->parse($1) >= $min } 
+my @tags = grep { /(\d+\.\d+\.\d+)/ and version->parse($1) >= $min }
            split(/\n/, qx{git tag --list});
 
 unless (@tags) {
@@ -47,7 +47,7 @@ for my $tag (@tags) {
     next;
   }
   print "Preparing $tag\n";
-  
+
   system("git", "checkout", $tag) == 0
       or die "Failed to git checkout $tag\n";
   system("make", "prepare") == 0
@@ -62,5 +62,5 @@ for my $tag (@tags) {
       or die "Failed to remove the directory oddmuse-$tag\n";
 }
 
-system("git", "checkout", "master") == 0
-    or die "Failed to git checkout master\n";
+system("git", "checkout", "main") == 0
+    or die "Failed to git checkout main\n";