[perl-CPAN] Create site paths for the first time

Petr Pisar ppisar at fedoraproject.org
Thu Oct 30 13:42:52 UTC 2014


commit 4a3fce664120eb6c2a4f6ed70a8235c4d47734f6
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Oct 30 13:37:37 2014 +0100

    Create site paths for the first time

 ...reate-site-library-directories-on-first-t.patch |   54 ++++++++++++++++++++
 perl-CPAN.spec                                     |    8 +++-
 2 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/CPAN-2.05-Attemp-to-create-site-library-directories-on-first-t.patch b/CPAN-2.05-Attemp-to-create-site-library-directories-on-first-t.patch
new file mode 100644
index 0000000..b6d36aa
--- /dev/null
+++ b/CPAN-2.05-Attemp-to-create-site-library-directories-on-first-t.patch
@@ -0,0 +1,54 @@
+From e8db9146beb7002f913c5687cf97d0d7d42b7c07 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 30 Oct 2014 13:19:16 +0100
+Subject: [PATCH] Attemp to create site library directories on first time
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Some vendors configures site library directories into /usr/local, but
+they do not provide the directory on their systems because an
+administrator can have a read-only network-mounted file system there.
+
+When running CPAN for the first time, CPAN cannot find the site
+directories and falls back to local::lib. To restore the user
+expectations with writable /usr/local, this patch tries to create the
+missing directories before checking for their presents.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ lib/CPAN/FirstTime.pm | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm
+index d1a8eef..2426812 100644
+--- a/lib/CPAN/FirstTime.pm
++++ b/lib/CPAN/FirstTime.pm
+@@ -2046,6 +2046,24 @@ sub _print_urllist {
+ }
+ 
+ sub _can_write_to_libdirs {
++    for ($Config{installsitelib}, $Config{installsitearch}) {
++        if (!-d $_) {
++            $CPAN::Frontend->mywarn(sprintf(
++                    qq{Perl site library directory "%s" does not exist.\n},
++                $_));
++            File::Path::make_path($_, { error => \my $failure });
++            if (@$failure) {
++                $CPAN::Frontend->mywarn(sprintf(
++                        qq{Perl site library directory "%s" } .
++                        qq{could not been created: %s.\n},
++                    $_, ${$$failure[0]}{$_}));
++            } else {
++                $CPAN::Frontend->mywarn(sprintf(
++                        qq{Perl site library directory "%s" created.\n},
++                    $_));
++            }
++        }
++    }
+     return -w $Config{installprivlib}
+         && -w $Config{installarchlib}
+         && -w $Config{installsitelib}
+-- 
+1.9.3
+
diff --git a/perl-CPAN.spec b/perl-CPAN.spec
index 76dc5c4..8c61cbc 100644
--- a/perl-CPAN.spec
+++ b/perl-CPAN.spec
@@ -1,11 +1,13 @@
 Name:           perl-CPAN
 Version:        2.05
-Release:        307%{?dist}
+Release:        308%{?dist}
 Summary:        Query, download and build perl modules from CPAN sites
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 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
 BuildArch:      noarch
 BuildRequires:  perl
 BuildRequires:  perl(Config)
@@ -168,6 +170,7 @@ external download clients to fetch distributions from the net.
 
 %prep
 %setup -q -n CPAN-%{version}
+%patch0 -p1
 # Remove bundled modules
 rm -r ./inc/*
 sed -i -e '/inc\//d' MANIFEST
@@ -192,6 +195,9 @@ make test
 %{_mandir}/man3/*
 
 %changelog
+* Thu Oct 30 2014 Petr Pisar <ppisar at redhat.com> - 2.05-308
+- Create site paths for the first time (bug #1158873)
+
 * Wed Sep 10 2014 Petr Pisar <ppisar at redhat.com> 2.05-307
 - Synchronize to perl.spec modifications
 - Disable non-core modules when bootstrapping



More information about the perl-devel mailing list