aboutsummaryrefslogtreecommitdiff
path: root/tools/diag/ac/cknames.pl
blob: 41083d74c01373d1da246dedd1e1dbc6b7e6f5ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/perl -w
# Copyright (c) 2002 Alexey Zelkin <phantom@FreeBSD.org>
#
# cknames.pl -- this scripts checks for existence persons listed
#               in authors.ent and access files
#
# $FreeBSD$
#

$debug = 0;
$accessfile = "CVSROOT/access";
$authorsfile = "doc/en_US.ISO8859-1/share/sgml/authors.ent";

$cvsroot = $ENV{'CVSROOT'};
$cvsroot = "/home/ncvs" if !$cvsroot;
$cvs = "cvs -R -d $cvsroot co -p";

open(PASSWD, 'ypcat passwd |') || die "open passwd data: $!\n";
while (<PASSWD>) {
	($login,undef) = split(/:/);
	print "passwd user: $login\n" if $debug;
	$users{$login} = 1;
}
close PASSWD;

print "$cvs $accessfile\n";
open (ACCESS, "$cvs $accessfile |") || die "checkout $accessfile: $!\n";
while (<ACCESS>) {
	chomp;
	next if /^#/;
	($accuser, undef) = split /\s/;
	print "access user: $accuser\n" if $debug;
	$access{$accuser} = 1;
}
close ACCESS;

open (AUTHORS, "$cvs $authorsfile |") || die "checkout $authorsfile: $!\n";
while (<AUTHORS>) {
	$author = $1 if /ENTITY a\.([^ ]+)/;
	next if !$author;
	print "authors entity: $author\n" if $debug;
	$authors{$author} = 1;
	$author = "";
}
close AUTHORS;

print "\n";
print "People listed in CVSROOT/access, but have no account\n";
print "----------------------------------------------------\n";
foreach (keys %access) {
	print "$_\n" if (!defined $users{$_});
}

print "\n";
print "People listed in autors.ent, not have no account\n";
print "------------------------------------------------\n";
foreach (keys %authors) {
	print "$_\n" if (!defined $users{$_});
}

print "\n";
print "People listed in CVSROOT/access, but not listed in authors.ent\n";
print "--------------------------------------------------------------\n";
foreach (keys %access) {
	print "$_\n" if (!defined $authors{$_});
}

print "\n";