5 # Make sure we have the list of authors for git imports.
6 # Call with the path to the Authors/ subdirectory.
14 # This file is Copyright (c) 2016 Network Time Foundation
16 # Copying and distribution of this file, with or without modification, are
17 # permitted in any medium without royalty provided the copyright notice,
18 # author attribution and this notice are preserved. This file is offered
19 # as-is, without any warranty.
24 # Read in the list of known authors.
26 # bk changes -and:USER: | sort -u
27 # to get the list of users who have made commits.
28 # Make sure that each of these users is in the set of known authors.
29 # Make sure the format of that file is 1 or more lines of the form:
30 # user = User Name <user@place>
32 # If all of the above is true, exit 0.
33 # If there are any problems, squawk and exit 1.
35 my $bk_u = "bk changes -and:USER: | sort -u |";
36 chomp(my $bk_root = `bk root`);
37 my $A_path = "$bk_root/BitKeeper/etc/authors.txt";
41 die "bkroot: <$bk_root>, A_path: <$A_path>\n" if (! -r $A_path);
43 # Process the authors.txt file
44 open(my $FILE, '<', $A_path) or die "Could not open <$A_path>: $!\n";
47 if (/^([\S]+) = ([\V]+) <([\w.-]+\@[\w.-]+)>$/) {
48 # print "Got '$1 = $2 <$3>'\n";
51 print "In $A_path: unrecognized line: '$_'\n";
57 #print "\%authors = ", join(' ', sort keys %authors), "\n";
59 die "Fix the problem(s) noted above!\n" if $problem;
61 # Process "bk changes ..."
63 open(BKU, $bk_u) || die "$0: <$bk_u> failed: $!\n";
68 # print "Got Name <$Name>, name <$name>\n";
69 if (!defined($authors{$Name})) {
71 print "<$Name> is not a defined author!\n";
72 open(my $FILE, '>>', "$A_path/$name.txt") || die "Cannot create '$A_path/$name.txt': $!\n";
73 print $FILE "$Name = \n";
78 die "Fix the problem(s) noted above!\n" if $problem;