line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::PAUSE::CheckPerms; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$App::PAUSE::CheckPerms::VERSION = '0.03'; |
4
|
|
|
|
|
|
|
} |
5
|
1
|
|
|
1
|
|
830
|
use 5.010; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
40
|
|
6
|
1
|
|
|
1
|
|
26408
|
use Moo; |
|
1
|
|
|
|
|
48837
|
|
|
1
|
|
|
|
|
7
|
|
7
|
1
|
|
|
1
|
|
3453
|
use MooX::Options; |
|
1
|
|
|
|
|
2477
|
|
|
1
|
|
|
|
|
7
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
414704
|
use PAUSE::Permissions 0.06; |
|
1
|
|
|
|
|
116768
|
|
|
1
|
|
|
|
|
37
|
|
10
|
1
|
|
|
1
|
|
1139
|
use PAUSE::Packages 0.02; |
|
1
|
|
|
|
|
19293
|
|
|
1
|
|
|
|
|
1354
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
option 'user' => (is => 'ro', format => 's'); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub execute |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
17
|
0
|
|
|
|
|
|
my %perm; |
18
|
|
|
|
|
|
|
my %owner; |
19
|
0
|
|
|
|
|
|
my $packages; |
20
|
0
|
|
|
|
|
|
my ($signature, $previous_signature, $mismatch, %user); |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
$self->_load_permissions(\%perm, \%owner); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $release_iterator = PAUSE::Packages->new()->release_iterator(); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $bad_count = 0; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
RELEASE: |
29
|
0
|
|
|
|
|
|
while (my $release = $release_iterator->next) { |
30
|
0
|
0
|
|
|
|
|
if ($self->user) { |
31
|
0
|
|
|
|
|
|
my $seen_user = 0; |
32
|
0
|
|
|
|
|
|
my $USER = uc($self->user); |
33
|
0
|
|
|
|
|
|
foreach my $module (@{ $release->modules }) { |
|
0
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
$seen_user = 1 if grep { $_ eq $USER } @{ $perm{$module->name} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
0
|
0
|
|
|
|
|
next RELEASE unless $seen_user; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
$mismatch = 0; |
40
|
0
|
|
|
|
|
|
$previous_signature = undef; |
41
|
0
|
|
|
|
|
|
%user = (); |
42
|
0
|
|
|
|
|
|
foreach my $module (@{ $release->modules }) { |
|
0
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$signature = join(' ', map { _capitalise_author($_, $module->name, \%owner) } @{ $perm{$module->name} }); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
foreach my $pause_id (@{ $perm{$module->name} }) { |
|
0
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$user{ $pause_id } = 1; |
46
|
|
|
|
|
|
|
} |
47
|
0
|
0
|
0
|
|
|
|
if (defined($previous_signature) && $signature ne $previous_signature) { |
48
|
0
|
|
|
|
|
|
$mismatch = 1; |
49
|
0
|
|
|
|
|
|
$bad_count++; |
50
|
|
|
|
|
|
|
} |
51
|
0
|
0
|
|
|
|
|
$previous_signature = $signature if !defined($previous_signature); |
52
|
|
|
|
|
|
|
} |
53
|
0
|
0
|
|
|
|
|
$self->_display_release($release, \%user, \%perm, \%owner) if $mismatch; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
0
|
|
|
|
|
if ($bad_count > 0) { |
56
|
0
|
|
|
|
|
|
print "\n" |
57
|
|
|
|
|
|
|
} else { |
58
|
0
|
|
|
|
|
|
print " all good\n"; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _display_release |
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
0
|
|
|
my $self = shift; |
65
|
0
|
|
|
|
|
|
my $release = shift; |
66
|
0
|
|
|
|
|
|
my $usermap = shift; |
67
|
0
|
|
|
|
|
|
my $perm = shift; |
68
|
0
|
|
|
|
|
|
my $owner = shift; |
69
|
0
|
|
|
|
|
|
my @users = sort keys %$usermap; |
70
|
0
|
|
|
|
|
|
my $maxlength = 0; |
71
|
0
|
|
|
|
|
|
my $entry; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
foreach my $module (@{ $release->modules }) { |
|
0
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
$maxlength = length($module->name) if length($module->name) > $maxlength; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
print "\n", $release->distinfo->dist, "\n"; |
78
|
0
|
|
|
|
|
|
foreach my $module (sort { $a->name cmp $b->name } @{ $release->modules }) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
print ' ', $module->name; |
80
|
0
|
0
|
|
|
|
|
print ' ' x ($maxlength - length($module->name)) if (length($module->name) < $maxlength); |
81
|
0
|
|
|
|
|
|
print ' |'; |
82
|
0
|
|
|
|
|
|
foreach my $user (@users) { |
83
|
0
|
|
|
|
|
|
print ' '; |
84
|
0
|
|
|
|
|
|
($entry) = grep { $_ eq $user } @{ $perm->{$module->name} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
85
|
0
|
0
|
|
|
|
|
if (defined($entry)) { |
86
|
0
|
|
|
|
|
|
print _capitalise_author($user, $module->name, $owner); |
87
|
|
|
|
|
|
|
} else { |
88
|
0
|
|
|
|
|
|
print ' ' x length($user); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
0
|
|
|
|
|
|
print "\n"; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _capitalise_author |
96
|
|
|
|
|
|
|
{ |
97
|
0
|
|
|
0
|
|
|
my $user = shift; |
98
|
0
|
|
|
|
|
|
my $module = shift; |
99
|
0
|
|
|
|
|
|
my $owner = shift; |
100
|
|
|
|
|
|
|
|
101
|
0
|
0
|
0
|
|
|
|
if (exists($owner->{ $module }) && $owner->{ $module } eq $user) { |
102
|
0
|
|
|
|
|
|
return uc($user); |
103
|
|
|
|
|
|
|
} else { |
104
|
0
|
|
|
|
|
|
return lc($user); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub _load_permissions |
109
|
|
|
|
|
|
|
{ |
110
|
0
|
|
|
0
|
|
|
my $self = shift; |
111
|
0
|
|
|
|
|
|
my $perm = shift; |
112
|
0
|
|
|
|
|
|
my $owner = shift; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $module_iterator = PAUSE::Permissions->new()->module_iterator(); |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
while (my $module = $module_iterator->next_module) { |
117
|
0
|
|
|
|
|
|
$perm->{ $module->name } = [ $module->all_maintainers ]; |
118
|
0
|
0
|
|
|
|
|
$owner->{ $module->name } = $module->owner if defined($module->owner); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 NAME |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
App::PAUSE::CheckPerms - check if PAUSE permissions are consistent for all modules in a dist |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SYNOPSIS |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
use App::PAUSE::CheckPerms; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my $app = App::PAUSE::CheckPerms->new_with_options(); |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$app->execute(); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 DESCRIPTION |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This module provides the functionality for the L script. |
139
|
|
|
|
|
|
|
Please look at that script's documentation for more details. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 CAVEAT |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This is my first attempt writing an App:: module and partner script using MooX::Options. |
144
|
|
|
|
|
|
|
It feels all wrong, but I've been wanting to release a tool to do this for a while, |
145
|
|
|
|
|
|
|
so I'm sucking it and seeing. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Feel free to suggest better ways to do this. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 SEE ALSO |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
L, L, L, |
152
|
|
|
|
|
|
|
L. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 REPOSITORY |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
L |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 AUTHOR |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Neil Bowers Eneilb@cpan.orgE |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Neil Bowers . |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
167
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
168
|
|
|
|
|
|
|
|