Hi Jos,

I'm a maintainer of the Perl package in Debian.

We currently ship CPANPLUS 0.84 as bundled with Perl 5.10.0, and I'm
about to apply the attached Debian-specific patches due to
 http://bugs.debian.org/533707 (cc'd as [email protected])

This mail is mainly FYI, but please let me know if you think this should
be handled in a different way.

The first patch is just a preconfigured CPANPLUS::Config::System module
that tells CPANPLUS to install all modules, including core ones, in the
site directories, even if their Makefile.PL or Build.PL says otherwise,
so that they will not clobber the ones tracked by our package manager.
Our @INC ordering will make sure that the local version in the site
directory will be the first on the search path.

(We've done this for ages with CPAN.pm and Makefile.PL, and I'm presently
 adding Build.PL support to that as well.)

An alternative solution would be to modify the empty defaults in
CPANPLUS::Config, but this one seems cleaner to me.

The other patch is about where the saved CPANPLUS::Config::System
should go. Our policy says that configuration files need to be in /etc,
and we have /etc/perl first on @INC for things like this.

The patch is something of a hack, I'm not thrilled about messing inside
the CPANPLUS::Internals namespace. Would you be willing to implement a
cleaner hook for this?

Many thanks for all your work on CPANPLUS and other Perl stuff,
-- 
Niko Tyni   [email protected]
From: Niko Tyni <[email protected]>
Subject: Configure CPANPLUS to use the site directories by default.
Closes: 533707
    
The core modules usually default to INSTALLDIRS=perl (ExtUtils::MakeMaker)
or installdirs=core (Module::Build), so we need to explicitly ask for
the site destination to get upgraded versions into /usr/local.

See also the sister patch, debian/cpan_definstalldirs .


---
 lib/CPANPLUS/Config/System.pm |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/lib/CPANPLUS/Config/System.pm b/lib/CPANPLUS/Config/System.pm
new file mode 100644
index 0000000..5e6e11e
--- /dev/null
+++ b/lib/CPANPLUS/Config/System.pm
@@ -0,0 +1,30 @@
+### minimal pod, so you can find it with perldoc -l, etc
+=pod
+
+=head1 NAME
+
+CPANPLUS::Config::System
+
+=head1 DESCRIPTION
+
+This is a CPANPLUS configuration file that sets appropriate default
+settings on Debian systems.
+
+The only preconfigured settings are C<makemakerflags> (set to
+C<INSTALLDIRS=site>) and C<buildflags> (set to C<--installdirs site>).
+
+These settings will not have any effect if
+C</etc/perl/CPANPLUS/Config/System.pm> is present.
+
+=cut
+
+
+package CPANPLUS::Config::System;
+
+sub setup {
+    my $conf = shift;
+    $conf->set_conf( makemakerflags => 'INSTALLDIRS=site' );    
+    $conf->set_conf( buildflags => '--installdirs site' );    
+}
+
+1;
-- 
tg: (71b2123..) debian/cpanplus_definstalldirs (depends on: upstream)
From: Niko Tyni <[email protected]>
Subject: Save local versions of CPANPLUS::Config::System into /etc/perl.

This is a configuration file and needs to go in /etc by policy.
Besides, /usr may not even be writable.
    
This mirrors the Debian setup of CPAN.pm in debian/cpan_config_path.

See #533707.


---
 lib/CPANPLUS/Configure.pm           |    1 +
 lib/CPANPLUS/Internals/Constants.pm |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/CPANPLUS/Configure.pm b/lib/CPANPLUS/Configure.pm
index d890d1c..b23cc7c 100644
--- a/lib/CPANPLUS/Configure.pm
+++ b/lib/CPANPLUS/Configure.pm
@@ -242,6 +242,7 @@ Saves the configuration to the package name you provided.
 If this package is not C<CPANPLUS::Config::System>, it will
 be saved in your C<.cpanplus> directory, otherwise it will
 be attempted to be saved in the system wide directory.
+(On Debian systems, this system wide directory is /etc/perl.)
 
 If no argument is provided, it will default to your personal
 config.
diff --git a/lib/CPANPLUS/Internals/Constants.pm b/lib/CPANPLUS/Internals/Constants.pm
index bfd4439..81136fb 100644
--- a/lib/CPANPLUS/Internals/Constants.pm
+++ b/lib/CPANPLUS/Internals/Constants.pm
@@ -185,6 +185,9 @@ use constant CONFIG_USER_FILE    => sub {
                                     ) . '.pm';
                                 };
 use constant CONFIG_SYSTEM_FILE  => sub {
+                                    # Debian-specific shortcut
+                                    return '/etc/perl/CPANPLUS/Config/System.pm';
+                                    
                                     require CPANPLUS::Internals;
                                     require File::Basename;
                                     my $dir = File::Basename::dirname(
-- 
tg: (71b2123..) debian/cpanplus_config_path (depends on: upstream)

Reply via email to