[perl-CPAN] Allow changing configuration directory name

Petr Pisar ppisar at fedoraproject.org
Thu Jan 29 08:13:32 UTC 2015


commit 797343e594777bdfaa284381dd795d6febac0ed7
Author: Petr Písař <ppisar at redhat.com>
Date:   Wed Jan 28 14:19:35 2015 +0100

    Allow changing configuration directory name

 ...figuration-direcotory-string-with-a-marke.patch |  157 ++++++++++++++++++++
 perl-CPAN.spec                                     |   10 +-
 2 files changed, 166 insertions(+), 1 deletions(-)
---
diff --git a/CPAN-2.05-Replace-configuration-direcotory-string-with-a-marke.patch b/CPAN-2.05-Replace-configuration-direcotory-string-with-a-marke.patch
new file mode 100644
index 0000000..37db543
--- /dev/null
+++ b/CPAN-2.05-Replace-configuration-direcotory-string-with-a-marke.patch
@@ -0,0 +1,157 @@
+From a5c7a3e5118aac73ac2adef676d842392c41cff3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Wed, 28 Jan 2015 13:21:10 +0100
+Subject: [PATCH] Replace configuration direcotory string with a marker
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This allows to redefine the configuration directory name at build
+time.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+
+diff --git a/Makefile.PL b/Makefile.PL
+index 04d94aa..61c87bf 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -327,21 +327,21 @@ record-session :
+ 	$(PERL) -Ilib -MCPAN -e '$$CPAN::Suppress_readline=$$CPAN::Echo_readline=1;shell' | tee ttt.out
+ 
+ run-with-sqlite :
+-	$(PERL) -I$$HOME/.cpan -Ilib -MCPAN::SQLite -MCPAN::MyConfig -MCPAN -e '$$CPAN::Config->{use_sqlite}++; $$CPAN::Config->{sqlite_dbname}="cpandb-sqlite"; shell'
++	$(PERL) -I$$HOME/.XCPANCONFIGNAMEX -Ilib -MCPAN::SQLite -MCPAN::MyConfig -MCPAN -e '$$CPAN::Config->{use_sqlite}++; $$CPAN::Config->{sqlite_dbname}="cpandb-sqlite"; shell'
+ 
+ testrun_very_offline : rm_mirrored_by run_emu_offline
+ 
+ testrun_emu_offline :
+-	$(PERL) -I$$HOME/.cpan -Ilib -MCPAN::MyConfig -MCPAN -e '@CPAN::Defaultsites = qw(file:///dev/null); $$CPAN::Config->{urllist} = []; shell'
++	$(PERL) -I$$HOME/.XCPANCONFIGNAMEX -Ilib -MCPAN::MyConfig -MCPAN -e '@CPAN::Defaultsites = qw(file:///dev/null); $$CPAN::Config->{urllist} = []; shell'
+ 
+ rm_mirrored_by :
+-	rm -f $$HOME/.cpan/sources/MIRRORED.BY*
++	rm -f $$HOME/.XCPANCONFIGNAMEX/sources/MIRRORED.BY*
+ 
+ testrun_http_only :
+-	$(PERL) -I$$HOME/.cpan -Ilib -MCPAN::MyConfig -MCPAN -e '$$CPAN::Config->{urllist} = [qw(http://www.planet-elektronik.de/CPAN/)]; shell'
++	$(PERL) -I$$HOME/.XCPANCONFIGNAMEX -Ilib -MCPAN::MyConfig -MCPAN -e '$$CPAN::Config->{urllist} = [qw(http://www.planet-elektronik.de/CPAN/)]; shell'
+ 
+ urllist :
+-	$(PERL) -Ilib -MCPAN -MCPAN::FirstTime -e 'CPAN::FirstTime::init("$$ENV{HOME}/.cpan/CPAN/MyConfig", args => [qw(urllist)])'
++	$(PERL) -Ilib -MCPAN -MCPAN::FirstTime -e 'CPAN::FirstTime::init("$$ENV{HOME}/.XCPANCONFIGNAMEX/CPAN/MyConfig", args => [qw(urllist)])'
+ 
+ runadmin :
+ 	$(PERL) -Ilib -MCPAN::Admin -eshell
+diff --git a/README b/README
+index cadff53..7b1a3ae 100644
+--- a/README
++++ b/README
+@@ -269,7 +269,7 @@ DESCRIPTION
+       restarting the whole get/make/test/install procedure from scratch.
+ 
+     Lockfile
+-      Interactive sessions maintain a lockfile, by default "~/.cpan/.lock".
++      Interactive sessions maintain a lockfile, by default "~/.XCPANCONFIGNAMEX/.lock".
+       Batch jobs can run without a lockfile and not disturb each other.
+ 
+       The shell offers to run in *downgraded mode* when another process is
+@@ -329,7 +329,7 @@ DESCRIPTION
+         "install_tested".
+ 
+   mkmyconfig
+-    mkmyconfig() writes your own CPAN::MyConfig file into your "~/.cpan/"
++    mkmyconfig() writes your own CPAN::MyConfig file into your "~/.XCPANCONFIGNAMEX/"
+     directory so that you can save your own preferences instead of the
+     system-wide ones.
+ 
+@@ -494,7 +494,7 @@ CONFIGURATION
+ 
+     Default values defined in the CPAN/Config.pm file can be overridden in a
+     user specific file: CPAN/MyConfig.pm. Such a file is best placed in
+-    "$HOME/.cpan/CPAN/MyConfig.pm", because "$HOME/.cpan" is added to the
++    "$HOME/.XCPANCONFIGNAMEX/CPAN/MyConfig.pm", because "$HOME/.XCPANCONFIGNAMEX" is added to the
+     search path of the CPAN module before the use() or require() statements.
+     The mkmyconfig command writes this file for you.
+ 
+@@ -1944,8 +1944,8 @@ FAQ
+ 
+         You may want to configure something like
+ 
+-          o conf make_arg "| tee -ai /root/.cpan/logs/make.out"
+-          o conf make_install_arg "| tee -ai /root/.cpan/logs/make_install.out"
++          o conf make_arg "| tee -ai /root/.XCPANCONFIGNAMEX/logs/make.out"
++          o conf make_install_arg "| tee -ai /root/.XCPANCONFIGNAMEX/logs/make_install.out"
+ 
+         so that STDOUT is captured in a file for later inspection.
+ 
+diff --git a/lib/CPAN.pm b/lib/CPAN.pm
+index 4ed4b6c..e30b9d7 100644
+--- a/lib/CPAN.pm
++++ b/lib/CPAN.pm
+@@ -1680,7 +1680,7 @@ restarting the whole get/make/test/install procedure from scratch.
+ 
+ =item Lockfile
+ 
+-Interactive sessions maintain a lockfile, by default C<~/.cpan/.lock>.
++Interactive sessions maintain a lockfile, by default C<~/.XCPANCONFIGNAMEX/.lock>.
+ Batch jobs can run without a lockfile and not disturb each other.
+ 
+ The shell offers to run in I<downgraded mode> when another process is
+@@ -1754,7 +1754,7 @@ C<install_tested>.
+ 
+ =head2 mkmyconfig
+ 
+-mkmyconfig() writes your own CPAN::MyConfig file into your C<~/.cpan/>
++mkmyconfig() writes your own CPAN::MyConfig file into your C<~/.XCPANCONFIGNAMEX/>
+ directory so that you can save your own preferences instead of the
+ system-wide ones.
+ 
+@@ -1932,7 +1932,7 @@ in a file CPAN/Config.pm.
+ 
+ Default values defined in the CPAN/Config.pm file can be
+ overridden in a user specific file: CPAN/MyConfig.pm. Such a file is
+-best placed in C<$HOME/.cpan/CPAN/MyConfig.pm>, because C<$HOME/.cpan> is
++best placed in C<$HOME/.XCPANCONFIGNAMEX/CPAN/MyConfig.pm>, because C<$HOME/.XCPANCONFIGNAMEX> is
+ added to the search path of the CPAN module before the use() or
+ require() statements. The mkmyconfig command writes this file for you.
+ 
+@@ -3608,8 +3608,8 @@ there is too much output to keep track of.
+ 
+ You may want to configure something like
+ 
+-  o conf make_arg "| tee -ai /root/.cpan/logs/make.out"
+-  o conf make_install_arg "| tee -ai /root/.cpan/logs/make_install.out"
++  o conf make_arg "| tee -ai /root/.XCPANCONFIGNAMEX/logs/make.out"
++  o conf make_install_arg "| tee -ai /root/.XCPANCONFIGNAMEX/logs/make_install.out"
+ 
+ so that STDOUT is captured in a file for later inspection.
+ 
+diff --git a/lib/CPAN/HandleConfig.pm b/lib/CPAN/HandleConfig.pm
+index f114321..a6e596b 100644
+--- a/lib/CPAN/HandleConfig.pm
++++ b/lib/CPAN/HandleConfig.pm
+@@ -536,7 +536,7 @@ sub cpan_home_dir_candidates {
+     push @dirs, $ENV{USERPROFILE} if $ENV{USERPROFILE};
+ 
+     $CPAN::Config->{load_module_verbosity} = $old_v;
+-    my $dotcpan = $^O eq 'VMS' ? '_cpan' : '.cpan';
++    my $dotcpan = $^O eq 'VMS' ? '_XCPANCONFIGNAMEX' : '.XCPANCONFIGNAMEX';
+     @dirs = map { File::Spec->catdir($_, $dotcpan) } grep { defined } @dirs;
+     return wantarray ? @dirs : $dirs[0];
+ }
+diff --git a/scripts/cpan-mirrors b/scripts/cpan-mirrors
+index 3c8678b..7a0e756 100755
+--- a/scripts/cpan-mirrors
++++ b/scripts/cpan-mirrors
+@@ -6,7 +6,7 @@ use warnings;
+ use CPAN::Mirrors;
+ use Data::Dumper;
+ 
+-my $mirrored_by_file = '/Users/brian/.cpan/sources/MIRRORED.BY';
++my $mirrored_by_file = '/Users/brian/.XCPANCONFIGNAMEX/sources/MIRRORED.BY';
+ my $mirrors = CPAN::Mirrors->new( $mirrored_by_file );
+ 
+ my $seen = {};
+-- 
+1.9.3
+
diff --git a/perl-CPAN.spec b/perl-CPAN.spec
index 8c61cbc..5db8f04 100644
--- a/perl-CPAN.spec
+++ b/perl-CPAN.spec
@@ -1,6 +1,6 @@
 Name:           perl-CPAN
 Version:        2.05
