--- ExtUtils.orig/Install.pm 2008-11-13 01:02:44.000000000 +0530
+++ ExtUtils/Install.pm 2009-04-08 11:05:33.246206000 +0530
@@ -537,7 +537,7 @@
# deprecated forms
install(\%from_to);
install(\%from_to, $verbose, $dry_run, $uninstall_shadows,
- $skip, $always_copy, \%result);
+ $dir_mode, $skip, $always_copy, \%result);
# recommended form as of 1.47
install([
@@ -572,6 +572,9 @@
If $uninstall_shadows is true any differing versions throughout @INC
will be uninstalled. This is "make install UNINST=1"
+If $dir_mode is defined, creates directories with the desired permissions
+(default: 0755)
+
As of 1.37_02 install() supports the use of a list of patterns to filter out
files that shouldn't be installed. If $skip is omitted or undefined then
install will try to read the list from INSTALL.SKIP in the CWD. This file is
@@ -647,7 +650,7 @@
=cut
sub install { #XXX OS-SPECIFIC
- my($from_to,$verbose,$dry_run,$uninstall_shadows,$skip,$always_copy,$result) = @_;
+ my($from_to,$verbose,$dry_run,$uninstall_shadows,$dir_mode,$skip,$always_copy,$result) = @_;
if (@_==1 and eval { 1+@$from_to }) {
my %opts = @$from_to;
$from_to = $opts{from_to}
@@ -655,6 +658,7 @@
$verbose = $opts{verbose};
$dry_run = $opts{dry_run};
$uninstall_shadows = $opts{uninstall_shadows};
+ $dir_mode = $opts{dir_mode};
$skip = $opts{skip};
$always_copy = $opts{always_copy};
$result = $opts{result};
@@ -664,6 +668,8 @@
$verbose ||= 0;
$dry_run ||= 0;
+ $dir_mode = ($dir_mode) ? oct($dir_mode) : oct('0755');
+
$skip= _get_install_skip($skip,$verbose);
$always_copy = $ENV{EU_INSTALL_ALWAYS_COPY}
|| $ENV{EU_ALWAYS_COPY}
@@ -761,7 +767,7 @@
_chdir($cwd);
}
foreach my $targetdir (sort keys %check_dirs) {
- _mkpath( $targetdir, 0, 0755, $verbose, $dry_run );
+ _mkpath( $targetdir, 0, $dir_mode, $verbose, $dry_run );
}
foreach my $found (@found_files) {
my ($diff, $ffd, $origfile, $mode, $size, $atime, $mtime,
@@ -775,7 +781,7 @@
$targetfile= _unlink_or_rename( $targetfile, 'tryhard', 'install' )
unless $dry_run;
} elsif ( ! -d $targetdir ) {
- _mkpath( $targetdir, 0, 0755, $verbose, $dry_run );
+ _mkpath( $targetdir, 0, $dir_mode, $verbose, $dry_run );
}
print "Installing $targetfile\n";
@@ -815,7 +821,7 @@
if ($pack{'write'}) {
$dir = install_rooted_dir(dirname($pack{'write'}));
- _mkpath( $dir, 0, 0755, $verbose, $dry_run );
+ _mkpath( $dir, 0, $dir_mode, $verbose, $dry_run );
print "Writing $pack{'write'}\n" if $verbose;
$packlist->write(install_rooted_file($pack{'write'})) unless $dry_run;
}
@@ -1137,7 +1143,7 @@
=item B<pm_to_blib>
pm_to_blib(\%from_to, $autosplit_dir);
- pm_to_blib(\%from_to, $autosplit_dir, $filter_cmd);
+ pm_to_blib(\%from_to, $autosplit_dir, $filter_cmd, $dir_mode);
Copies each key of %from_to to its corresponding value efficiently.
Filenames with the extension .pm are autosplit into the $autosplit_dir.
@@ -1145,7 +1151,8 @@
$filter_cmd is an optional shell command to run each .pm file through
prior to splitting and copying. Input is the contents of the module,
-output the new module contents.
+output the new module contents. $dir_mode is an optional mode for
+creating directories with the desired permissions (default: 0755)
You can have an environment variable PERL_INSTALL_ROOT set which will
be prepended as a directory to each installed file (and directory).
@@ -1153,9 +1160,10 @@
=cut
sub pm_to_blib {
- my($fromto,$autodir,$pm_filter) = @_;
+ my($fromto,$autodir,$pm_filter,$dir_mode) = @_;
+ $dir_mode = ($dir_mode) ? oct($dir_mode) : oct('0755');
- _mkpath($autodir,0,0755);
+ _mkpath($autodir,0,$dir_mode);
while(my($from, $to) = each %$fromto) {
if( -f $to && -s $from == -s $to && -M $to < -M $from ) {
print "Skip $to (unchanged)\n";
@@ -1178,7 +1186,7 @@
# we wont try hard here. its too likely to mess things up.
forceunlink($to);
} else {
- _mkpath(dirname($to),0,0755);
+ _mkpath(dirname($to),0,$dir_mode);
}
if ($need_filtering) {
run_filter($pm_filter, $from, $to);
--- ExtUtils.orig/MM_Any.pm 2009-03-23 00:58:20.000000000 +0530
+++ ExtUtils/MM_Any.pm 2009-04-08 11:09:00.477851000 +0530
@@ -545,7 +545,7 @@
my $make_frag = $mm->dir_target(@directories);
Generates targets to create the specified directories and set its
-permission to 0755.
+permission to PERM_DIR.
Because depending on a directory to just ensure it exists doesn't work
too well (the modified time changes too often) dir_target() creates a
@@ -565,7 +565,7 @@
$make .= sprintf <<'MAKE', ($dir) x 7;
%s$(DFSEP).exists :: Makefile.PL
$(NOECHO) $(MKPATH) %s
- $(NOECHO) $(CHMOD) 755 %s
+ $(NOECHO) $(CHMOD) $(PERM_DIR) %s
$(NOECHO) $(TOUCH) %s$(DFSEP).exists
MAKE
--- ExtUtils.orig/MM_Unix.pm 2009-03-23 00:58:20.000000000 +0530
+++ ExtUtils/MM_Unix.pm 2009-04-08 11:08:41.694468000 +0530
@@ -393,7 +393,7 @@
PERLRUN FULLPERLRUN ABSPERLRUN
PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST
PERL_CORE
- PERM_RW PERM_RWX
+ PERM_DIR PERM_RW PERM_RWX
) )
{
@@ -1822,7 +1822,7 @@
$self->{VERBINST} ||= 0;
$self->{MOD_INSTALL} ||=
$self->oneliner(<<'CODE', ['-MExtUtils::Install']);
-install({@ARGV}, '$(VERBINST)', 0, '$(UNINST)');
+install({@ARGV}, '$(VERBINST)', 0, '$(UNINST)', '$(PERM_DIR)');
CODE
$self->{DOC_INSTALL} ||=
'$(ABSPERLRUN) "-MExtUtils::Command::MM" -e perllocal_install';
@@ -2049,6 +2049,7 @@
sub init_PERM {
my($self) = shift;
+ $self->{PERM_DIR} = 755 unless defined $self->{PERM_DIR};
$self->{PERM_RW} = 644 unless defined $self->{PERM_RW};
$self->{PERM_RWX} = 755 unless defined $self->{PERM_RWX};
@@ -2859,6 +2860,20 @@
}
+=item perm_dir (o)
+
+Returns the attribute C<PERM_DIR> or the string C<755>.
+Used as the string that is passed
+to the C<chmod> command to set the permissions for directories.
+When the return value is used by the perl function C<chmod>, it is
+interpreted as an octal value.
+
+=cut
+
+sub perm_dir {
+ return shift->{PERM_DIR};
+}
+
=item perm_rw (o)
Returns the attribute C<PERM_RW> or the string C<644>.
@@ -2903,7 +2918,7 @@
};
my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
-pm_to_blib({\@ARGV}, '$autodir', '\$(PM_FILTER)')
+pm_to_blib({\@ARGV}, '$autodir', '\$(PM_FILTER)', '\$(PERM_DIR)')
CODE
my @cmds = $self->split_command($pm_to_blib, %{$self->{PM}});
--- ExtUtils.orig/MM_VMS.pm 2009-03-23 00:58:20.000000000 +0530
+++ ExtUtils/MM_VMS.pm 2009-04-08 11:10:09.453409000 +0530
@@ -480,7 +480,7 @@
$self->{MOD_INSTALL} ||=
$self->oneliner(<<'CODE', ['-MExtUtils::Install']);
-install({split(' ',<STDIN>)}, '$(VERBINST)', 0, '$(UNINST)');
+install({split(' ',<STDIN>)}, '$(VERBINST)', 0, '$(UNINST)', '$(PERM_DIR)');
CODE
$self->{SHELL} ||= 'Posix';
--- ExtUtils.orig/MakeMaker.pm 2009-03-23 00:58:20.000000000 +0530
+++ ExtUtils/MakeMaker.pm 2009-04-08 11:11:30.718310000 +0530
@@ -243,7 +243,7 @@
META_ADD META_MERGE MIN_PERL_VERSION
MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NORECURS NO_VC OBJECT OPTIMIZE
PERL_MALLOC_OK PERL PERLMAINCC PERLRUN PERLRUNINST PERL_CORE
- PERL_SRC PERM_RW PERM_RWX
+ PERL_SRC PERM_DIR PERM_RW PERM_RWX
PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE PPM_INSTALL_EXEC
PPM_INSTALL_SCRIPT PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
SIGN SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
@@ -293,7 +293,7 @@
@Overridable = @MM_Sections;
push @Overridable, qw[
- libscan makeaperl needs_linking perm_rw perm_rwx
+ libscan makeaperl needs_linking perm_dir perm_rw perm_rwx
subdir_x test_via_harness test_via_script
init_VERSION init_dist init_INST init_INSTALL init_DEST init_dirscan
@@ -2016,6 +2016,11 @@
Directory containing the Perl source code (use of this should be
avoided, it may be undefined)
+=item PERM_DIR
+
+Desired permission for directories. Defaults to C<755>.
+See also L<MM_Unix/perm_dir>.
+
=item PERM_RW
Desired permission for read/writable files. Defaults to C<644>.