use strict;
use vars qw(@ISA @EXPORT $VERSION $MUST_REBOOT %Config);
-$VERSION = '1.47';
-$VERSION = eval $VERSION;
use AutoSplit;
use Carp ();
@ISA = ('Exporter');
@EXPORT = ('install','uninstall','pm_to_blib', 'install_default');
+=pod
+
=head1 NAME
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
}
+=pod
=head2 Functions
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());
}
}
+=pod
=item _can_write_dir(C<$dir>)
return 0;
}
+=pod
+
=item _mkpath($dir,$show,$mode,$verbose,$dry_run)
Wrapper around File::Path::mkpath() to handle errors.
}
+=pod
+
=item _copy($from,$to,$verbose,$dry_run)
Wrapper around File::Copy::copy to handle errors.
}
}
+=pod
+
=item _chdir($from)
Wrapper around chdir to catch errors.
return $ret;
}
+=pod
+
=end _private
=over 4
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:
$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;
return $files;
}
+=pod
=item B<install_default> I<DISCOURAGED>
close CMD or die "Filter command '$cmd' failed for $src";
}
+=pod
=item B<pm_to_blib>
return $builder;
}
+=pod
=back
If there is no INSTALL.SKIP file in the make directory then this value
can be used to provide a default.
-=item B<EU_ALWAYS_COPY>
+=item B<EU_INSTALL_ALWAYS_COPY>
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
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)) {
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';
{
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");
{
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");
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