Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143094
b: refs/heads/master
c: 4a7fdb5
h: refs/heads/master
v: v3
  • Loading branch information
Joe Perches committed Apr 10, 2009
1 parent 5aacc9d commit f9b3500
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 45 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69aefcead5da3bb9e4aa7e80a3b6da531560c7dc
refs/heads/master: 4a7fdb5f51a4d9228b0ff93494b95f72be5e904a
85 changes: 41 additions & 44 deletions trunk/scripts/get_maintainer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use strict;

my $P = $0;
my $V = '0.14';
my $V = '0.15';

use Getopt::Long qw(:config no_auto_abbrev);

Expand All @@ -34,7 +34,7 @@
my $web = 0;
my $subsystem = 0;
my $status = 0;
my $onefile = 0;
my $from_filename = 0;
my $version = 0;
my $help = 0;

Expand Down Expand Up @@ -72,7 +72,7 @@
'status!' => \$status,
'scm!' => \$scm,
'web!' => \$web,
'f|file' => \$onefile,
'f|file' => \$from_filename,
'v|version' => \$version,
'h|help' => \$help,
)) {
Expand All @@ -90,8 +90,6 @@
exit 0;
}

my $infile = $ARGV[0];

if ($#ARGV < 0) {
usage();
die "$P: argument missing: patchfile or -f file please\n";
Expand Down Expand Up @@ -139,32 +137,35 @@
}
close(MAINT);

## use the filename on the command line or find the filenames in the patchfile
## use the filenames on the command line or find the filenames in the patchfiles

my @files = ();

if ($onefile) {
if (!(-f $infile)) {
die "$P: file '${infile}' not found\n";
foreach my $file (@ARGV) {
next if ((-d $file));
if (!(-f $file)) {
die "$P: file '${file}' not found\n";
}
push(@files, $infile);
} else {
open(PATCH, "<$infile") or die "$P: Can't open ${infile}\n";
while (<PATCH>) {
if (m/^\+\+\+\s+(\S+)/) {
my $file = $1;
$file =~ s@^[^/]*/@@;
$file =~ s@\n@@;
push(@files, $file);
if ($from_filename) {
push(@files, $file);
} else {
my $file_cnt = @files;
open(PATCH, "<$file") or die "$P: Can't open ${file}\n";
while (<PATCH>) {
if (m/^\+\+\+\s+(\S+)/) {
my $filename = $1;
$filename =~ s@^[^/]*/@@;
$filename =~ s@\n@@;
push(@files, $filename);
}
}
close(PATCH);
if ($file_cnt == @files) {
die "$P: file '${file}' doesn't appear to be a patch. "
. "Add -f to options?\n";
}
@files = sort_and_uniq(@files);
}
close(PATCH);
my $file_cnt = @files;
if ($file_cnt == 0) {
print STDERR "$P: file '${infile}' doesn't appear to be a patch. "
. "Add -f to options?\n";
}
@files = sort_and_uniq(@files);
}

my @email_to = ();
Expand Down Expand Up @@ -208,7 +209,7 @@
}
}

if ($email_git) {
if ($email && $email_git) {
recent_git_signoffs($file);
}

Expand Down Expand Up @@ -240,30 +241,22 @@
}

if ($scm) {
if (!$onefile) {
@scm = sort_and_uniq(@scm);
}
@scm = sort_and_uniq(@scm);
output(@scm);
}

if ($status) {
if (!$onefile) {
@status = sort_and_uniq(@status);
}
@status = sort_and_uniq(@status);
output(@status);
}

if ($subsystem) {
if (!$onefile) {
@subsystem = sort_and_uniq(@subsystem);
}
@subsystem = sort_and_uniq(@subsystem);
output(@subsystem);
}

if ($web) {
if (!$onefile) {
@web = sort_and_uniq(@web);
}
@web = sort_and_uniq(@web);
output(@web);
}

Expand Down Expand Up @@ -445,20 +438,22 @@ sub recent_git_signoffs {
}

$cmd = "git log --since=${email_git_since} -- ${file}";
$cmd .= " | grep -P '^ [-A-Za-z]+by:.*\\\@'";
$cmd .= " | grep -Pi \"^[-_ a-z]+by:.*\\\@\"";
if (!$email_git_penguin_chiefs) {
$cmd .= " | grep -E -v \"${penguin_chiefs}\"";
$cmd .= " | grep -Pv \"${penguin_chiefs}\"";
}
$cmd .= " | cut -f2- -d\":\"";
$cmd .= " | sed -e \"s/^\\s+//g\"";
$cmd .= " | sort | uniq -c | sort -rn";

$output = `${cmd}`;
$output =~ s/^\s*//gm;

@lines = split("\n", $output);
foreach my $line (@lines) {
if ($line =~ m/([0-9]+)\s+([-A-Za-z]+by:)\s+(.*)/) {
if ($line =~ m/([0-9]+)\s+(.*)/) {
my $sign_offs = $1;
$line = $3;
$line = $2;
$count++;
if ($sign_offs < $email_git_min_signatures ||
$count > $email_git_max_maintainers) {
Expand All @@ -467,17 +462,19 @@ sub recent_git_signoffs {
} else {
die("$P: Unexpected git output: ${line}\n");
}
if ($line =~ m/(.*) <(.*)>/) {
if ($line =~ m/(.+)<(.+)>/) {
my $git_name = $1;
my $git_addr = $2;
$git_name =~ tr/^\"//;
$git_name =~ tr/^\\s*//;
$git_name =~ tr/\"$//;
$git_name =~ tr/\\s*$//;
if ($email_usename) {
push(@email_to, format_email($git_name, $git_addr));
} else {
push(@email_to, $git_addr);
}
} elsif ($line =~ m/<(.*)>/) {
} elsif ($line =~ m/<(.+)>/) {
my $git_addr = $1;
push(@email_to, $git_addr);
} else {
Expand Down

0 comments on commit f9b3500

Please sign in to comment.