version 1.8, 2002/09/08 15:53:26
|
version 1.11, 2003/08/22 19:56:02
|
Line 16 B<perltest.pl> - Test status of perl mod
|
Line 16 B<perltest.pl> - Test status of perl mod
|
|
|
# Written to help LON-CAPA (The LearningOnline Network with CAPA) |
# Written to help LON-CAPA (The LearningOnline Network with CAPA) |
# |
# |
# YEAR=2001 |
|
# 9/30 Scott Harrison |
|
# YEAR 2002 and onwards |
|
# Scott Harrison, sharrison@users.sourceforge.net |
|
|
|
=pod |
=pod |
|
|
Line 142 Ratings: 1=horrible 2=poor 3=fair 4=good
|
Line 138 Ratings: 1=horrible 2=poor 3=fair 4=good
|
|
|
=head1 AUTHOR |
=head1 AUTHOR |
|
|
Scott Harrison, sharrison@users.sourceforge.net, 2001, 2002 |
|
|
|
This software is distributed under the General Public License, |
This software is distributed under the General Public License, |
version 2, June 1991 (which is the same terms as LON-CAPA). |
version 2, June 1991 (which is the same terms as LON-CAPA). |
|
|
Line 337 my @stable_okay;
|
Line 331 my @stable_okay;
|
my @stable_veryokay; |
my @stable_veryokay; |
|
|
# ===== Loop through all of the needed CPAN distributions and probe the system. |
# ===== 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 $module = $dist_module_hash{$dist}; |
my $fs = $modulefs_hash{$module}; |
my $fs = $modulefs_hash{$module}; |
my $fsflag = 0; |
my $fsflag = 0; |
if ($big_module_string =~ /$fs/) |
if ($big_module_string =~ /$fs/) { $fsflag = 1; } |
{ |
|
$fsflag = 1; |
|
} |
|
my ($vok,$vstr); |
my ($vok,$vstr); |
($vok,$vstr) = have_vers($module,$module_dev_version_hash{$module}); |
foreach my $type ('dev','stable') { |
# print "fsflag: $fsflag, vok: $vok, vstr: $vstr, fs: $fs\n"; |
my ($vers_mod,$vers_dist); |
if ($fsflag and !$vok and $vstr=~/not found/) |
my ($missing_ref,$outdated_ref,$veryokay_ref,$okay_ref); |
{ |
if ($type eq 'dev') { |
push(@dev_missing,'MISSING '.$dist.' (want distribution version '. |
$vers_mod=$module_dev_version_hash{$module}; |
$dist_dev_version_hash{$dist}.') ?'."\n"); |
$vers_dist=$dist_dev_version_hash{$dist}; |
# The question mark indicates there was a pattern match in the |
($missing_ref,$outdated_ref,$veryokay_ref,$okay_ref)= |
# big_module_string which would be unexpected. |
(\@dev_missing,\@dev_outdated,\@dev_veryokay,\@dev_okay); |
# There is no usual reason to tell the normal LON-CAPA user about this |
} elsif ($type eq 'stable') { |
# question mark. This is just source code magic. |
$vers_mod=$module_stable_version_hash{$module}; |
} |
$vers_dist=$dist_stable_version_hash{$dist}; |
elsif (!$fsflag and !$vok and $vstr=~/not found/) |
($missing_ref,$outdated_ref,$veryokay_ref,$okay_ref)= |
{ |
(\@stable_missing,\@stable_outdated,\@stable_veryokay, |
push(@dev_missing,'MISSING '.$dist.' (want distribution version '. |
\@stable_okay); |
$dist_dev_version_hash{$dist}.')'."\n"); |
} |
} |
($vok,$vstr) = have_vers($module,$vers_mod); |
elsif ($fsflag and !$vok and $vstr!~/not found/) |
# print "fsflag: $fsflag, vok: $vok, vstr: $vstr, fs: $fs\n"; |
{ |
if ($fsflag and !$vok and $vstr=~/not found/) { |
push(@dev_outdated,'OUTDATED '.$dist.' wanted module: v'. |
push(@$missing_ref,'MISSING '.$dist.' (want distribution '. |
$module_dev_version_hash{$module}.'; '.$vstr.' (VERSION_FROM is '. |
$module.' version '. $vers_dist.') ?'."\n"); |
$fs.') want dist version '.$dist_dev_version_hash{$dist}.'.'. |
# The question mark indicates there was a pattern match in the |
"\n"); |
# big_module_string which would be unexpected. |
} |
# There is no usual reason to tell the normal LON-CAPA user about this |
elsif ($fsflag) |
# question mark. This is just source code magic. |
{ |
} elsif (!$fsflag and !$vok and $vstr=~/not found/) { |
$vstr=~/found v(.*)/; |
push(@$missing_ref,'MISSING '.$dist.' (want distribution '. |
my $vc=$1; |
$module.' version '.$vers_dist.')'."\n"); |
if ($vc eq $module_dev_version_hash{$module}) |
} elsif ($fsflag and !$vok and $vstr!~/not found/) { |
{ |
push(@$outdated_ref,'OUTDATED '.$dist.' wanted module: v'. |
push(@dev_veryokay,'VERYOKAY '.$dist.' wanted: v'. |
$vers_mod.'; '.$vstr.' (VERSION_FROM is '. |
$module_dev_version_hash{$module}.'; '.$vstr. |
$fs.') want dist '.$module.' version '.$vers_dist.'.'. "\n"); |
' (VERSION_FROM is '.$fs.') want dist version '. |
} elsif ($fsflag) { |
$dist_dev_version_hash{$dist}."\n"); |
$vstr=~/found v(.*)/; |
} |
my $vc=$1; |
else |
if ($vc eq $vers_mod) { |
{ |
push(@$veryokay_ref,'VERYOKAY '.$dist.' wanted: v'. |
push(@dev_okay,'OKAY '.$dist.' wanted: v'. |
$vers_mod.'; '.$vstr.' (VERSION_FROM is '.$fs. |
$module_dev_version_hash{$module}.'; '.$vstr. |
') want dist '.$module.' version '.$vers_dist."\n"); |
' (VERSION_FROM is '.$fs.').'."\n"); |
} else { |
} |
push(@$okay_ref,'OKAY '.$dist.' wanted: v'. |
} |
$vers_mod.'; '.$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"); |
|
} |
|
} |
|
} |
|
|
|
print("\n".'SYNOPSIS'."\n"); |
print("\n".'SYNOPSIS'."\n"); |
|
|
# ========================================================== The stable report. |
# ========================================================== The stable report. |
print('**** STABLE REPORT (what a production server should worry about)'."\n"); |
print('**** STABLE REPORT (what a production server should worry about)'."\n"); |
if (@stable_missing) { |
if (@stable_missing) |
|
{ |
print('There are '.scalar(@stable_missing).' CPAN distributions missing '. |
print('There are '.scalar(@stable_missing).' CPAN distributions missing '. |
'from this LON-CAPA system.'."\n"); |
'from this LON-CAPA system.'."\n"); |
} |
} |
else { |
else |
|
{ |
print('All perl modules needed by LON-CAPA appear to be present.'."\n"); |
print('All perl modules needed by LON-CAPA appear to be present.'."\n"); |
} |
} |
if (@stable_outdated) { |
if (@stable_outdated) |
|
{ |
print(scalar(@stable_outdated).' CPAN distributions are out-dated '. |
print(scalar(@stable_outdated).' CPAN distributions are out-dated '. |
'on this LON-CAPA system.'."\n"); |
'on this LON-CAPA system.'."\n"); |
} |
} |
if (@stable_veryokay) { |
if (@stable_veryokay) |
|
{ |
print(scalar(@stable_veryokay).' CPAN distributions are an exact match '. |
print(scalar(@stable_veryokay).' CPAN distributions are an exact match '. |
'(based on version number).'."\n"); |
'(based on version number).'."\n"); |
# print @stable_veryokay; |
# print @stable_veryokay; |
} |
} |
if (@stable_okay) { |
if (@stable_okay) |
|
{ |
print(scalar(@stable_okay).' CPAN dists have a version number '. |
print(scalar(@stable_okay).' CPAN dists have a version number '. |
'higher than expected'. |
'higher than expected'. |
' (probably okay).'. "\n"); |
' (probably okay).'. "\n"); |
} |
} |
print("\n"); |
print("\n"); |
|
|
# ===================================================== The development report. |
# ===================================================== The development report. |
print('**** DEVELOPMENT REPORT (do not worry about this unless you are a'. |
print('**** DEVELOPMENT REPORT (do not worry about this unless you are a'. |
' coder)'."\n"); |
' coder)'."\n"); |
if (@dev_missing) { |
if (@dev_missing) |
|
{ |
print('There are '.scalar(@dev_missing).' CPAN distributions missing '. |
print('There are '.scalar(@dev_missing).' CPAN distributions missing '. |
'from this LON-CAPA system.'."\n"); |
'from this LON-CAPA system.'."\n"); |
} |
} |
else { |
else |
|
{ |
print('All perl modules needed by LON-CAPA appear to be present.'."\n"); |
print('All perl modules needed by LON-CAPA appear to be present.'."\n"); |
} |
} |
if (@dev_outdated) { |
if (@dev_outdated) |
|
{ |
print(scalar(@dev_outdated).' CPAN distributions are out-dated '. |
print(scalar(@dev_outdated).' CPAN distributions are out-dated '. |
'on this LON-CAPA system.'."\n"); |
'on this LON-CAPA system.'."\n"); |
} |
} |
if (@dev_veryokay) { |
if (@dev_veryokay) |
|
{ |
print(scalar(@dev_veryokay).' CPAN distributions are an exact match '. |
print(scalar(@dev_veryokay).' CPAN distributions are an exact match '. |
'(based on version number).'."\n"); |
'(based on version number).'."\n"); |
# print @dev_veryokay; |
# print @dev_veryokay; |
} |
} |
if (@dev_okay) { |
if (@dev_okay) |
|
{ |
print(scalar(@stable_okay).' CPAN dists have a version number '. |
print(scalar(@stable_okay).' CPAN dists have a version number '. |
'higher than expected'. |
'higher than expected'. |
' (probably okay).'. "\n"); |
' (probably okay).'. "\n"); |
} |
} |
|
|
if ($mode eq 'synopsis') { |
my $detailstream; |
|
if ($mode eq 'synopsis') |
|
{ |
print("\n".'**** NOTE ****'."\n". |
print("\n".'**** NOTE ****'."\n". |
'After everything completes, please view the CPAN_STATUS_REPORT'. |
'After everything completes, please view the CPAN_STATUS_REPORT'. |
' file for more '."\n".'information on resolving your perl modules.'. |
' file for more '."\n".'information on resolving your perl modules.'. |
Line 490 if ($mode eq 'synopsis') {
|
Line 455 if ($mode eq 'synopsis') {
|
|
|
print('* HIT RETURN WHEN READY TO CONTINUE *'."\n"); |
print('* HIT RETURN WHEN READY TO CONTINUE *'."\n"); |
my $returnkey=<>; |
my $returnkey=<>; |
} |
open(OUT,'>CPAN_STATUS_REPORT'); |
else { |
$detailstream=\*OUT; |
print("\n".'DETAILED STATUS REPORT'."\n"); # Header of status report. |
} |
|
else |
# Print advisory notices. |
{ |
print("\n".'(Consult loncapa/doc/otherfiles/perl_modules.txt for '. |
$detailstream=\*STDOUT; |
'information on'."\n". |
} |
' manual build instructions.)'."\n"); |
print($detailstream |
print("\n".'(**** IMPORTANT NOTICE **** HTML-Parser needs to be patched '. |
"\n".'DETAILED STATUS REPORT'."\n"); # Header of status report. |
"\n".' as described in loncapa/doc/otherfiles/perl_modules.txt)'. |
|
"\n"); |
|
|
|
print("\n".'For manual installation of CPAN distributions, visit'."\n". |
|
'http://search.cpan.org/dist/DistName'."\n". |
|
'where DistName is something like "HTML-Parser" or "libwww-perl".'. |
|
"\n"); |
|
|
|
print("\n".'For automatic installation of CPAN distributions, visit'."\n". |
# Print advisory notices. |
'http://install.lon-capa.org/resources/cpanauto/DistName.bin'."\n". |
print($detailstream |
'where DistName.bin is something like "HTML-Parser.bin" or '. |
"\n".'(Consult loncapa/doc/otherfiles/perl_modules.txt for '. |
'"libwww-perl.bin".'."\n"); |
'information on'."\n". |
|
' manual build instructions.)'."\n"); |
# Print detailed report of stable. |
print($detailstream |
print("\n".'STABLE (DETAILED REPORT)'."\n"); |
"\n".'(**** IMPORTANT NOTICE **** HTML-Parser needs to be patched '. |
print @stable_missing; |
"\n".' as described in loncapa/doc/otherfiles/perl_modules.txt)'. |
print @stable_outdated; |
"\n"); |
print @stable_veryokay; |
|
print @stable_okay; |
print($detailstream |
print("\n".'DEVELOPMENT (DETAILED REPORT)'."\n"); |
"\n".'For manual installation of CPAN distributions, visit'."\n". |
print @dev_missing; |
'http://search.cpan.org/dist/DistName'."\n". |
print @dev_outdated; |
'where DistName is something like "HTML-Parser" or "libwww-perl".'. |
print @dev_veryokay; |
"\n"); |
print @dev_okay; |
|
} |
print($detailstream |
|
"\n".'For automatic installation of CPAN distributions, visit'."\n". |
|
'http://install.lon-capa.org/resources/cpanauto/DistName.bin'."\n". |
|
'where DistName.bin is something like "HTML-Parser.bin" or '. |
|
'"libwww-perl.bin".'."\n"); |
|
|
|
# Print detailed report of stable. |
|
print($detailstream |
|
"\n".'STABLE (DETAILED REPORT)'."\n"); |
|
print $detailstream @stable_missing; |
|
print $detailstream @stable_outdated; |
|
print $detailstream @stable_veryokay; |
|
print $detailstream @stable_okay; |
|
print($detailstream "\n".'DEVELOPMENT (DETAILED REPORT)'."\n"); |
|
print $detailstream @dev_missing; |
|
print $detailstream @dev_outdated; |
|
print $detailstream @dev_veryokay; |
|
print $detailstream @dev_okay; |
|
|
if ($mode eq "html") { |
if ($mode eq "html") |
|
{ |
print(<<END); |
print(<<END); |
</pre> |
</pre> |
</body> |
</body> |
</html> |
</html> |
END |
END |
} |
} |
|
|
# ================================================================ Subroutines. |
# ================================================================ Subroutines. |
# Note that "vers_cmp" and "have_vers" are adapted from a bugzilla version 2.16 |
# Note that "vers_cmp" and "have_vers" are adapted from a bugzilla version 2.16 |