]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - tools/diag/ac/cknames.pl
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / tools / diag / ac / cknames.pl
1 #!/usr/bin/perl -w
2 #
3 # Copyright (c) 2002,2003 Alexey Zelkin <phantom@FreeBSD.org>
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 #    notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 #    notice, this list of conditions and the following disclaimer in the
13 #    documentation and/or other materials provided with the distribution.
14 #
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 # SUCH DAMAGE.
26 #
27 # cknames.pl -- this scripts checks for integrity of person lists
28 #               between authors.ent, CVSROOT/access and passwd database
29 #               at freefall.freebsd.org
30 #
31 # NOTE: This script is supposed to run at freefall.freebsd.org *only*
32 #
33 # $FreeBSD$
34 #
35
36 $debug = 0;
37 $accessfile = "CVSROOT/access";
38 $authorsfile = "doc/en_US.ISO8859-1/share/sgml/authors.ent";
39
40 @cvsroots = qw(
41         /home/ncvs
42         /home/pcvs
43         /home/dcvs
44 );
45
46 $doccvsroot = "/home/dcvs";
47 $cvs_pfx = "cvs -Q -R -d ";
48 $cvs_sfx = " co -p";
49
50 open(PASSWD, 'ypcat passwd |') || die "open passwd data: $!\n";
51 while (<PASSWD>) {
52         ($login,undef) = split(/:/);
53         $login =~ s/_//g;       # remove _ from usernames since this
54                                 # character is not allowed in docbook entities
55         print "passwd user: $login\n" if $debug;
56         $users{$login} = 1;
57 }
58 close PASSWD;
59
60 foreach (@cvsroots) {
61     print "$cvs_pfx $_ $cvs_sfx $accessfile\n" if $debug;
62     open (ACCESS, "$cvs_pfx $_ $cvs_sfx $accessfile |") ||
63                                 die "checkout $accessfile: $!\n";
64     while (<ACCESS>) {
65         chomp;
66         next if /^#/;
67         ($accuser, undef) = split /\s/;
68         $accuser =~ s/_//g;
69         print "access user: $accuser\n" if $debug;
70         $access{$accuser} = 1;
71     }
72     close ACCESS;
73 }
74
75 open (AUTHORS, "$cvs_pfx $doccvsroot $cvs_sfx $authorsfile |") ||
76                                 die "checkout $authorsfile: $!\n";
77 while (<AUTHORS>) {
78         $author = $1 if /ENTITY a\.([^ ]+)/;
79         next if !$author;
80         print "authors entity: $author\n" if $debug;
81         $authors{$author} = 1;
82         $author = "";
83 }
84 close AUTHORS;
85
86 print "\n";
87 print "People listed in CVSROOT/access, but have no account\n";
88 print "----------------------------------------------------\n";
89 foreach (keys %access) {
90         print "$_\n" if (!defined $users{$_});
91 }
92
93 print "\n";
94 print "People listed in autors.ent, not have no account\n";
95 print "------------------------------------------------\n";
96 foreach (keys %authors) {
97         print "$_\n" if (!defined $users{$_});
98 }
99
100 print "\n";
101 print "People listed in CVSROOT/access, but not listed in authors.ent\n";
102 print "--------------------------------------------------------------\n";
103 foreach (keys %access) {
104         print "$_\n" if (!defined $authors{$_});
105 }
106
107 print "\n";