File:  [LON-CAPA] / loncom / build / rpmparse.pl
Revision 1.7: download - view: text, annotated - select for diffs
Wed Apr 4 12:48:55 2001 UTC (23 years, 3 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
fixing up phrases and xmlifying a little -Scott

    1: #!/usr/bin/perl
    2: 
    3: my ($standard,$current)=@ARGV;
    4: 
    5: $standard=~s/[^\/\w\.]//g;
    6: $current=~s/[^\/\w\.]//g;
    7: my %svhash;
    8: my %sbhash;
    9: 
   10: my @oldrpms;
   11: my @badversionrpms;
   12: my @newrpms;
   13: my @externalrpms;
   14: 
   15: open IN, "<$standard";
   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: 
   24: open IN, "<$current";
   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) {
   33: 	    push @newrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
   34: 	}
   35: 	if ($sbhash{$name}>$buildtime) {
   36: 	    push @oldrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
   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;
   46: my $hostname=`hostname`; chop $hostname;
   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
   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>
   67: This file is generated dynamically by <tt>make rpmstatuspost</tt>
   68: when this command is entered in the CVS:loncom/build directory.
   69: </p>
   70: END
   71:     print <<END;
   72: <font size="+2">Differing RPM Versions</font>
   73: <pre>
   74: END
   75: foreach my $rpminfo (@badversionrpms) {
   76:     print $rpminfo;
   77: }
   78: print <<END;
   79: </pre>
   80: END
   81: print <<END;
   82: <font size="+2">Out-of-date RPMS</font>
   83: <pre>
   84: END
   85: foreach my $rpminfo (@oldrpms) {
   86:     print $rpminfo;
   87: }
   88: print <<END;
   89: </pre>
   90: END
   91: print <<END;
   92: <font size="+2">Newer than expected RPMS</font>
   93: <pre>
   94: END
   95: foreach my $rpminfo (@newrpms) {
   96:     print $rpminfo;
   97: }
   98: print <<END;
   99: </pre>
  100: END
  101: print <<END;
  102: <font size="+2">RPMS external to LON-CAPA</font>
  103: <pre>
  104: END
  105: foreach my $rpminfo (@externalrpms) {
  106:     print $rpminfo;
  107: }
  108: print <<END;
  109: </pre>
  110: END

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