Created
April 24, 2015 20:06
-
-
Save dagolden/9f887be78d1ce3620e2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.10; | |
use strict; | |
use warnings; | |
use IO::Zlib; | |
my $CPAN = shift || "/srv/cpan"; | |
say "Parsing 06perms..."; | |
my $fh = IO::Zlib->new( "$CPAN/modules/06perms.txt.gz", "rb" ); | |
my $inheader = 1; | |
my $perms = {}; | |
while (<$fh>) { | |
if ($inheader) { | |
$inheader = 0 if not m/ \S /x; | |
next; | |
} | |
chomp; | |
my ( $module, $author, $perm ) = split m/\s* , \s*/x; | |
push @{$perms->{$module}{maint}}, $author; | |
if ( $perm eq 'f' || $perm eq 'm' ) { | |
if ( exists $perms->{$module}{auth} ) { | |
my $o_author = $perms->{$module}{auth}; | |
my $o_perm = $perm eq 'f' ? 'm' : 'f'; | |
if ( $o_author eq $author ) { | |
say "duplicate primary on $module (same ID: $author)" | |
} | |
elsif ( $perm = 'm' ) { | |
say "duplicate primary on $module (m:$author f:$o_author)" | |
} | |
else { | |
say "duplicate primary on $module (m:$o_author f:$author)" | |
} | |
$perms->{$module}{auth} = $perm eq 'f' ? $author : $o_author; | |
} | |
else { | |
$perms->{$module}{auth} = $author; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment