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

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:     print "<br>$type $package\n";
        !            59:     if (!$chash{$package}) {
        !            60: 	push @barerpms,"$package is missing and is of basic necessity to a LON-CAPA system\n" if $type eq 'Y';
        !            61: 	push @developrpms,"$package is missing and may be useful for a LON-CAPA system\n" if $type eq 'N';
        !            62:     }
        !            63: }
        !            64: close IN;
        !            65: 
1.1       harris41   66: my $date=`date`; chop $date;
1.3       harris41   67: my $hostname=`hostname`; chop $hostname;
1.1       harris41   68: print <<END;
1.7       harris41   69: <html>
                     70: <head>
                     71: <title>LON-CAPA Software RPM Status Page</title>
                     72: </head>
                     73: <body>
                     74: <font size="+2">LON-CAPA Software RPM Status Page
                     75: (done on $date for $hostname)</font>
                     76: <br />Michigan State University
                     77: <br />Learning Online with CAPA
                     78: <br />Contact korte\@lon-capa.org
                     79: <ul>
1.8     ! harris41   80: <li>Important warnings</li>
1.7       harris41   81: <li>About this file</li>
                     82: <li>Bad RPM Versions</li>
                     83: <li>Out-of-date RPMS</li>
                     84: <li>Newer than expected RPMS</li>
                     85: <li>RPMS external to LON-CAPA</li>
1.8     ! harris41   86: <li>RPMS from the "bare minimum" set that you are missing</li>
        !            87: <li>RPMS from the "development" set that you are missing</li>
1.7       harris41   88: </ul>
1.8     ! harris41   89: <font size="+2">Important warnings</font>
        !            90: <p>
        !            91: <b>Never install LON-CAPA-setup</b> on a running LON-CAPA machine.
        !            92: This RPM package contains pre-installation files such as 
        !            93: /etc/group and /etc/passwd.  You will lose all access to your
        !            94: machine if you install this RPM.
        !            95: </p>
        !            96: <p>
        !            97: If you are doing CVS-based upgrades of your LON-CAPA
        !            98: software, then you do not need to upgrade your LON-CAPA-base
        !            99: RPM.  Upgrading with the LON-CAPA-base RPM
        !           100: will cause you to lose many of your system-specific
        !           101: configuration settings.
        !           102: </p>
        !           103: <p>
        !           104: DO NOT UPGRADE YOUR KERNEL UNLESS YOU KNOW WHAT YOU ARE DOING.
        !           105: Kernel upgrading involves packages beginning with the word
        !           106: "kernel".
        !           107: </p>
1.7       harris41  108: <font size="+2">About this file</font>
                    109: <p>
1.1       harris41  110: This file is generated dynamically by <tt>make rpmstatuspost</tt>
                    111: when this command is entered in the CVS:loncom/build directory.
1.7       harris41  112: </p>
1.8     ! harris41  113: <p>
        !           114: Managing software packages on any system, testing different
        !           115: sets of software packages, tracking their dependencies, and maintaining
        !           116: configuration information is an inexact science.  While the LON-CAPA
        !           117: recommended set of RPMs is a tested set with no missing dependencies,
        !           118: we still highly recommend that RPM upgrades are only performed
        !           119: by those with significant knowledge about standard Linux operating
        !           120: systems.
        !           121: </p>
1.1       harris41  122: END
                    123:     print <<END;
1.7       harris41  124: <font size="+2">Differing RPM Versions</font>
                    125: <pre>
1.1       harris41  126: END
                    127: foreach my $rpminfo (@badversionrpms) {
                    128:     print $rpminfo;
                    129: }
                    130: print <<END;
1.7       harris41  131: </pre>
1.1       harris41  132: END
                    133: print <<END;
1.7       harris41  134: <font size="+2">Out-of-date RPMS</font>
                    135: <pre>
1.1       harris41  136: END
                    137: foreach my $rpminfo (@oldrpms) {
                    138:     print $rpminfo;
                    139: }
                    140: print <<END;
1.7       harris41  141: </pre>
1.1       harris41  142: END
                    143: print <<END;
1.7       harris41  144: <font size="+2">Newer than expected RPMS</font>
                    145: <pre>
1.1       harris41  146: END
                    147: foreach my $rpminfo (@newrpms) {
                    148:     print $rpminfo;
                    149: }
                    150: print <<END;
1.7       harris41  151: </pre>
1.1       harris41  152: END
                    153: print <<END;
1.7       harris41  154: <font size="+2">RPMS external to LON-CAPA</font>
                    155: <pre>
1.1       harris41  156: END
                    157: foreach my $rpminfo (@externalrpms) {
1.8     ! harris41  158:     print $rpminfo;
        !           159: }
        !           160: print <<END;
        !           161: </pre>
        !           162: END
        !           163: print <<END;
        !           164: <font size="+2">RPMS from the "bare minimum" set that you are missing</font>
        !           165: <pre>
        !           166: END
        !           167: foreach my $rpminfo (@barerpms) {
        !           168:     print $rpminfo;
        !           169: }
        !           170: print <<END;
        !           171: </pre>
        !           172: END
        !           173: print <<END;
        !           174: <font size="+2">RPMS from the "development" set that you are missing</font>
        !           175: <pre>
        !           176: END
        !           177: foreach my $rpminfo (@developrpms) {
1.1       harris41  178:     print $rpminfo;
                    179: }
                    180: print <<END;
1.7       harris41  181: </pre>
1.1       harris41  182: END

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