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, 1 month ago) by harris41
Branches: MAIN
CVS tags: HEAD
fixing up phrases and xmlifying a little -Scott

#!/usr/bin/perl

my ($standard,$current)=@ARGV;

$standard=~s/[^\/\w\.]//g;
$current=~s/[^\/\w\.]//g;
my %svhash;
my %sbhash;

my @oldrpms;
my @badversionrpms;
my @newrpms;
my @externalrpms;

open IN, "<$standard";
while(<IN>) {
    chop;
    my ($name,$version,$buildtime)=split(/\s+/);
    $svhash{$name}=$version;
    $sbhash{$name}=$buildtime;
}
close IN;

open IN, "<$current";
while(<IN>) {
    chop;
    my ($name,$version,$buildtime)=split(/\s+/);
    if ($svhash{$name}) {
	unless ($svhash{$name} eq $version) {
	    push @badversionrpms,"$name is version $version, should be $svhash{$name}\n";
	}
	if ($sbhash{$name}<$buildtime) {
	    push @newrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
	}
	if ($sbhash{$name}>$buildtime) {
	    push @oldrpms,"$name was built ".localtime($buildtime)." when the expected build time was ".localtime($sbhash{$name})."\n";
	}
    }
    else {
	push @externalrpms,"$name (built ".localtime($buildtime).") is an RPM not expected to ever be on a LON-CAPA system\n";
    }
}
close IN;

my $date=`date`; chop $date;
my $hostname=`hostname`; chop $hostname;
print <<END;
<html>
<head>
<title>LON-CAPA Software RPM Status Page</title>
</head>
<body>
<font size="+2">LON-CAPA Software RPM Status Page
(done on $date for $hostname)</font>
<br />Michigan State University
<br />Learning Online with CAPA
<br />Contact korte\@lon-capa.org
<ul>
<li>About this file</li>
<li>Bad RPM Versions</li>
<li>Out-of-date RPMS</li>
<li>Newer than expected RPMS</li>
<li>RPMS external to LON-CAPA</li>
</ul>
<font size="+2">About this file</font>
<p>
This file is generated dynamically by <tt>make rpmstatuspost</tt>
when this command is entered in the CVS:loncom/build directory.
</p>
END
    print <<END;
<font size="+2">Differing RPM Versions</font>
<pre>
END
foreach my $rpminfo (@badversionrpms) {
    print $rpminfo;
}
print <<END;
</pre>
END
print <<END;
<font size="+2">Out-of-date RPMS</font>
<pre>
END
foreach my $rpminfo (@oldrpms) {
    print $rpminfo;
}
print <<END;
</pre>
END
print <<END;
<font size="+2">Newer than expected RPMS</font>
<pre>
END
foreach my $rpminfo (@newrpms) {
    print $rpminfo;
}
print <<END;
</pre>
END
print <<END;
<font size="+2">RPMS external to LON-CAPA</font>
<pre>
END
foreach my $rpminfo (@externalrpms) {
    print $rpminfo;
}
print <<END;
</pre>
END

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