Change 30300 by [EMAIL PROTECTED] on 2007/02/14 21:45:49

        Integrate:
        [ 28987]
        Upgrade to ExtUtils-Command-1.12.
        
        [ 28988]
        Upgrade to ExtUtils-Manifest-1.49.
        
        [ 28989]
        Adjust test count for ExtUtils::Command
        
        [ 29768]
        Upgrade to ExtUtils::Manifest 1.51
        
        [ 30146]
        Upgrade to ExtUtils-Command-1.13

Affected files ...

... //depot/maint-5.8/perl/lib/ExtUtils/Command.pm#9 integrate
... //depot/maint-5.8/perl/lib/ExtUtils/Manifest.pm#12 integrate
... //depot/maint-5.8/perl/lib/ExtUtils/t/Manifest.t#14 integrate
... //depot/maint-5.8/perl/lib/ExtUtils/t/eu_command.t#2 integrate

Differences ...

==== //depot/maint-5.8/perl/lib/ExtUtils/Command.pm#9 (text) ====
Index: perl/lib/ExtUtils/Command.pm
--- perl/lib/ExtUtils/Command.pm#8~30299~       2007-02-14 13:31:37.000000000 
-0800
+++ perl/lib/ExtUtils/Command.pm        2007-02-14 13:45:49.000000000 -0800
@@ -10,9 +10,9 @@
 require Exporter;
 use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
 @ISA       = qw(Exporter);
[EMAIL PROTECTED]    = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f 
test_d chmod 
[EMAIL PROTECTED]    = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f 
test_d chmod
                 dos2unix);
-$VERSION = '1.11';
+$VERSION = '1.13';
 
 my $Is_VMS = $^O eq 'VMS';
 
@@ -22,33 +22,38 @@
 
 =head1 SYNOPSIS
 
-  perl -MExtUtils::Command       -e cat files... > destination
-  perl -MExtUtils::Command       -e mv source... destination
-  perl -MExtUtils::Command       -e cp source... destination
-  perl -MExtUtils::Command       -e touch files...
-  perl -MExtUtils::Command       -e rm_f files...
-  perl -MExtUtils::Command       -e rm_rf directories...
-  perl -MExtUtils::Command       -e mkpath directories...
-  perl -MExtUtils::Command       -e eqtime source destination
-  perl -MExtUtils::Command       -e test_f file
-  perl -MExtUtils::Command       -e test_d directory
-  perl -MExtUtils::Command       -e chmod mode files...
+  perl -MExtUtils::Command -e cat files... > destination
+  perl -MExtUtils::Command -e mv source... destination
+  perl -MExtUtils::Command -e cp source... destination
+  perl -MExtUtils::Command -e touch files...
+  perl -MExtUtils::Command -e rm_f files...
+  perl -MExtUtils::Command -e rm_rf directories...
+  perl -MExtUtils::Command -e mkpath directories...
+  perl -MExtUtils::Command -e eqtime source destination
+  perl -MExtUtils::Command -e test_f file
+  perl -MExtUtils::Command -e test_d directory
+  perl -MExtUtils::Command -e chmod mode files...
   ...
 
 =head1 DESCRIPTION
 
 The module is used to replace common UNIX commands.  In all cases the
 functions work from @ARGV rather than taking arguments.  This makes
-them easier to deal with in Makefiles.
+them easier to deal with in Makefiles.  Call them like this:
 
   perl -MExtUtils::Command -e some_command some files to work on
 
-I<NOT>
+and I<NOT> like this:
 
   perl -MExtUtils::Command -e 'some_command qw(some files to work on)'
 
+For that use L<Shell::Command>.
+
 Filenames with * and ? will be glob expanded.
 
+
+=head2 FUNCTIONS
+
 =over 4
 
 =cut
@@ -61,7 +66,9 @@
 }
 
 
-=item cat 
+=item cat
+
+    cat file ...
 
 Concatenates all files mentioned on command line to STDOUT.
 
