diff options
author | Peter Palfrader <peter@palfrader.org> | 2021-05-24 12:03:50 +0200 |
---|---|---|
committer | Laura Arjona Reina <larjona@debian.org> | 2021-06-04 12:59:14 +0000 |
commit | 52fbf039b8255b7eeae5f3124bb4882b3eda15ca (patch) | |
tree | 9f75b90fdfd2590485398699f040a11497324378 /english/mirror | |
parent | 170a4a30be8bcc99090ed3e5c30cc33ef8e5bc52 (diff) |
mirror/mirror_list: ignore mirrors marked internal in the Mirrors.masterlist instead of having a hardcoded regex of internal names
Diffstat (limited to 'english/mirror')
-rwxr-xr-x | english/mirror/mirror_list.pl | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/english/mirror/mirror_list.pl b/english/mirror/mirror_list.pl index 260f41c3b31..bd13beb70c4 100755 --- a/english/mirror/mirror_list.pl +++ b/english/mirror/mirror_list.pl @@ -9,14 +9,14 @@ use strict; use English; use HTML::Entities; +use List::Util qw(max); + binmode(STDOUT => ':utf8'); require 5.001; my @filter_arches=qw(); # Architectures not to list. my $officialsiteregex = q{^ftp\d?(?:\.wa)?\...\.debian\.org$}; -my $internalsiteregex = q{^((ftp|security)-master|ftp)\.debian\.org$}; - my $encode = '<>&"\''; use Getopt::Long; @@ -67,12 +67,6 @@ sub process_line { my $site = $1; $globalsite = $site; $count++; - unless ($site =~ /$internalsiteregex/) { - if (!defined($longest{site}) || length($site)+1 > $longest{site}) { - $longest{site} = length($site)+1; -# warn "increasing longest site to " . length($site) . " because of " . $site . "\n"; - } - } $mirror[$count-1]{site} = $site; $mirror[$count-1]{_lno} = $lno; return; @@ -103,7 +97,6 @@ sub process_line { $mirror[$count-1]{method}{$type} = $value; if (!defined($longest{$type}) || length($value)+1 > $longest{$type}) { $longest{$type} = length($value)+1; -# warn "increasing longest $type to " . length($value) . " because of " . $value . " at " . $globalsite . "\n" if (defined($type) && $type =~ /archive-(f|ht)tp/); } } elsif ($line =~ /^Includes:\s*(.+)\s*$/i) { @@ -115,12 +108,8 @@ sub process_line { elsif ($line =~ /^([\w-]+):\s*(.+)\s*$/s) { $field = lc $1; my $value = $2; - # no need for all private data in the %mirror hash - # XXX modified to include x-archive-architecture because - # the nsupdate thingy needs it for included-in sites - another - # possible solution would be to convert those particular ones to - # e.g. <somethingelse>-archive-architecture? - if ($field !~ /^x-/ || $field =~ /^x-archive-architecture/) { + # Ignore X-* fields + if ($field !~ /^x-/) { $mirror[$count-1]{$field} = $value; } if ($field eq 'country') { @@ -1043,6 +1032,8 @@ while (<SRC>) { if ($current ne "") { process_line($INPUT_LINE_NUMBER, $current); } +@mirror = grep { ! $_->{'internal'} } @mirror; +$longest{site} = max( map { length($_->{'site'}) + 1 } @mirror ); # Remove filtered mirrors. my @filtered; @@ -1087,7 +1078,7 @@ foreach my $country (sort keys %countries) { foreach my $id (@{ $countries{$country} }) { if ($mirror[$id]{site} =~ /$officialsiteregex/) { push @{ $countries_sorted_o{$country} }, $id; - } elsif ($mirror[$id]{site} !~ /$internalsiteregex/) { + } else { push @{ $countries_sorted_u{$country} }, $id; } # using the opportunity to add the Included-in: back-reference |