From: Steve Hay Date: Mon, 10 Mar 2008 13:58:15 +0000 (+0000) Subject: Upgrade to ExtUtils-Install-1.50 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3f6d40bd7fe955329c1f574485922604c74d8097;p=p5sagit%2Fp5-mst-13.2.git Upgrade to ExtUtils-Install-1.50 p4raw-id: //depot/perl@33460 --- diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index 253a258..1b144b5 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -2,8 +2,6 @@ package ExtUtils::Install; use strict; use vars qw(@ISA @EXPORT $VERSION $MUST_REBOOT %Config); -$VERSION = '1.47'; -$VERSION = eval $VERSION; use AutoSplit; use Carp (); @@ -22,6 +20,8 @@ use File::Spec; @ISA = ('Exporter'); @EXPORT = ('install','uninstall','pm_to_blib', 'install_default'); +=pod + =head1 NAME ExtUtils::Install - install files from here to there @@ -35,6 +35,17 @@ ExtUtils::Install - install files from here to there uninstall($packlist); pm_to_blib({ 'lib/Foo/Bar.pm' => 'blib/lib/Foo/Bar.pm' }); + +=head1 VERSION + +1.50 + +=cut + +$VERSION = '1.50'; +$VERSION = eval $VERSION; + +=pod =head1 DESCRIPTION @@ -271,6 +282,7 @@ sub _unlink_or_rename { #XXX OS-SPECIFIC } +=pod =head2 Functions @@ -333,19 +345,20 @@ sub _get_install_skip { return $skip } +=pod + =item _have_write_access Abstract a -w check that tries to use POSIX::access() if possible. =cut - { my $has_posix; sub _have_write_access { my $dir=shift; - if (!defined $has_posix) { - $has_posix=eval 'local $^W; require POSIX; 1' || 0; + unless (defined $has_posix) { + $has_posix= (!$Is_cygwin && eval 'local $^W; require POSIX; 1') || 0; } if ($has_posix) { return POSIX::access($dir, POSIX::W_OK()); @@ -355,6 +368,7 @@ Abstract a -w check that tries to use POSIX::access() if possible. } } +=pod =item _can_write_dir(C<$dir>) @@ -408,6 +422,8 @@ sub _can_write_dir { return 0; } +=pod + =item _mkpath($dir,$show,$mode,$verbose,$dry_run) Wrapper around File::Path::mkpath() to handle errors. @@ -454,6 +470,8 @@ sub _mkpath { } +=pod + =item _copy($from,$to,$verbose,$dry_run) Wrapper around File::Copy::copy to handle errors. @@ -478,6 +496,8 @@ sub _copy { } } +=pod + =item _chdir($from) Wrapper around chdir to catch errors. @@ -499,6 +519,8 @@ sub _chdir { return $ret; } +=pod + =end _private =over 4 @@ -569,7 +591,7 @@ Note that the new argument style and use of the %result hash is recommended. The $always_copy parameter which when true causes files to be updated regardles as to whether they have changed, if it is defined but false then copies are made only if the files have changed, if it is undefined then the -value of the environment variable EU_ALWAYS_COPY is used as default. +value of the environment variable EU_INSTALL_ALWAYS_COPY is used as default. The %result hash will be populated with the various keys/subhashes reflecting the install. Currently these keys and their structure are: @@ -636,7 +658,9 @@ sub install { #XXX OS-SPECIFIC $dry_run ||= 0; $skip= _get_install_skip($skip,$verbose); - $always_copy = $ENV{EU_ALWAYS_COPY}||0 + $always_copy = $ENV{EU_INSTALL_ALWAYS_COPY} + || $ENV{EU_ALWAYS_COPY} + || 0 unless defined $always_copy; my(%from_to) = %$from_to; @@ -893,6 +917,7 @@ sub directory_not_empty ($) { return $files; } +=pod =item B I @@ -1092,6 +1117,7 @@ sub run_filter { close CMD or die "Filter command '$cmd' failed for $src"; } +=pod =item B @@ -1233,6 +1259,7 @@ sub _invokant { return $builder; } +=pod =back @@ -1253,11 +1280,15 @@ Will prevent the automatic use of INSTALL.SKIP as the install skip file. If there is no INSTALL.SKIP file in the make directory then this value can be used to provide a default. -=item B +=item B If this environment variable is true then normal install processes will always overwrite older identical files during the install process. +Note that the alias EU_ALWAYS_COPY will be supported if EU_INSTALL_ALWAYS_COPY +is not defined until at least the 1.50 release. Please ensure you use the +correct EU_INSTALL_ALWAYS_COPY. + =back =head1 AUTHOR diff --git a/lib/ExtUtils/t/Install.t b/lib/ExtUtils/t/Install.t index f9e7666..a30515e 100644 --- a/lib/ExtUtils/t/Install.t +++ b/lib/ExtUtils/t/Install.t @@ -22,6 +22,9 @@ use Test::More tests => 52; use MakeMaker::Test::Setup::BFD; BEGIN { use_ok('ExtUtils::Install') } +# ensure the env doesnt pollute our tests +local $ENV{EU_INSTALL_ALWAYS_COPY}; +local $ENV{EU_ALWAYS_COPY}; # Check exports. foreach my $func (qw(install uninstall pm_to_blib install_default)) { diff --git a/lib/ExtUtils/t/Installapi2.t b/lib/ExtUtils/t/Installapi2.t index e5a6516..0b9ba0d 100644 --- a/lib/ExtUtils/t/Installapi2.t +++ b/lib/ExtUtils/t/Installapi2.t @@ -34,7 +34,10 @@ END { ok( chdir File::Spec->updir ); ok( teardown_recurs(), 'teardown' ); } - +# ensure the env doesnt pollute our tests +local $ENV{EU_INSTALL_ALWAYS_COPY}; +local $ENV{EU_ALWAYS_COPY}; + chdir 'Big-Dummy'; my $stdout = tie *STDOUT, 'TieOut'; @@ -191,7 +194,7 @@ close DUMMY; { local @INC = ('install-test/lib/perl'); local $ENV{PERL5LIB} = ''; - local $ENV{EU_ALWAYS_COPY}=1; + local $ENV{EU_INSTALL_ALWAYS_COPY}=1; my $tfile='install-test/other_lib/perl/Big/Dummy.pm'; my $sfile='blib/lib/Big/Dummy.pm'; ok(-r $tfile,"install file already exists"); @@ -212,7 +215,7 @@ close DUMMY; { local @INC = ('install-test/lib/perl'); local $ENV{PERL5LIB} = ''; - local $ENV{EU_ALWAYS_COPY}=0; + local $ENV{EU_INSTALL_ALWAYS_COPY}=0; my $tfile='install-test/other_lib/perl/Big/Dummy.pm'; my $sfile='blib/lib/Big/Dummy.pm'; ok(-r $tfile,"install file already exists"); diff --git a/lib/ExtUtils/t/can_write_dir.t b/lib/ExtUtils/t/can_write_dir.t index 4d4df0b..be6fb18 100755 --- a/lib/ExtUtils/t/can_write_dir.t +++ b/lib/ExtUtils/t/can_write_dir.t @@ -34,22 +34,28 @@ is_deeply [can_write_dir($abs_dne)], FS->rel2abs(FS->catdir('does', 'not', 'exist')), ]; - -my $exists = FS->catdir(qw(exists)); -my $subdir = FS->catdir(qw(exists subdir)); -ok mkdir $exists; -END { rmdir $exists } - -ok chmod 0555, $exists, 'make read only'; -ok !-w $exists; -is_deeply [can_write_dir($exists)], [0, $exists]; -is_deeply [can_write_dir($subdir)], [0, $exists, $subdir]; - -ok chmod 0777, $exists, 'make writable'; -ok -w $exists; -is_deeply [can_write_dir($exists)], [1, $exists]; -is_deeply [can_write_dir($subdir)], - [1, - $exists, - $subdir - ]; +SKIP: { + my $exists = FS->catdir(qw(exists)); + my $subdir = FS->catdir(qw(exists subdir)); + + + ok mkdir $exists; + END { rmdir $exists } + + ok chmod 0555, $exists, 'make read only'; + + skip "Current user or OS cannot create directories that they cannot read", 6 + if -w $exists; # these tests require a directory we cant read + + is_deeply [can_write_dir($exists)], [0, $exists]; + is_deeply [can_write_dir($subdir)], [0, $exists, $subdir]; + + ok chmod 0777, $exists, 'make writable'; + ok -w $exists; + is_deeply [can_write_dir($exists)], [1, $exists]; + is_deeply [can_write_dir($subdir)], + [1, + $exists, + $subdir + ]; +} \ No newline at end of file