The perl-XML-Simple setup script,
/opt/oscar/share/prereqs/perl-XML-Simple/scripts/setup , has a couple
of problems.

The first one is already known, and is described at
http://sourceforge.net/tracker/index.php?func=detail&aid=1410346&group_id=9368&atid=109368
    check for version of perl-XML-Simple in OSCAR 4.2.1 it seems that
    currently OSCAR 4.2.1 to install perl-XML-Simple just checks to see
    if it is installed, and does not actually check the version.

This one did not affect me; I just came across it while looking to see
if the second problem was already known.

The other problem is that if perl-XML-Simple is not already installed,
the script searches /tftpboot/rpm for a file name matching $real_name,
where $real_name = "perl-XML-Simple" _but_ if it finds a match, it then
tries to install it with:
    system("rpm -Uvh /tftpboot/rpm/$real_name-$ver.noarch.rpm");
where the file name expands to perl-XML-Simple-2.14-2.1.el3.rf.noarch.rpm

If OSCAR requires this exact version, then this is what should have been
searched for in /tftpboot/rpm. As it is, if the file that was found does
not have an exactly matching version, the rpm command fails, and returns
a non-zero exit code. The script does not look at the returned value,
but simply reports, "--> XML::Simple installed successfully".

It may currently be the case that for any and all Linux distributions
supported by OSCAR the file found in /tftpboot/rpm will always be
specifically perl-XML-Simple-2.14-2.1.el3.rf.noarch.rpm, but it seems
unwise for the script to rely upon this.

If OSCAR does not require that exact version, then the rpm command should
use the name of the file that it actually found.


Note: These problems have a simple workaround: make sure a suitable
version of perl-XML-Simple is installed before (re-)running
install_cluster.


Here is a first cut at a patch for these two issues. It has only been
tested superficially.

If more than one matching file is found in /tftpboot/rpm (unlikely,
but possible) the one that sorts the highest is used; it may or may not
turn out to be the newest.

--- setup.orig  2005-10-28 12:43:30.000000000 -0700
+++ setup       2006-04-25 16:14:38.000000000 -0700
@@ -20,6 +20,7 @@
 my $ver = "2.14-2.1.el3.rf";
 my $real_name = "perl-XML-Simple";
 my $module_name = "XML::Simple";
+my $module_min_ver = 2.14;
 
 # Helper subroutine
 
@@ -33,10 +34,10 @@
 # See if we need to install the perl module
 
 oscar_log_subsection("Checking to see if we need to install $module_name");
-my $eval_str = "{ require $module_name }";
+my $eval_str = "{ use $module_name $module_min_ver }";
 eval $eval_str;
 if ($@) {
-    oscar_log_subsection("$module_name is not yet installed");
+    oscar_log_subsection("$module_name is not yet installed or is too old");
 
     my $topdir = "$ENV{OSCAR_HOME}/share/prereqs/$real_name";
     #my $tarball = "$topdir/media/$real_name-$ver.tar.gz";
@@ -52,18 +53,29 @@
     my @rpmsindir = readdir(RPMS);
     closedir(RPMS);
     # check if the rpm is in /tftpboot/rpm
-    if ( !(grep( /^$real_name/, @rpmsindir ) ) ) {
+    my @matches = sort grep /^$real_name/, @rpmsindir;
+    my $filename;
+    if (@matches) {
+       $filename = pop @matches; # normally the only element
+    } else {
        # there's no package there, copying one from sis's
        system ("cp $rpmsdir/$real_name-$ver.noarch.rpm /tftpboot/rpm");
+       $filename = "$real_name-$ver.noarch.rpm";
     }
     #check if the package is already installed and if it's not...
     if ( `rpm -qa | grep -c $real_name` == 0 ) {
-       system("rpm -Uvh /tftpboot/rpm/$real_name-$ver.noarch.rpm");
+       system("rpm -Uvh /tftpboot/rpm/$filename");
     } else {
        print "The package $real_name is already installed";
     }
-    
-    oscar_log_subsection("$module_name installed successfully");
+    # are things ok now?
+    eval $eval_str;
+    if ($@) {
+       print "[EMAIL PROTECTED]";
+       oscar_log_subsection("Install of $module_name failed");
+    } else {
+       oscar_log_subsection("$module_name installed successfully");
+    }
 
     chdir($pwd);
     system("rm -rf $tempdir");

-- 
Ted Powell <[EMAIL PROTECTED]>   http://psg.com/~ted/
"If you don't look, you don't know."
    Dr. Sam Ting, Nobel laureate experimental physicist.


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Oscar-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oscar-users

Reply via email to