1: #!/usr/bin/perl
2:
3: my ($standard,$current,$expected)=@ARGV;
4:
5: $standard=~s/[^\/\w\.]//g;
6: $current=~s/[^\/\w\.]//g;
7: $expected=~s/[^\/\w\.]//g;
8: my %svhash;
9: my %sbhash;
10: my %chash;
11:
12: my @oldrpms;
13: my @badversionrpms;
14: my @newrpms;
15: my @externalrpms;
16: my @barerpms;
17: my @developrpms;
18:
19: open IN, "<$standard";
20: while(<IN>) {
21: chop;
22: my ($name,$version,$buildtime)=split(/\s+/);
23: $svhash{$name}=$version;
24: $sbhash{$name}=$buildtime;
25: }
26: close IN;
27:
28: open IN, "<$current";
29: while(<IN>) {
30: chop;
31: my ($name,$version,$buildtime)=split(/\s+/);
32: $chash{$name}=1;
33: if ($svhash{$name}) {
34: unless ($svhash{$name} eq $version) {
35: push @badversionrpms,"$name is version $version, should be $svhash{$name}\n";
36: }
37: if ($sbhash{$name}<$buildtime) {
38: push @newrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
39: }
40: if ($sbhash{$name}>$buildtime) {
41: push @oldrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
42: }
43: }
44: else {
45: push @externalrpms,"$name (built ".localtime($buildtime).") is an RPM not expected to ever be on a LON-CAPA system\n";
46: }
47: }
48: close IN;
49:
50: open IN,"<$expected";
51: while(<IN>) {
52: chop;
53: next unless /^[YN] \w/;
54: /(.).(.*)/;
55: my $type=$1;
56: my $package=$2;
57: $package=~s/\-[^\-]*\-[^\-]*$//;
58: if (!$chash{$package}) {
59: push @barerpms,"$package is missing and is of basic necessity to a LON-CAPA system\n" if $type eq 'Y';
60: push @developrpms,"$package is missing and may be useful for a LON-CAPA system\n" if $type eq 'N';
61: }
62: }
63: close IN;
64:
65: my $date=`date`; chop $date;
66: my $hostname=`hostname`; chop $hostname;
67: print <<END;
68: <html>
69: <head>
70: <title>LON-CAPA Software RPM Status Page</title>
71: </head>
72: <body>
73: <font size="+2">LON-CAPA Software RPM Status Page
74: (done on $date for $hostname)</font>
75: <br />Michigan State University
76: <br />Learning Online with CAPA
77: <br />Contact korte\@lon-capa.org
78: <ul>
79: <li>Important warnings</li>
80: <li>About this file</li>
81: <li>Bad RPM Versions</li>
82: <li>Out-of-date RPMS</li>
83: <li>Newer than expected RPMS</li>
84: <li>RPMS external to LON-CAPA</li>
85: <li>RPMS from the "bare minimum" set that you are missing</li>
86: <li>RPMS from the "development" set that you are missing</li>
87: </ul>
88: <font size="+2">Important warnings</font>
89: <p>
90: <b>Never install LON-CAPA-setup</b> on a running LON-CAPA machine.
91: This RPM package contains pre-installation files such as
92: /etc/group and /etc/passwd. You will lose all access to your
93: machine if you install this RPM.
94: </p>
95: <p>
96: If you are doing CVS-based upgrades of your LON-CAPA
97: software, then you do not need to upgrade your LON-CAPA-base
98: RPM. Upgrading with the LON-CAPA-base RPM
99: will cause you to lose many of your system-specific
100: configuration settings.
101: </p>
102: <p>
103: DO NOT UPGRADE YOUR KERNEL UNLESS YOU KNOW WHAT YOU ARE DOING.
104: Kernel upgrading involves packages beginning with the word
105: "kernel".
106: </p>
107: <font size="+2">About this file</font>
108: <p>
109: This file is generated dynamically by <tt>make rpmstatuspost</tt>
110: when this command is entered in the CVS:loncom/build directory.
111: </p>
112: <p>
113: Managing software packages on any system, testing different
114: sets of software packages, tracking their dependencies, and maintaining
115: configuration information is an inexact science. While the LON-CAPA
116: recommended set of RPMs is a tested set with no missing dependencies,
117: we still highly recommend that RPM upgrades are only performed
118: by those with significant knowledge about standard Linux operating
119: systems.
120: </p>
121: END
122: print <<END;
123: <font size="+2">Differing RPM Versions</font>
124: <pre>
125: END
126: foreach my $rpminfo (@badversionrpms) {
127: print $rpminfo;
128: }
129: print <<END;
130: </pre>
131: END
132: print <<END;
133: <font size="+2">Out-of-date RPMS</font>
134: <pre>
135: END
136: foreach my $rpminfo (@oldrpms) {
137: print $rpminfo;
138: }
139: print <<END;
140: </pre>
141: END
142: print <<END;
143: <font size="+2">Newer than expected RPMS</font>
144: <pre>
145: END
146: foreach my $rpminfo (@newrpms) {
147: print $rpminfo;
148: }
149: print <<END;
150: </pre>
151: END
152: print <<END;
153: <font size="+2">RPMS external to LON-CAPA</font>
154: <pre>
155: END
156: foreach my $rpminfo (@externalrpms) {
157: print $rpminfo;
158: }
159: print <<END;
160: </pre>
161: END
162: print <<END;
163: <font size="+2">RPMS from the "bare minimum" set that you are missing</font>
164: <pre>
165: END
166: foreach my $rpminfo (@barerpms) {
167: print $rpminfo;
168: }
169: print <<END;
170: </pre>
171: END
172: print <<END;
173: <font size="+2">RPMS from the "development" set that you are missing</font>
174: <pre>
175: END
176: foreach my $rpminfo (@developrpms) {
177: print $rpminfo;
178: }
179: print <<END;
180: </pre>
181: END
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>