@@ -73,9 +80,11 @@
  print while (<>);
 }
 
-=item eqtime src dst
+=item eqtime
+
+    eqtime source destination
 
-Sets modified time of dst to that of src
+Sets modified time of destination to that of source.
 
 =cut 
 
@@ -86,9 +95,11 @@
  utime((stat($src))[8,9],$dst);
 }
 
-=item rm_rf files....
+=item rm_rf
 
-Removes directories - recursively (even if readonly)
+    rm_rf files or directories ...
+
+Removes files and directories - recursively (even if readonly)
 
 =cut 
 
@@ -98,7 +109,9 @@
  rmtree([grep -e $_,@ARGV],0,0);
 }
 
-=item rm_f files....
+=item rm_f
+
+    rm_f file ...
 
 Removes files (even if readonly)
 
@@ -115,7 +128,7 @@
         chmod(0777, $file);
 
         next if _unlink($file);
-            
+
         carp "Cannot delete $file: $!";
     }
 }
@@ -131,7 +144,9 @@
 }
 
 
-=item touch files ...
+=item touch
+
+    touch file ...
 
 Makes files exist, with current timestamp 
 
@@ -147,7 +162,10 @@
     }
 }
 
-=item mv source... destination
+=item mv
+
+    mv source_file destination_file
+    mv source_file source_file destination_dir
 
 Moves source to destination.  Multiple sources are allowed if
 destination is an existing directory.
@@ -170,9 +188,12 @@
     return !$nok;
 }
 
-=item cp source... destination
+=item cp
 
-Copies source to destination.  Multiple sources are allowed if
+    cp source_file destination_file
+    cp source_file source_file destination_dir
+
+Copies sources to the destination.  Multiple sources are allowed if
 destination is an existing directory.
 
 Returns true if all copies succeeded, false otherwise.
@@ -193,7 +214,9 @@
     return $nok;
 }
 
-=item chmod mode files...
+=item chmod
+
+    chmod mode files ...
 
 Sets UNIX like permissions 'mode' on all the files.  e.g. 0666
 
@@ -222,9 +245,11 @@
     chmod(oct $mode,@ARGV) || die "Cannot chmod ".join(' ',$mode,@ARGV).":$!";
 }
 
-=item mkpath directory...
+=item mkpath
+
+    mkpath directory ...
 
-Creates directory, including any parent directories.
+Creates directories, including any parent directories.
 
 =cut 
 
@@ -234,30 +259,38 @@
  File::Path::mkpath([EMAIL PROTECTED],0,0777);
 }
 
-=item test_f file
+=item test_f
 
