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

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;
1.7     ! harris41   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
        !            54: (done on $date for $hostname)</font>
        !            55: <br />Michigan State University
        !            56: <br />Learning Online with CAPA
        !            57: <br />Contact korte\@lon-capa.org
        !            58: <ul>
        !            59: <li>About this file</li>
        !            60: <li>Bad RPM Versions</li>
        !            61: <li>Out-of-date RPMS</li>
        !            62: <li>Newer than expected RPMS</li>
        !            63: <li>RPMS external to LON-CAPA</li>
        !            64: </ul>
        !            65: <font size="+2">About this file</font>
        !            66: <p>
1.1       harris41   67: This file is generated dynamically by <tt>make rpmstatuspost</tt>
                     68: when this command is entered in the CVS:loncom/build directory.
1.7     ! harris41   69: </p>
1.1       harris41   70: END
                     71:     print <<END;
1.7     ! harris41   72: <font size="+2">Differing RPM Versions</font>
        !            73: <pre>
1.1       harris41   74: END
                     75: foreach my $rpminfo (@badversionrpms) {
                     76:     print $rpminfo;
                     77: }
                     78: print <<END;
1.7     ! harris41   79: </pre>
1.1       harris41   80: END
                     81: print <<END;
1.7     ! harris41   82: <font size="+2">Out-of-date RPMS</font>
        !            83: <pre>
1.1       harris41   84: END
                     85: foreach my $rpminfo (@oldrpms) {
                     86:     print $rpminfo;
                     87: }
                     88: print <<END;
1.7     ! harris41   89: </pre>
1.1       harris41   90: END
                     91: print <<END;
1.7     ! harris41   92: <font size="+2">Newer than expected RPMS</font>
        !            93: <pre>
1.1       harris41   94: END
                     95: foreach my $rpminfo (@newrpms) {
                     96:     print $rpminfo;
                     97: }
                     98: print <<END;
1.7     ! harris41   99: </pre>
1.1       harris41  100: END
                    101: print <<END;
1.7     ! harris41  102: <font size="+2">RPMS external to LON-CAPA</font>
        !           103: <pre>
1.1       harris41  104: END
                    105: foreach my $rpminfo (@externalrpms) {
                    106:     print $rpminfo;
                    107: }
                    108: print <<END;
1.7     ! harris41  109: </pre>
1.1       harris41  110: END

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