-Release:        308%{?dist}
+Release:        309%{?dist}
 Summary:        Query, download and build perl modules from CPAN sites
 License:        GPL+ or Artistic
 Group:          Development/Libraries
@@ -8,6 +8,8 @@ URL:            http://search.cpan.org/dist/CPAN/
 Source0:        http://www.cpan.org/authors/id/A/AN/ANDK/CPAN-%{version}.tar.gz
 # Create site paths for the first time, bug #1158873, CPAN RT#99905
 Patch0:         CPAN-2.05-Attemp-to-create-site-library-directories-on-first-t.patch
+# Change configuration directory name
+Patch1:         CPAN-2.05-Replace-configuration-direcotory-string-with-a-marke.patch
 BuildArch:      noarch
 BuildRequires:  perl
 BuildRequires:  perl(Config)
@@ -171,6 +173,9 @@ external download clients to fetch distributions from the net.
 %prep
 %setup -q -n CPAN-%{version}
 %patch0 -p1
+%patch1 -p1
+# Change configuration name
+find -type f -exec sed -i -e 's/XCPANCONFIGNAMEX/cpan/g' {} \;
 # Remove bundled modules
 rm -r ./inc/*
 sed -i -e '/inc\//d' MANIFEST
@@ -195,6 +200,9 @@ make test
 %{_mandir}/man3/*
 
 %changelog
+* Wed Jan 28 2015 Petr Pisar <ppisar at redhat.com> - 2.05-309
+- Allow changing the configuration directory name
+
 * Thu Oct 30 2014 Petr Pisar <ppisar at redhat.com> - 2.05-308
 - Create site paths for the first time (bug #1158873)
 


More information about the scm-commits mailing list