-Tests if a file exists
+    test_f file
+
+Tests if a file exists.  I<Exits> with 0 if it does, 1 if it does not (ie.
+shell's idea of true and false).
 
 =cut 
 
 sub test_f
 {
- exit !-f $ARGV[0];
+ exit(-f $ARGV[0] ? 0 : 1);
 }
 
-=item test_d directory
+=item test_d
 
-Tests if a directory exists
+    test_d directory
 
-=cut 
+Tests if a directory exists.  I<Exits> with 0 if it does, 1 if it does
+not (ie. shell's idea of true and false).
+
+=cut
 
 sub test_d
 {
- exit !-d $ARGV[0];
+ exit(-d $ARGV[0] ? 0 : 1);
 }
 
 =item dos2unix
 
+    dos2unix files or dirs ...
+
 Converts DOS and OS/2 linefeeds to Unix style recursively.
 
 =cut
@@ -290,13 +323,10 @@
 
 =back
 
-=head1 BUGS
-
-Should probably be Auto/Self loaded.
+=head1 SEE ALSO
 
-=head1 SEE ALSO 
+Shell::Command which is these same functions but take arguments normally.
 
-ExtUtils::MakeMaker, ExtUtils::MM_Unix, ExtUtils::MM_Win32
 
 =head1 AUTHOR
 

==== //depot/maint-5.8/perl/lib/ExtUtils/Manifest.pm#12 (text) ====
Index: perl/lib/ExtUtils/Manifest.pm
--- perl/lib/ExtUtils/Manifest.pm#11~30299~     2007-02-14 13:31:37.000000000 
-0800
+++ perl/lib/ExtUtils/Manifest.pm       2007-02-14 13:45:49.000000000 -0800
@@ -13,7 +13,7 @@
           $Is_MacOS $Is_VMS 
           $Debug $Verbose $Quiet $MANIFEST $DEFAULT_MSKIP);
 
-$VERSION = '1.48';
+$VERSION = '1.51';
 @ISA=('Exporter');
 @EXPORT_OK = qw(mkmanifest
                 manicheck  filecheck  fullcheck  skipcheck
@@ -308,7 +308,7 @@
     my $read = {};
     local *M;
     unless (open M, $mfile){
-        warn "$mfile: $!";
+        warn "Problem opening $mfile: $!";
         return $read;
     }
     local $_;
@@ -346,15 +346,19 @@
 sub _maniskip {
     my @skip ;
     my $mfile = "$MANIFEST.SKIP";
-    local(*M,$_);
+    _check_mskip_directives($mfile) if -f $mfile;
+    local(*M, $_);
     open M, $mfile or open M, $DEFAULT_MSKIP or return sub {0};
     while (<M>){
        chomp;
+       s/\r//;
        next if /^#/;
        next if /^\s*$/;
        push @skip, _macify($_);
     }
     close M;
+    return sub {0} unless (scalar @skip > 0);
+
     my $opts = $Is_VMS ? '(?i)' : '';
 
     # Make sure each entry is isolated in its own parentheses, in case
@@ -364,6 +368,75 @@
     return sub { $_[0] =~ qr{$opts$regex} };
 }
 
+# checks for the special directives
+#   #!include_default
+#   #!include /path/to/some/manifest.skip
+# in a custom MANIFEST.SKIP for, for including
+# the content of, respectively, the default MANIFEST.SKIP
+# and an external manifest.skip file
+sub _check_mskip_directives {
+    my $mfile = shift;
+    local (*M, $_);
+    my @lines = ();
+    my $flag = 0;
+    unless (open M, $mfile) {
+        warn "Problem opening $mfile: $!";
+        return;
+    }
+    while (<M>) {
+        if (/^#!include_default\s*$/) {
+           if (my @default = _include_mskip_file()) {
+               push @lines, @default;
+               warn "Debug: Including default MANIFEST.SKIP\n" if $Debug;
+               $flag++;
+           }
+           next;
+        }
+       if (/^#!include\s+(.*)\s*$/) {
+           my $external_file = $1;
+           if (my @external = _include_mskip_file($external_file)) {
+               push @lines, @external;
+               warn "Debug: Including external $external_file\n" if $Debug;
+               $flag++;
+           }
+            next;
+        }
+        push @lines, $_;
+    }
+    close M;
+    return unless $flag;
+    rename $mfile, "$mfile.bak";
+    warn "Debug: Saving original $mfile as $mfile.bak\n" if $Debug;
+    unless (open M, ">$mfile") {
+        warn "Problem opening $mfile: $!";
+        return;
+    }
+    print M $_ for (@lines);
+    close M;
+    return;
+}
+
+# returns an array containing the lines of an external
+# manifest.skip file, if given, or $DEFAULT_MSKIP
+sub _include_mskip_file {
+    my $mskip = shift || $DEFAULT_MSKIP;
+    unless (-f $mskip) {
+        warn qq{Included file "$mskip" not found - skipping};
+        return;
+    }
+    local (*M, $_);
+    unless (open M, $mskip) {
+        warn "Problem opening $mskip: $!";
+        return;
+    }
+    my @lines = ();
+    push @lines, "\n#!start included $mskip\n";
+    push @lines, $_ while <M>;
+    close M;
+    push @lines, "#!end included $mskip\n\n";
+    return @lines;
+}
+
 =item manicopy
 
     manicopy(\%src, $dest_dir);
@@ -449,7 +522,7 @@
 
     copy($srcFile,$dstFile);
     utime $access, $mod + ($Is_VMS ? 1 : 0), $dstFile;
-    _manicopy_chmod($dstFile);
+    _manicopy_chmod($srcFile, $dstFile);
 }
 
 
@@ -458,7 +531,7 @@
     return &cp if $Is_VMS or ($^O eq 'MSWin32' and Win32::IsWin95());
     link($srcFile, $dstFile);
 
-    unless( _manicopy_chmod($dstFile) ) {
+    unless( _manicopy_chmod($srcFile, $dstFile) ) {
         unlink $dstFile;
         return;
     }
@@ -469,10 +542,10 @@
 # 2) Let everyone read it.
 # 3) If the owner can execute it, everyone can.
 sub _manicopy_chmod {
-    my($file) = shift;
+    my($srcFile, $dstFile) = @_;
 
-    my $perm = 0444 | (stat $file)[2] & 0700;
-    chmod( $perm | ( $perm & 0100 ? 0111 : 0 ), $file );
+    my $perm = 0444 | (stat $srcFile)[2] & 0700;
+    chmod( $perm | ( $perm & 0100 ? 0111 : 0 ), $dstFile );
 }
 
 # Files that are often modified in the distdir.  Don't hard link them.
@@ -632,6 +705,26 @@
 used, similar to the example above.  If you want nothing skipped,
 simply make an empty MANIFEST.SKIP file.
 
+In one's own MANIFEST.SKIP file, certain directives
+can be used to include the contents of other MANIFEST.SKIP
+files. At present two such directives are recognized.
+
+=over 4
+
+=item #!include_default
+
+This inserts the contents of the default MANIFEST.SKIP file
+
+=item #!include /Path/to/another/manifest.skip
+
+This inserts the contents of the specified external file
+
+=back
+
+The included contents will be inserted into the MANIFEST.SKIP
+file in between I<#!start included /path/to/manifest.skip>
+and I<#!end included /path/to/manifest.skip> markers.
+The original MANIFEST.SKIP is saved as MANIFEST.SKIP.bak.
 
 =head2 EXPORT_OK
 

==== //depot/maint-5.8/perl/lib/ExtUtils/t/Manifest.t#14 (text) ====
Index: perl/lib/ExtUtils/t/Manifest.t
--- perl/lib/ExtUtils/t/Manifest.t#13~30299~    2007-02-14 13:31:37.000000000 
-0800
+++ perl/lib/ExtUtils/t/Manifest.t      2007-02-14 13:45:49.000000000 -0800
@@ -13,12 +13,13 @@
 
 use strict;
 
-use Test::More tests => 49;
+use Test::More tests => 66;
 use Cwd;
 
 use File::Spec;
 use File::Path;
 use File::Find;
+use Config;
 
 my $Is_VMS = $^O eq 'VMS';
 
@@ -46,7 +47,7 @@
 }
 
 sub catch_warning {
-    my $warn;
+    my $warn = '';
     local $SIG{__WARN__} = sub { $warn .= $_[0] };
     return join('', $_[0]->() ), $warn;
 }
@@ -71,8 +72,14 @@
 ok( chdir( 'mantest' ), 'chdir() to mantest' );
 ok( add_file('foo'), 'add a temporary file' );
 
+# This ensures the -x check for manicopy means something
+# Some platforms don't have chmod or an executable bit, in which case
+# this call will do nothing or fail, but on the platforms where chmod()
+# works, we test the executable bit is copied
+chmod( 0744, 'foo') if $Config{'chmod'};
+
 # there shouldn't be a MANIFEST there
-my ($res, $warn) = catch_warning( \&mkmanifest ); 
+my ($res, $warn) = catch_warning( \&mkmanifest );
 # Canonize the order.
 $warn = join("", map { "$_|" } 
                  sort { lc($a) cmp lc($b) } split /\r?\n/, $warn);
@@ -97,10 +104,10 @@
 is( $res, 'bar', 'bar reported as new' );
 
 # now quiet the warning that bar was added and test again
-($res, $warn) = do { local $ExtUtils::Manifest::Quiet = 1; 
-                     catch_warning( \&skipcheck ) 
+($res, $warn) = do { local $ExtUtils::Manifest::Quiet = 1;
+                     catch_warning( \&skipcheck )
                 };
-cmp_ok( $warn, 'eq', '', 'disabled warnings' );
+is( $warn, '', 'disabled warnings' );
 
 # add a skip file with a rule to skip itself (and the nonexistent glob '*baz*')
 add_file( 'MANIFEST.SKIP', "baz\n.SKIP" );
@@ -164,7 +171,7 @@
 ok( mkdir( 'copy', 0777 ), 'made copy directory' );
 $files = maniread();
 eval { (undef, $warn) = catch_warning( sub {
-               manicopy( $files, 'copy', 'cp' ) }) 
+               manicopy( $files, 'copy', 'cp' ) })
 };
 like( $@, qr/^Can't read none: /, 'croaked about none' );
 
@@ -179,7 +186,7 @@
        local $ExtUtils::Manifest::MANIFEST = 'albatross'; 
        ($res, $warn) = catch_warning( \&mkmanifest );
        like( $warn, qr/Added to albatross: /, 'using a new manifest file' );
-       
+
        # add the new file to the list of files to be deleted
        $Files{'albatross'}++;
 }
