Annotation of loncom/build/rpmparse.pl, revision 1.9

1.1       harris41    1: #!/usr/bin/perl
                      2: 
1.8       harris41    3: my ($standard,$current,$expected)=@ARGV;
1.1       harris41    4: 
1.4       harris41    5: $standard=~s/[^\/\w\.]//g;
                      6: $current=~s/[^\/\w\.]//g;
1.8       harris41    7: $expected=~s/[^\/\w\.]//g;
1.1       harris41    8: my %svhash;
                      9: my %sbhash;
1.8       harris41   10: my %chash;
1.1       harris41   11: 
                     12: my @oldrpms;
                     13: my @badversionrpms;
                     14: my @newrpms;
                     15: my @externalrpms;
1.8       harris41   16: my @barerpms;
                     17: my @developrpms;
1.1       harris41   18: 
1.4       harris41   19: open IN, "<$standard";
1.1       harris41   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: 
1.4       harris41   28: open IN, "<$current";
1.1       harris41   29: while(<IN>) {
                     30:     chop;
                     31:     my ($name,$version,$buildtime)=split(/\s+/);
1.8       harris41   32:     $chash{$name}=1;
1.1       harris41   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) {
1.6       harris41   38: 	    push @newrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
1.1       harris41   39: 	}
                     40: 	if ($sbhash{$name}>$buildtime) {
1.6       harris41   41: 	    push @oldrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
1.1       harris41   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: 
1.8       harris41   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: 
1.1       harris41   65: my $date=`date`; chop $date;
1.3       harris41   66: my $hostname=`hostname`; chop $hostname;
1.1       harris41   67: print <<END;
1.7       harris41   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>
1.8       harris41   79: <li>Important warnings</li>
1.7       harris41   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>
1.8       harris41   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>
1.7       harris41   87: </ul>
1.8       harris41   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>
1.7       harris41  107: <font size="+2">About this file</font>
                    108: <p>
1.1       harris41  109: This file is generated dynamically by <tt>make rpmstatuspost</tt>
                    110: when this command is entered in the CVS:loncom/build directory.
1.7       harris41  111: </p>
1.8       harris41  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>
1.1       harris41  121: END
                    122:     print <<END;
1.7       harris41  123: <font size="+2">Differing RPM Versions</font>
                    124: <pre>
1.1       harris41  125: END
                    126: foreach my $rpminfo (@badversionrpms) {
                    127:     print $rpminfo;
                    128: }
                    129: print <<END;
1.7       harris41  130: </pre>
1.1       harris41  131: END
                    132: print <<END;
1.7       harris41  133: <font size="+2">Out-of-date RPMS</font>
                    134: <pre>
1.1       harris41  135: END
                    136: foreach my $rpminfo (@oldrpms) {
                    137:     print $rpminfo;
                    138: }
                    139: print <<END;
1.7       harris41  140: </pre>
1.1       harris41  141: END
                    142: print <<END;
1.7       harris41  143: <font size="+2">Newer than expected RPMS</font>
                    144: <pre>
1.1       harris41  145: END
                    146: foreach my $rpminfo (@newrpms) {
                    147:     print $rpminfo;
                    148: }
                    149: print <<END;
1.7       harris41  150: </pre>
1.1       harris41  151: END
                    152: print <<END;
1.7       harris41  153: <font size="+2">RPMS external to LON-CAPA</font>
                    154: <pre>
1.1       harris41  155: END
                    156: foreach my $rpminfo (@externalrpms) {
1.8       harris41  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) {
1.1       harris41  177:     print $rpminfo;
                    178: }
                    179: print <<END;
1.7       harris41  180: </pre>
1.1       harris41  181: END

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>