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