@@ -200,7 +207,7 @@
 add_file( 'foobar'        => '123' );
 ($res, $warn) = catch_warning( \&manicheck );
 is( $res,  '',      'MANIFEST overrides MANIFEST.SKIP' );
-is( $warn, undef,   'MANIFEST overrides MANIFEST.SKIP, no warnings' );
+is( $warn, '',   'MANIFEST overrides MANIFEST.SKIP, no warnings' );
 
 $files = maniread;
 ok( !$files->{wibble},     'MANIFEST in good state' );
@@ -211,6 +218,40 @@
 is( $files->{yarrow}, 'hock','          with comment' );
 is( $files->{foobar}, '',    '          preserved old entries' );
 
+# test including an external manifest.skip file in MANIFEST.SKIP
+{
+    maniadd({ foo => undef , albatross => undef,
+              'mymanifest.skip' => undef, 'mydefault.skip' => undef});
+    add_file('mymanifest.skip' => "^foo\n");
+    add_file('mydefault.skip'  => "^my\n");
+    $ExtUtils::Manifest::DEFAULT_MSKIP =
+         File::Spec->catfile($cwd, qw(mantest mydefault.skip));
+    my $skip = File::Spec->catfile($cwd, qw(mantest mymanifest.skip));
+    add_file('MANIFEST.SKIP' =>
+             "albatross\n#!include $skip\n#!include_default");
+    my ($res, $warn) = catch_warning( \&skipcheck );
+    for (qw(albatross foo foobar mymanifest.skip mydefault.skip)) {
+        like( $warn, qr/Skipping \b$_\b/,
+              "Skipping $_" );
+    }
+    ($res, $warn) = catch_warning( \&mkmanifest );
+    for (qw(albatross foo foobar mymanifest.skip mydefault.skip)) {
+        like( $warn, qr/Removed from MANIFEST: \b$_\b/,
+              "Removed $_ from MANIFEST" );
+    }
+    my $files = maniread;
+    ok( ! exists $files->{albatross}, 'albatross excluded via MANIFEST.SKIP' );
+    ok( exists $files->{yarrow},      'yarrow included in MANIFEST' );
+    ok( exists $files->{bar},         'bar included in MANIFEST' );
+    ok( ! exists $files->{foobar},    'foobar excluded via mymanifest.skip' );
+    ok( ! exists $files->{foo},       'foo excluded via mymanifest.skip' );
+    ok( ! exists $files->{'mymanifest.skip'},
+        'mymanifest.skip excluded via mydefault.skip' );
+    ok( ! exists $files->{'mydefault.skip'},
+        'mydefault.skip excluded via mydefault.skip' );
+    $Files{"$_.bak"}++ for (qw(MANIFEST MANIFEST.SKIP));
+}
+
 add_file('MANIFEST'   => 'Makefile.PL');
 maniadd({ foo  => 'bar' });
 $files = maniread;
