This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
in unpack, () groups in scalar context were still returning a list,
[perl5.git] / Porting / Maintainers.pm
index f71db98..4f50e94 100644 (file)
@@ -7,6 +7,9 @@ package Maintainers;
 use strict;
 
 use lib "Porting";
+# Please don't use post 5.008 features as this module is used by
+# Porting/makemeta, and that in turn has to be run by the perl just built.
+use 5.008;
 
 require "Maintainers.pl";
 use vars qw(%Modules %Maintainers);
@@ -67,11 +70,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 +166,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 +246,24 @@ sub show_results {
            }
        }
     }
-    elsif ($Check) {
-       duplicated_maintainers();
-    }
     else {
        usage();
     }
 }
 
-sub duplicated_maintainers {
-    my %files;
+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 +271,21 @@ sub duplicated_maintainers {
     }
 }
 
+sub warn_maintainer {
+    my $name = shift;
+    warn "File $name has no maintainer\n" if not $files{$name};
+}
+
+sub missing_maintainers {
+    my($check, @path) = @_;
+    maintainers_files();
+    my @dir;
+    for my $d (@path) {
+       if( -d $d ) { push @dir, $d } else { warn_maintainer($d) }
+    }
+    find sub { warn_maintainer($File::Find::name) if /$check/; }, @dir
+       if @dir;
+}
+
 1;