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

1.1       harris41    1: #!/usr/bin/perl
                      2: 
                      3: my ($standard,$current)=@ARGV;
                      4: 
1.4       harris41    5: $standard=~s/[^\/\w\.]//g;
                      6: $current=~s/[^\/\w\.]//g;
1.1       harris41    7: my %svhash;
                      8: my %sbhash;
                      9: 
                     10: my @oldrpms;
                     11: my @badversionrpms;
                     12: my @newrpms;
                     13: my @externalrpms;
                     14: 
1.4       harris41   15: open IN, "<$standard";
1.1       harris41   16: while(<IN>) {
                     17:     chop;
                     18:     my ($name,$version,$buildtime)=split(/\s+/);
                     19:     $svhash{$name}=$version;
                     20:     $sbhash{$name}=$buildtime;
                     21: }
                     22: close IN;
                     23: 
1.4       harris41   24: open IN, "<$current";
1.1       harris41   25: while(<IN>) {
                     26:     chop;
                     27:     my ($name,$version,$buildtime)=split(/\s+/);
                     28:     if ($svhash{$name}) {
                     29: 	unless ($svhash{$name} eq $version) {
                     30: 	    push @badversionrpms,"$name is version $version, should be $svhash{$name}\n";
                     31: 	}
                     32: 	if ($sbhash{$name}<$buildtime) {
1.6     ! harris41   33: 	    push @newrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
1.1       harris41   34: 	}
                     35: 	if ($sbhash{$name}>$buildtime) {
1.6     ! harris41   36: 	    push @oldrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
1.1       harris41   37: 	}
                     38:     }
                     39:     else {
                     40: 	push @externalrpms,"$name (built ".localtime($buildtime).") is an RPM not expected to ever be on a LON-CAPA system\n";
                     41:     }
                     42: }
                     43: close IN;
                     44: 
                     45: my $date=`date`; chop $date;
1.3       harris41   46: my $hostname=`hostname`; chop $hostname;
1.1       harris41   47: print <<END;
                     48: <HTML>
                     49: <HEAD>
                     50: <TITLE>LON-CAPA Software RPM Status Page</TITLE>
                     51: </HEAD>
                     52: <BODY>
                     53: <FONT SIZE=+2>LON-CAPA Software RPM Status Page (done on $date for $hostname)</FONT>
                     54: <BR>Michigan State University
                     55: <BR>Learning Online with CAPA
1.3       harris41   56: <BR>Contact korte\@lon-capa.org
1.1       harris41   57: <UL>
                     58: <LI>About this file</LI>
                     59: <LI>Bad RPM Versions</LI>
                     60: <LI>Out-of-date RPMS</LI>
                     61: <LI>Newer than expected RPMS</LI>
                     62: <LI>RPMS external to LON-CAPA</LI>
                     63: </UL>
                     64: <FONT SIZE=+2>About this file</FONT>
                     65: <P>
                     66: This file is generated dynamically by <tt>make rpmstatuspost</tt>
                     67: when this command is entered in the CVS:loncom/build directory.
                     68: </P>
                     69: END
                     70:     print <<END;
                     71: <FONT SIZE=+2>Bad RPM Versions</FONT>
                     72: <PRE>
                     73: END
                     74: foreach my $rpminfo (@badversionrpms) {
                     75:     print $rpminfo;
                     76: }
                     77: print <<END;
                     78: </PRE>
                     79: END
                     80: print <<END;
                     81: <FONT SIZE=+2>Out-of-date RPMS</FONT>
                     82: <PRE>
                     83: END
                     84: foreach my $rpminfo (@oldrpms) {
                     85:     print $rpminfo;
                     86: }
                     87: print <<END;
                     88: </PRE>
                     89: END
                     90: print <<END;
                     91: <FONT SIZE=+2>Newer than expected RPMS</FONT>
                     92: <PRE>
                     93: END
                     94: foreach my $rpminfo (@newrpms) {
                     95:     print $rpminfo;
                     96: }
                     97: print <<END;
                     98: </PRE>
                     99: END
                    100: print <<END;
                    101: <FONT SIZE=+2>RPMS external to LON-CAPA</FONT>
                    102: <PRE>
                    103: END
                    104: foreach my $rpminfo (@externalrpms) {
                    105:     print $rpminfo;
                    106: }
                    107: print <<END;
                    108: </PRE>
                    109: END

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