Skip to content

Commit 2fd8305

Browse files
authored
Merge pull request #1184 from metacpan/haarg/pumpkin
set authorized flag for perl releases based on pumpking list
2 parents 22417c5 + 723b8c1 commit 2fd8305

File tree

3 files changed

+91
-13
lines changed

3 files changed

+91
-13
lines changed

lib/MetaCPAN/Document/File.pm

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -959,19 +959,27 @@ as unauthorized as well.
959959
sub set_authorized {
960960
my ( $self, $perms ) = @_;
961961

962-
# only authorized perl distributions make it into the CPAN
963-
return () if ( $self->distribution eq 'perl' );
964-
foreach my $module ( @{ $self->module } ) {
965-
$module->_set_authorized(0)
966-
if ( $perms->{ $module->name } && !grep { $_ eq $self->author }
967-
@{ $perms->{ $module->name } } );
962+
if ( $self->distribution eq 'perl' ) {
963+
my $allowed = grep $_ eq $self->author, @{ $perms->{perl} };
964+
foreach my $module ( @{ $self->module } ) {
965+
$module->_set_authorized($allowed);
966+
}
967+
$self->_set_authorized($allowed);
968+
}
969+
else {
970+
foreach my $module ( @{ $self->module } ) {
971+
$module->_set_authorized(0)
972+
if ( $perms->{ $module->name }
973+
&& !grep { $_ eq $self->author }
974+
@{ $perms->{ $module->name } } );
975+
}
976+
$self->_set_authorized(0)
977+
if ( $self->authorized
978+
&& $self->documentation
979+
&& $perms->{ $self->documentation }
980+
&& !grep { $_ eq $self->author }
981+
@{ $perms->{ $self->documentation } } );
968982
}
969-
$self->_set_authorized(0)
970-
if ( $self->authorized
971-
&& $self->documentation
972-
&& $perms->{ $self->documentation }
973-
&& !grep { $_ eq $self->author }
974-
@{ $perms->{ $self->documentation } } );
975983
return grep { !$_->authorized && $_->indexed } @{ $self->module };
976984
}
977985

lib/MetaCPAN/Script/Release.pm

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use MetaCPAN::Script::Runner ();
1414
use MetaCPAN::Types::TypeTiny qw( Bool HashRef Int Str );
1515
use Moose;
1616
use PerlIO::gzip;
17-
use Try::Tiny qw( catch try );
17+
use Try::Tiny qw( catch try );
18+
use Path::Tiny qw(path);
1819

1920
with 'MetaCPAN::Role::Script', 'MooseX::Getopt',
2021
'MetaCPAN::Script::Role::Contributor';
@@ -431,6 +432,24 @@ sub _build_perms {
431432
}
432433
close $fh;
433434
}
435+
436+
# we would like this data to come from CPAN directly eventually
437+
#my $pumpking_file = $self->cpan->child(qw(modules 07pumpkings.txt));
438+
my $pumpking_file
439+
= path(__FILE__)->parent->child(qw(Release 07pumpkings.txt));
440+
if ( -e $pumpking_file ) {
441+
log_debug { "parsing ", $pumpking_file };
442+
my $fh = $pumpking_file->openr;
443+
while ( my $line = <$fh> ) {
444+
chomp $line;
445+
push( @{ $authors{perl} ||= [] }, $line );
446+
}
447+
close $fh;
448+
}
449+
else {
450+
log_warn {"$pumpking_file could not be found."};
451+
}
452+
434453
return \%authors;
435454
}
436455

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
ABH
2+
ABIGAIL
3+
ANDYD
4+
ARISTOTLE
5+
ATOOMIC
6+
AVAR
7+
BINGOS
8+
CHIPS
9+
CORION
10+
DAGOLDEN
11+
DAPM
12+
DOM
13+
DOY
14+
DROLSKY
15+
EHERMAN
16+
ETHER
17+
EXODIST
18+
FLORA
19+
GBARR
20+
GENEHACK
21+
GSAR
22+
HAARG
23+
HVDS
24+
HYDAHY
25+
JESSE
26+
JHI
27+
LBROCARD
28+
LEONT
29+
LWALL
30+
MICB
31+
MIYAGAWA
32+
MSTROUT
33+
NEILB
34+
NI-S
35+
NWCLARK
36+
PCM
37+
PEVANS
38+
RENEEB
39+
RGARCIA
40+
RJBS
41+
SHAY
42+
STEVAN
43+
TIMB
44+
TODDR
45+
TOMHUKINS
46+
TONYC
47+
WOLFSAGE
48+
XSAWYERX
49+
YVES
50+
ZAKAME
51+
ZEFRAM

0 commit comments

Comments
 (0)