[LON-CAPA-cvs] cvs: loncom /build/system_dependencies perltest.pl
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 22 Aug 2003 19:56:03 -0000
albertel Fri Aug 22 15:56:03 2003 EDT
Modified files:
/loncom/build/system_dependencies perltest.pl
Log:
- remove some repeated code
- add in the Module name to the outptu logs, easier to use CPAN this way
Index: loncom/build/system_dependencies/perltest.pl
diff -u loncom/build/system_dependencies/perltest.pl:1.10 loncom/build/system_dependencies/perltest.pl:1.11
--- loncom/build/system_dependencies/perltest.pl:1.10 Mon Feb 3 13:03:52 2003
+++ loncom/build/system_dependencies/perltest.pl Fri Aug 22 15:56:02 2003
@@ -2,7 +2,7 @@
# perltest.pl - script to test the status of perl modules on a LON-CAPA system
#
-# $Id: perltest.pl,v 1.10 2003/02/03 18:03:52 harris41 Exp $
+# $Id: perltest.pl,v 1.11 2003/08/22 19:56:02 albertel Exp $
#
###
@@ -158,7 +158,7 @@
=cut
# =================================== Process version information of this file.
-my $VERSION = sprintf("%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/);
+my $VERSION = sprintf("%d.%02d", q$Revision: 1.11 $ =~ /(\d+)\.(\d+)/);
# ========================== Determine the mode that this script should run in.
my $mode;
@@ -331,98 +331,57 @@
my @stable_veryokay;
# ===== Loop through all of the needed CPAN distributions and probe the system.
-foreach my $dist (keys %dist_module_hash)
- {
+foreach my $dist (keys %dist_module_hash) {
my $module = $dist_module_hash{$dist};
my $fs = $modulefs_hash{$module};
my $fsflag = 0;
- if ($big_module_string =~ /$fs/)
- {
- $fsflag = 1;
- }
+ if ($big_module_string =~ /$fs/) { $fsflag = 1; }
my ($vok,$vstr);
- ($vok,$vstr) = have_vers($module,$module_dev_version_hash{$module});
- # print "fsflag: $fsflag, vok: $vok, vstr: $vstr, fs: $fs\n";
- if ($fsflag and !$vok and $vstr=~/not found/)
- {
- push(@dev_missing,'MISSING '.$dist.' (want distribution version '.
- $dist_dev_version_hash{$dist}.') ?'."\n");
- # The question mark indicates there was a pattern match in the
- # big_module_string which would be unexpected.
- # There is no usual reason to tell the normal LON-CAPA user about this
- # question mark. This is just source code magic.
- }
- elsif (!$fsflag and !$vok and $vstr=~/not found/)
- {
- push(@dev_missing,'MISSING '.$dist.' (want distribution version '.
- $dist_dev_version_hash{$dist}.')'."\n");
- }
- elsif ($fsflag and !$vok and $vstr!~/not found/)
- {
- push(@dev_outdated,'OUTDATED '.$dist.' wanted module: v'.
- $module_dev_version_hash{$module}.'; '.$vstr.' (VERSION_FROM is '.
- $fs.') want dist version '.$dist_dev_version_hash{$dist}.'.'.
- "\n");
- }
- elsif ($fsflag)
- {
- $vstr=~/found v(.*)/;
- my $vc=$1;
- if ($vc eq $module_dev_version_hash{$module})
- {
- push(@dev_veryokay,'VERYOKAY '.$dist.' wanted: v'.
- $module_dev_version_hash{$module}.'; '.$vstr.
- ' (VERSION_FROM is '.$fs.') want dist version '.
- $dist_dev_version_hash{$dist}."\n");
- }
- else
- {
- push(@dev_okay,'OKAY '.$dist.' wanted: v'.
- $module_dev_version_hash{$module}.'; '.$vstr.
- ' (VERSION_FROM is '.$fs.').'."\n");
- }
- }
- ($vok,$vstr) = have_vers($module,$module_stable_version_hash{$module});
- if ($fsflag and !$vok and $vstr=~/not found/)
- {
- push(@stable_missing,'MISSING '.$dist.' (want distribution version '.
- $dist_stable_version_hash{$dist}.') ?'."\n");
- # The question mark indicates there was a pattern match in the
- # big_module_string which would be unexpected.
- # There is no usual reason to tell the normal LON-CAPA user about this
- # question mark. This is just source code magic.
- }
- elsif (!$fsflag and !$vok and $vstr=~/not found/)
- {
- push(@stable_missing,'MISSING '.$dist.' (want distribution version '.
- $dist_stable_version_hash{$dist}.')'."\n");
- }
- elsif ($fsflag and !$vok and $vstr!~/not found/)
- {
- push(@stable_outdated,'OUTDATED '.$dist.' wanted module: v'.
- $module_stable_version_hash{$module}.'; '.$vstr.
- ' (VERSION_FROM is '.$fs.') want dist version '.
- $dist_stable_version_hash{$dist}.'.'."\n");
- }
- elsif ($fsflag)
- {
- $vstr=~/found v(.*)/;
- my $vc=$1;
- if ($vc eq $module_stable_version_hash{$module})
- {
- push(@stable_veryokay,'VERYOKAY '.$dist.' wanted: v'.
- $module_stable_version_hash{$module}.'; '.$vstr.
- ' (VERSION_FROM is '.$fs.') want dist version '.
- $dist_stable_version_hash{$dist}."\n");
- }
- else
- {
- push(@stable_okay,'OKAY '.$dist.' wanted: v'.
- $module_stable_version_hash{$module}.'; '.$vstr.
- ' (VERSION_FROM is '.$fs.').'."\n");
- }
- }
- }
+ foreach my $type ('dev','stable') {
+ my ($vers_mod,$vers_dist);
+ my ($missing_ref,$outdated_ref,$veryokay_ref,$okay_ref);
+ if ($type eq 'dev') {
+ $vers_mod=$module_dev_version_hash{$module};
+ $vers_dist=$dist_dev_version_hash{$dist};
+ ($missing_ref,$outdated_ref,$veryokay_ref,$okay_ref)=
+ (\@dev_missing,\@dev_outdated,\@dev_veryokay,\@dev_okay);
+ } elsif ($type eq 'stable') {
+ $vers_mod=$module_stable_version_hash{$module};
+ $vers_dist=$dist_stable_version_hash{$dist};
+ ($missing_ref,$outdated_ref,$veryokay_ref,$okay_ref)=
+ (\@stable_missing,\@stable_outdated,\@stable_veryokay,
+ \@stable_okay);
+ }
+ ($vok,$vstr) = have_vers($module,$vers_mod);
+ # print "fsflag: $fsflag, vok: $vok, vstr: $vstr, fs: $fs\n";
+ if ($fsflag and !$vok and $vstr=~/not found/) {
+ push(@$missing_ref,'MISSING '.$dist.' (want distribution '.
+ $module.' version '. $vers_dist.') ?'."\n");
+ # The question mark indicates there was a pattern match in the
+ # big_module_string which would be unexpected.
+ # There is no usual reason to tell the normal LON-CAPA user about this
+ # question mark. This is just source code magic.
+ } elsif (!$fsflag and !$vok and $vstr=~/not found/) {
+ push(@$missing_ref,'MISSING '.$dist.' (want distribution '.
+ $module.' version '.$vers_dist.')'."\n");
+ } elsif ($fsflag and !$vok and $vstr!~/not found/) {
+ push(@$outdated_ref,'OUTDATED '.$dist.' wanted module: v'.
+ $vers_mod.'; '.$vstr.' (VERSION_FROM is '.
+ $fs.') want dist '.$module.' version '.$vers_dist.'.'. "\n");
+ } elsif ($fsflag) {
+ $vstr=~/found v(.*)/;
+ my $vc=$1;
+ if ($vc eq $vers_mod) {
+ push(@$veryokay_ref,'VERYOKAY '.$dist.' wanted: v'.
+ $vers_mod.'; '.$vstr.' (VERSION_FROM is '.$fs.
+ ') want dist '.$module.' version '.$vers_dist."\n");
+ } else {
+ push(@$okay_ref,'OKAY '.$dist.' wanted: v'.
+ $vers_mod.'; '.$vstr.' (VERSION_FROM is '.$fs.').'."\n");
+ }
+ }
+ }
+}
print("\n".'SYNOPSIS'."\n");