@@ -221,8 +262,8 @@
              );
 is_deeply( $files, \%expect, 'maniadd() vs MANIFEST without trailing newline');
 
-add_file('MANIFEST'   => 'Makefile.PL');
-maniadd({ foo => 'bar' });
+#add_file('MANIFEST'   => 'Makefile.PL');
+#maniadd({ foo => 'bar' });
 
 SKIP: {
     chmod( 0400, 'MANIFEST' );

==== //depot/maint-5.8/perl/lib/ExtUtils/t/eu_command.t#2 (text) ====
Index: perl/lib/ExtUtils/t/eu_command.t
--- perl/lib/ExtUtils/t/eu_command.t#1~30299~   2007-02-14 13:31:37.000000000 
-0800
+++ perl/lib/ExtUtils/t/eu_command.t    2007-02-14 13:45:49.000000000 -0800
@@ -29,8 +29,8 @@
 
 BEGIN {
     # bad neighbor, but test_f() uses exit()
-        *CORE::GLOBAL::exit = '';   # quiet 'only once' warning.
-    *CORE::GLOBAL::exit = sub { return @_ };
+    *CORE::GLOBAL::exit = '';   # quiet 'only once' warning.
+    *CORE::GLOBAL::exit = sub (;$) { return $_[0] };
     use_ok( 'ExtUtils::Command' );
 }
 
@@ -53,9 +53,9 @@
     is( scalar( $$out =~ s/use_ok\( 'ExtUtils::Command'//g), 2, 
         'concatenation worked' );
 
-    # the truth value here is reversed -- Perl true is C false
+    # the truth value here is reversed -- Perl true is shell false
     @ARGV = ( $Testfile );
-    ok( test_f(), 'testing non-existent file' );
+    is( test_f(), 1, 'testing non-existent file' );
 
     @ARGV = ( $Testfile );
     is( ! test_f(), '', 'testing non-existent file' );
@@ -65,7 +65,7 @@
     touch();
 
     @ARGV = ( $Testfile );
-    ok( test_f(), 'now creating that file' );
+    is( test_f(), 0, 'testing touch() and test_f()' );
     is_deeply( [EMAIL PROTECTED], [$Testfile], 'test_f preserves @ARGV' );
 
     @ARGV = ( $Testfile );
@@ -148,7 +148,7 @@
             $^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin'  ||
             $^O eq 'MacOS'
            ) {
-            skip( "different file permission semantics on $^O", 4);
+            skip( "different file permission semantics on $^O", 5);
         }
 
         @ARGV = ('testdir');
@@ -178,6 +178,7 @@
 
         @ARGV = ('testdir');
         rm_rf;
+        ok( ! -e 'testdir', 'rm_rf can delete a read-only dir' );
     }
 
 
@@ -185,15 +186,12 @@
     my $test_dir = File::Spec->join( 'ecmddir', 'temp2' );
     @ARGV = ( $test_dir );
     ok( ! -e $ARGV[0], 'temp directory not there yet' );
-    ok( test_d(), 'testing non-existent directory' );
-
-    @ARGV = ( $test_dir );
-    is( ! test_d(), '', 'testing non-existent dir' );
+    is( test_d(), 1, 'testing non-existent directory' );
 
     @ARGV = ( $test_dir );
     mkpath();
     ok( -e $ARGV[0], 'temp directory created' );
-    cmp_ok( test_d(), '==', (-d $test_dir), 'testing existing dir' );
+    is( test_d(), 0, 'testing existing dir' );
 
     @ARGV = ( $test_dir );
     # copy a file to a nested subdirectory
End of Patch.

Reply via email to