]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/diag/ac/cknames.pl
This commit was generated by cvs2svn to compensate for changes in r90446,
[FreeBSD/FreeBSD.git] / tools / diag / ac / cknames.pl
1 #!/usr/bin/perl -w
2 #
3 # Copyright (c) 2002 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 $cvsroot = $ENV{'CVSROOT'};
41 $cvsroot = "/home/ncvs" if !$cvsroot;
42 $cvs = "cvs -R -d $cvsroot co -p";
43
44 open(PASSWD, 'ypcat passwd |') || die "open passwd data: $!\n";
45 while (<PASSWD>) {
46         ($login,undef) = split(/:/);
47         $login =~ s/_//g;       # remove _ from usernames since this
48                                 # character is not allowed in docbook entities
49         print "passwd user: $login\n" if $debug;
50         $users{$login} = 1;
51 }
52 close PASSWD;
53
54 print "$cvs $accessfile\n";
55 open (ACCESS, "$cvs $accessfile |") || die "checkout $accessfile: $!\n";
56 while (<ACCESS>) {
57         chomp;
58         next if /^#/;
59         ($accuser, undef) = split /\s/;
60         $accuser =~ s/_//g;
61         print "access user: $accuser\n" if $debug;
62         $access{$accuser} = 1;
63 }
64 close ACCESS;
65
66 open (AUTHORS, "$cvs $authorsfile |") || die "checkout $authorsfile: $!\n";
67 while (<AUTHORS>) {
68         $author = $1 if /ENTITY a\.([^ ]+)/;
69         next if !$author;
70         print "authors entity: $author\n" if $debug;
71         $authors{$author} = 1;
72         $author = "";
73 }
74 close AUTHORS;
75
76 print "\n";
77 print "People listed in CVSROOT/access, but have no account\n";
78 print "----------------------------------------------------\n";
79 foreach (keys %access) {
80         print "$_\n" if (!defined $users{$_});
81 }
82
83 print "\n";
84 print "People listed in autors.ent, not have no account\n";
85 print "------------------------------------------------\n";
86 foreach (keys %authors) {
87         print "$_\n" if (!defined $users{$_});
88 }
89
90 print "\n";
91 print "People listed in CVSROOT/access, but not listed in authors.ent\n";
92 print "--------------------------------------------------------------\n";
93 foreach (keys %access) {
94         print "$_\n" if (!defined $authors{$_});
95 }
96
97 print "\n";