diff options
author | Robin Barker <RMBarker@cpan.org> | 2007-10-10 19:11:36 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-10-11 07:08:00 +0000 |
commit | 3428fdd57721820eccc1fa98f243a42d5960bb64 (patch) | |
tree | adc5fe116b1b9680c8e040bd95b5b1d23ba636a0 /Porting | |
parent | 9311160e8e005d634474952ba2e0841d81d67460 (diff) | |
download | perl-3428fdd57721820eccc1fa98f243a42d5960bb64.tar.gz |
Porting/Maintainers.pm --check added functionality
From: "Robin Barker" <Robin.Barker@npl.co.uk>
Message-ID: <2C2E01334A940D4792B3E115F95B7226C9D1F2@exchsvr1.npl.ad.local>
p4raw-id: //depot/perl@32097
Diffstat (limited to 'Porting')
-rw-r--r-- | Porting/Maintainers.pm | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/Porting/Maintainers.pm b/Porting/Maintainers.pm index f71db98771..ce773ea0f3 100644 --- a/Porting/Maintainers.pm +++ b/Porting/Maintainers.pm @@ -67,11 +67,14 @@ sub get_maintainer_modules { sub usage { print <<__EOF__; -$0: Usage: $0 [[--maintainer M --module M --files --check]|file ...] +$0: Usage: $0 [[--maintainer M --module M --files]|[--check] file ...] --maintainer M list all maintainers matching M --module M list all modules matching M --files list all files --check check consistency of Maintainers.pl + with a file checks if it has a maintainer + with a dir checks all files have a maintainer + otherwise checks for multiple maintainers --opened list all modules of files opened by perforce Matching is case-ignoring regexp, author matching is both by the short id and by the full name and email. A "module" may @@ -160,6 +163,13 @@ sub show_results { } } } + } elsif ($Check) { + if( @Files ) { + missing_maintainers( qr{\.(?:[chty]|p[lm]|xs)\z}msx, @Files) + } + else { + duplicated_maintainers(); + } } elsif (@Files) { my %ModuleByFile; @@ -233,21 +243,25 @@ sub show_results { } } } - elsif ($Check) { - duplicated_maintainers(); - } else { usage(); } } -sub duplicated_maintainers { - my %files; +sub warn_maintainer(_); +my %files; + +sub maintainers_files { + %files = (); for my $k (keys %Modules) { for my $f (get_module_files($k)) { ++$files{$f}; } } +} + +sub duplicated_maintainers { + maintainers_files(); for my $f (keys %files) { if ($files{$f} > 1) { warn "File $f appears $files{$f} times in Maintainers.pl\n"; @@ -255,5 +269,19 @@ sub duplicated_maintainers { } } +sub missing_maintainers { + my($check, @path) = @_; + maintainers_files(); + my @dir; + for (@path) { if( -d ) { push @dir, $_ } else { warn_maintainer() } } + find sub { warn_maintainer($File::Find::name) if /$check/; }, @dir + if @dir; +} + +sub warn_maintainer(_) { + my $name = shift; + warn "File $name has no maintainer\n" if not $files{$name}; +} + 1; |