summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-10-27 22:15:12 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-10-27 22:15:12 +0000
commit2b8edcc678d4399ef602e199f35685717f277627 (patch)
treef0cfdd1efc646d1daa5f2b117fbe875ddd11e8b5 /gnu
parent1b99d7ba48e3798ea47681b5c32916cf172375e7 (diff)
stock perl 5.8.0 from CPAN
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/perl/utils/perlivp.PL181
1 files changed, 106 insertions, 75 deletions
diff --git a/gnu/usr.bin/perl/utils/perlivp.PL b/gnu/usr.bin/perl/utils/perlivp.PL
index c2f0a11f155..fd58e878248 100644
--- a/gnu/usr.bin/perl/utils/perlivp.PL
+++ b/gnu/usr.bin/perl/utils/perlivp.PL
@@ -33,12 +33,13 @@ $Config{'startperl'}
if \$running_under_some_shell;
!GROK!THIS!
-print OUT "\n# perlivp $^V\n";
-
# In the following, perl variables are not expanded during extraction.
print OUT <<'!NO!SUBS!';
+# perlivp V 0.02
+
+
sub usage {
warn "@_\n" if @_;
print << " EOUSAGE";
@@ -65,8 +66,8 @@ while ($ARGV[0] =~ /^-/) {
usage() if '?' =~ /\Q$flag/;
usage() if 'h' =~ /\Q$flag/;
usage() if 'H' =~ /\Q$flag/;
- usage("unknown flag: '$flag'") unless 'HhPpVv' =~ /\Q$flag/;
- warn "$0: '$flag' flag already set\n" if $opt{$flag}++;
+ usage("unknown flag: `$flag'") unless 'HhPpVv' =~ /\Q$flag/;
+ warn "$0: `$flag' flag already set\n" if $opt{$flag}++;
}
shift;
}
@@ -80,10 +81,12 @@ my $tests_total = 0;
!NO!SUBS!
-# We cannot merely check the variable '$^X' in general since on many
+# We cannot merely check the variable `$^X' in general since on many
# Unixes it is the basename rather than the full path to the perl binary.
my $perlpath = '';
if (defined($Config{'perlpath'})) { $perlpath = $Config{'perlpath'}; }
+# Of course some platforms are distinct...
+if ($^O eq 'VMS') { $perlpath = $^X; }
# The useithreads Config variable plays a role in whether or not
# threads and threads/shared work when C<use>d. They apparently always
@@ -98,78 +101,68 @@ my \$useithreads = '$useithreads';
print OUT <<'!NO!SUBS!';
-print "## Checking Perl binary via variable '\$perlpath' = $perlpath.\n" if $opt{'p'};
-
-my $label = 'Executable perl binary';
+print "## Checking Perl binary via variable `\$perlpath' = $perlpath.\n" if $opt{'p'};
if (-x $perlpath) {
- print "## Perl binary '$perlpath' appears executable.\n" if $opt{'v'};
- print "ok 1 $label\n";
+ print "## Perl binary `$perlpath' appears executable.\n" if $opt{'v'};
+ print "ok 1\n";
$pass__total++;
}
else {
- print "# Perl binary '$perlpath' does not appear executable.\n";
- print "not ok 1 $label\n";
+ print "# Perl binary `$perlpath' does not appear executable.\n";
+ print "not ok 1\n";
$error_total++;
}
$tests_total++;
-print "## Checking Perl version via variable '\$]'.\n" if $opt{'p'};
+print "## Checking Perl version via variable `\$]'.\n" if $opt{'p'};
!NO!SUBS!
print OUT <<"!GROK!THIS!";
-my \$ivp_VERSION = "$]";
+my \$ivp_VERSION = $];
!GROK!THIS!
print OUT <<'!NO!SUBS!';
-
-$label = 'Perl version correct';
-if ($ivp_VERSION eq $]) {
- print "## Perl version '$]' appears installed as expected.\n" if $opt{'v'};
- print "ok 2 $label\n";
+if ($ivp_VERSION == $]) {
+ print "## Perl version `$]' appears installed as expected.\n" if $opt{'v'};
+ print "ok 2\n";
$pass__total++;
}
else {
- print "# Perl version '$]' installed, expected $ivp_VERSION.\n";
- print "not ok 2 $label\n";
+ print "# Perl version `$]' installed, expected $ivp_VERSION.\n";
+ print "not ok 2\n";
$error_total++;
}
$tests_total++;
-# We have the right perl and version, so now reset @INC so we ignore
-# PERL5LIB and '.'
-{
- local $ENV{PERL5LIB};
- my $perl_V = qx($perlpath -V);
- $perl_V =~ s{.*\@INC:\n}{}ms;
- @INC = grep { length && $_ ne '.' } split ' ', $perl_V;
-}
-print "## Checking roots of the Perl library directory tree via variable '\@INC'.\n" if $opt{'p'};
+print "## Checking roots of the Perl library directory tree via variable `\@INC'.\n" if $opt{'p'};
my $INC_total = 0;
my $INC_there = 0;
foreach (@INC) {
next if $_ eq '.'; # skip -d test here
+ if ($^O eq 'MacOS') {
+ next if $_ eq ':'; # skip -d test here
+ next if $_ eq 'Dev:Pseudo:'; # why is this in @INC?
+ }
if (-d $_) {
- print "## Perl \@INC directory '$_' exists.\n" if $opt{'v'};
+ print "## Perl \@INC directory `$_' exists.\n" if $opt{'v'};
$INC_there++;
}
else {
- print "# Perl \@INC directory '$_' does not appear to exist.\n";
+ print "# Perl \@INC directory `$_' does not appear to exist.\n";
}
$INC_total++;
}
-
-$label = '@INC directoreis exist';
if ($INC_total == $INC_there) {
- print "ok 3 $label\n";
+ print "ok 3\n";
$pass__total++;
}
else {
- print "not ok 3 $label\n";
+ print "not ok 3\n";
$error_total++;
}
$tests_total++;
@@ -184,21 +177,20 @@ foreach (qw(Config.pm ExtUtils/Installed.pm)) {
$needed_total++;
eval "require \"$_\";";
if (!$@) {
- print "## Module '$_' appears to be installed.\n" if $opt{'v'};
+ print "## Module `$_' appears to be installed.\n" if $opt{'v'};
$needed_there++;
}
else {
- print "# Needed module '$_' does not appear to be properly installed.\n";
+ print "# Needed module `$_' does not appear to be properly installed.\n";
}
$@ = undef;
}
-$label = 'Modules needed for rest of perlivp exist';
if ($needed_total == $needed_there) {
- print "ok 4 $label\n";
+ print "ok 4\n";
$pass__total++;
}
else {
- print "not ok 4 $label\n";
+ print "not ok 4\n";
$error_total++;
}
$tests_total++;
@@ -218,27 +210,18 @@ if (defined($Config{'extensions'})) {
next if ($_ eq 'threads');
next if ($_ eq 'threads/shared');
}
- # that's a distribution name, not a module name
- next if $_ eq 'IO/Compress';
- next if $_ eq 'Devel/DProf';
- next if $_ eq 'libnet';
- next if $_ eq 'Locale/Codes';
- next if $_ eq 'podlators';
- next if $_ eq 'perlfaq';
- # test modules
- next if $_ eq 'XS/APItest';
- next if $_ eq 'XS/Typemap';
+ next if ($_ eq 'Devel/DProf');
# VMS$ perl -e "eval ""require \""Devel/DProf.pm\"";"" print $@"
# \NT> perl -e "eval \"require 'Devel/DProf.pm'\"; print $@"
# DProf: run perl with -d to use DProf.
# Compilation failed in require at (eval 1) line 1.
eval " require \"$_.pm\"; ";
if (!$@) {
- print "## Module '$_' appears to be installed.\n" if $opt{'v'};
+ print "## Module `$_' appears to be installed.\n" if $opt{'v'};
$extensions_there++;
}
else {
- print "# Required module '$_' does not appear to be properly installed.\n";
+ print "# Required module `$_' does not appear to be properly installed.\n";
$@ = undef;
}
$extensions_total++;
@@ -246,29 +229,28 @@ if (defined($Config{'extensions'})) {
# A silly name for a module (that hopefully won't ever exist).
# Note that this test serves more as a check of the validity of the
- # actual required module tests above.
+ # actuall required module tests above.
my $unnecessary = 'bLuRfle';
if (!grep(/$unnecessary/, @extensions)) {
$@ = undef;
eval " require \"$unnecessary.pm\"; ";
if ($@) {
- print "## Unnecessary module '$unnecessary' does not appear to be installed.\n" if $opt{'v'};
+ print "## Unnecessary module `$unnecessary' does not appear to be installed.\n" if $opt{'v'};
}
else {
- print "# Unnecessary module '$unnecessary' appears to be installed.\n";
+ print "# Unnecessary module `$unnecessary' appears to be installed.\n";
$extensions_there++;
}
}
$@ = undef;
}
-$label = 'All (and only) expected extensions installed';
if ($extensions_total == $extensions_there) {
- print "ok 5 $label\n";
+ print "ok 5\n";
$pass__total++;
}
else {
- print "not ok 5 $label\n";
+ print "not ok 5\n";
$error_total++;
}
$tests_total++;
@@ -302,12 +284,6 @@ for (@modules) {
$version = undef;
@missing = ();
@missing = $installed -> validate($_);
-
- # .bs files are optional
- @missing = grep { ! /\.bs$/ } @missing;
- # man files are often compressed
- @missing = grep { ! ( -s "$_.gz" || -s "$_.bz2" ) } @missing;
-
if ($#missing >= 0) {
print "# file",+($#missing == 0) ? '' : 's'," missing from installation:\n";
print '# ',join(' ',@missing),"\n";
@@ -317,14 +293,64 @@ for (@modules) {
}
@missing = ();
}
-$label = 'Module files correctly installed';
if (($installed_total == $installed_there) &&
($installed_total == $version_check)) {
- print "ok 6 $label\n";
+ print "ok 6\n";
$pass__total++;
}
else {
- print "not ok 6 $label\n";
+ print "not ok 6\n";
+ $error_total++;
+}
+$tests_total++;
+
+
+print "## Checking installations of *.h -> *.ph header files.\n" if $opt{'p'};
+my $ph_there = 0;
+my $var = undef;
+my $val = undef;
+my $h_file = undef;
+# Just about "any" C implementation ought to have a stdio.h (even if
+# Config.pm may not list a i_stdio var).
+my @ph_files = qw(stdio.ph);
+# Add the ones that we know that perl thinks are there:
+while (($var, $val) = each %Config) {
+ if ($var =~ m/i_(.+)/ && $val eq 'define') {
+ $h_file = $1;
+ # Some header and symbol names don't match for hysterical raisins.
+ $h_file = 'arpa/inet' if $h_file eq 'arpainet';
+ $h_file = 'netinet/in' if $h_file eq 'niin';
+ $h_file = 'netinet/tcp' if $h_file eq 'netinettcp';
+ $h_file = 'sys/resource' if $h_file eq 'sysresrc';
+ $h_file = 'sys/select' if $h_file eq 'sysselct';
+ $h_file = 'sys/security' if $h_file eq 'syssecrt';
+ $h_file = 'rpcsvc/dbm' if $h_file eq 'rpcsvcdbm';
+ # This ought to distinguish syslog from sys/syslog.
+ # (NB syslog.ph is heavily used for the DBI pre-requisites).
+ $h_file =~ s{^sys(\w.+)}{sys/$1} unless $h_file eq 'syslog';
+ push(@ph_files, "$h_file.ph");
+ }
+}
+#foreach (qw(stdio.ph syslog.ph)) {
+foreach (@ph_files) {
+ $@ = undef;
+ eval "require \"$_\";";
+ if (!$@) {
+ print "## Perl header `$_' appears to be installed.\n" if $opt{'v'};
+ $ph_there++;
+ }
+ else {
+ print "# Perl header `$_' does not appear to be properly installed.\n";
+ }
+ $@ = undef;
+}
+
+if (scalar(@ph_files) == $ph_there) {
+ print "ok 7\n";
+ $pass__total++;
+}
+else {
+ print "not ok 7\n";
$error_total++;
}
$tests_total++;
@@ -346,7 +372,7 @@ if ($error_total == 0 && $tests_total) {
=head1 NAME
-perlivp - Perl Installation Verification Procedure
+B<perlivp> - Perl Installation Verification Procedure
=head1 SYNOPSIS
@@ -392,35 +418,35 @@ or not -v is thrown.
=over 4
-=item * print "# Perl binary '$perlpath' does not appear executable.\n";
+=item * print "# Perl binary `$perlpath' does not appear executable.\n";
Likely to occur for a perl binary that was not properly installed.
Correct by conducting a proper installation.
-=item * print "# Perl version '$]' installed, expected $ivp_VERSION.\n";
+=item * print "# Perl version `$]' installed, expected $ivp_VERSION.\n";
Likely to occur for a perl that was not properly installed.
Correct by conducting a proper installation.
-=item * print "# Perl \@INC directory '$_' does not appear to exist.\n";
+=item * print "# Perl \@INC directory `$_' does not appear to exist.\n";
Likely to occur for a perl library tree that was not properly installed.
Correct by conducting a proper installation.
-=item * print "# Needed module '$_' does not appear to be properly installed.\n";
+=item * print "# Needed module `$_' does not appear to be properly installed.\n";
One of the two modules that is used by perlivp was not present in the
installation. This is a serious error since it adversely affects perlivp's
ability to function. You may be able to correct this by performing a
proper perl installation.
-=item * print "# Required module '$_' does not appear to be properly installed.\n";
+=item * print "# Required module `$_' does not appear to be properly installed.\n";
An attempt to C<eval "require $module"> failed, even though the list of
extensions indicated that it should succeed. Correct by conducting a proper
installation.
-=item * print "# Unnecessary module 'bLuRfle' appears to be installed.\n";
+=item * print "# Unnecessary module `bLuRfle' appears to be installed.\n";
This test not coming out ok could indicate that you have in fact installed
a bLuRfle.pm module or that the C<eval " require \"$module_name.pm\"; ">
@@ -433,6 +459,11 @@ One or more files turned up missing according to a run of
C<ExtUtils::Installed -E<gt> validate()> over your installation.
Correct by conducting a proper installation.
+=item * print "# Perl header `$_' does not appear to be properly installed.\n";
+
+Correct by running B<h2ph> over your system's C header files. If necessary,
+edit the resulting *.ph files to eliminate perl syntax errors.
+
=back
For further information on how to conduct a proper installation consult the