[Rt-commit] rt branch, 4.0/force-sitelib-installs, created. rt-4.0.18-101-g1d78f71
Alex Vandiver
alexmv at bestpractical.com
Wed Nov 27 16:13:30 EST 2013
The branch, 4.0/force-sitelib-installs has been created
at 1d78f714d7e029c14924aa9c18f92d0de987ec27 (commit)
- Log -----------------------------------------------------------------
commit 1d78f714d7e029c14924aa9c18f92d0de987ec27
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Feb 29 02:01:55 2012 -0500
Force dual-life modules to be installed into site_perl if possible
Generally, perl prior to 5.11 had privlib (the core perl libraries)
before sitelib. However, some helpful distributions (RedHat, Debian,
etc) patched perl to have site_perl come before core perl.
Unfortunately, the dual-life modules don't know this, and still assume
they need to install into core perl for the updated module to be seen --
which the distribution will promptly clobber if it ever reinstalls its
perl package.
Detect such patched perls, identifiable by being < 5.11, but having
sitelib before privlib, and set INSTALLDIRS=site. This tells CPAN to
force installation into the site_perl directory, even for dual-life
modules, which will prevent them being later clobbered by the package.
This change, while it will lead to fewer installs broken by
distributions, does have the downside that running a simple `cpan
modulename` later will update the core version, which will be shadowed
by the site_perl version. We thus allow the --no-siteinstall option to
configure to disable this new behavior.
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index efa35fe..a717672 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -81,6 +81,7 @@ GetOptions(
'download=s',
'repository=s',
'list-deps',
+ 'siteinstall!',
'help|h',
);
@@ -476,6 +477,27 @@ sub resolve_dep {
my $module = shift;
my $version = shift;
+ unless (defined $args{siteinstall}) {
+ require Config;
+ my %uniq;
+ my @order = grep {($_ eq $Config::Config{sitelibexp}
+ or $_ eq $Config::Config{privlibexp})
+ and not $uniq{$_}++} @INC;
+ if ($] < 5.011 and @order == 2
+ and $order[0] eq $Config::Config{sitelibexp}
+ and $order[1] eq $Config::Config{privlibexp}) {
+
+ print "\n";
+ print "Patched perl, with site_perl before core in \@INC, detected.\n";
+ print "Installing dual-life modules into site_perl so they are not\n";
+ print "later overridden by the distribution's package.\n";
+
+ $args{siteinstall} = 1;
+ } else {
+ $args{siteinstall} = 0;
+ }
+ }
+
print "\nInstall module $module\n";
my $ext = $ENV{'RT_FIX_DEPS_CMD'} || $ENV{'PERL_PREFER_CPAN_CLIENT'};
@@ -495,6 +517,12 @@ Please run `@PERL@ -MCPAN -e shell` to configure it.
END
exit(1);
}
+
+ my $installdirs = $CPAN::Config->{makepl_arg} ||= "";
+ $installdirs =~ s/(\bINSTALLDIRS=\S+|$)/ INSTALLDIRS=site/
+ if $args{siteinstall};
+ local $CPAN::Config->{makepl_arg} = $installdirs;
+
my $rv = eval { require CPAN; CPAN::Shell->install($module) };
return $rv unless $@;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list