genAuthors.in (302408) | genAuthors.in (309007) |
---|---|
1#! @PATH_PERL@ 2 3# DESCRIPTION 4# 5# Make sure we have the list of authors for git imports. 6# Call with the path to the Authors/ subdirectory. 7# 8# AUTHOR --- 20 unchanged lines hidden (view full) --- 29# Make sure the format of that file is 1 or more lines of the form: 30# user = User Name <user@place> 31# 32# If all of the above is true, exit 0. 33# If there are any problems, squawk and exit 1. 34 35my $bk_u = "bk changes -and:USER: | sort -u |"; 36chomp(my $bk_root = `bk root`); | 1#! @PATH_PERL@ 2 3# DESCRIPTION 4# 5# Make sure we have the list of authors for git imports. 6# Call with the path to the Authors/ subdirectory. 7# 8# AUTHOR --- 20 unchanged lines hidden (view full) --- 29# Make sure the format of that file is 1 or more lines of the form: 30# user = User Name <user@place> 31# 32# If all of the above is true, exit 0. 33# If there are any problems, squawk and exit 1. 34 35my $bk_u = "bk changes -and:USER: | sort -u |"; 36chomp(my $bk_root = `bk root`); |
37my $A_path = "$bk_root/BitKeeper/etc/authors.txt"; | 37my $A_dir = "$bk_root/BitKeeper/etc/Authors"; 38my $A_file = "$bk_root/BitKeeper/etc/authors.txt"; |
38my %authors; 39my $problem = 0; 40 | 39my %authors; 40my $problem = 0; 41 |
41die "bkroot: <$bk_root>, A_path: <$A_path>\n" if (! -r $A_path); | 42die "bkroot: <$bk_root>, A_dir: <$A_dir>\n" if (! -r $A_dir); 43die "bkroot: <$bk_root>, A_file: <$A_file>\n" if (! -r $A_file); |
42 43# Process the authors.txt file | 44 45# Process the authors.txt file |
44open(my $FILE, '<', $A_path) or die "Could not open <$A_path>: $!\n"; | 46open(my $FILE, '<', $A_file) or die "Could not open <$A_file>: $!\n"; |
45while (<$FILE>) { 46 chomp; 47 if (/^([\S]+) = ([\V]+) <([\w.-]+\@[\w.-]+)>$/) { 48 # print "Got '$1 = $2 <$3>'\n"; 49 $authors{$1} = ""; 50 } else { | 47while (<$FILE>) { 48 chomp; 49 if (/^([\S]+) = ([\V]+) <([\w.-]+\@[\w.-]+)>$/) { 50 # print "Got '$1 = $2 <$3>'\n"; 51 $authors{$1} = ""; 52 } else { |
51 print "In $A_path: unrecognized line: '$_'\n"; | 53 print "In $A_file: unrecognized line: '$_'\n"; |
52 $problem = 1; 53 } 54} 55close($FILE); 56 57#print "\%authors = ", join(' ', sort keys %authors), "\n"; 58 59die "Fix the problem(s) noted above!\n" if $problem; --- 4 unchanged lines hidden (view full) --- 64while (<BKU>) { 65 chomp; 66 my $Name = $_; 67 my $name = lc; 68 # print "Got Name <$Name>, name <$name>\n"; 69 if (!defined($authors{$Name})) { 70 $problem = 1; 71 print "<$Name> is not a defined author!\n"; | 54 $problem = 1; 55 } 56} 57close($FILE); 58 59#print "\%authors = ", join(' ', sort keys %authors), "\n"; 60 61die "Fix the problem(s) noted above!\n" if $problem; --- 4 unchanged lines hidden (view full) --- 66while (<BKU>) { 67 chomp; 68 my $Name = $_; 69 my $name = lc; 70 # print "Got Name <$Name>, name <$name>\n"; 71 if (!defined($authors{$Name})) { 72 $problem = 1; 73 print "<$Name> is not a defined author!\n"; |
72 open(my $FILE, '>>', "$A_path/$name.txt") || die "Cannot create '$A_path/$name.txt': $!\n"; | 74 open(my $FILE, '>>', "$A_dir/$name.txt") || die "Cannot create '$A_dir/$name.txt': $!\n"; |
73 print $FILE "$Name = \n"; 74 close($FILE); 75 } 76} 77 78die "Fix the problem(s) noted above!\n" if $problem; 79 80# Local Variables: ** 81# mode:cperl ** 82# End: ** | 75 print $FILE "$Name = \n"; 76 close($FILE); 77 } 78} 79 80die "Fix the problem(s) noted above!\n" if $problem; 81 82# Local Variables: ** 83# mode:cperl ** 84# End: ** |