Blame SOURCES/CPAN-2.18-Attemp-to-create-site-library-directories-on-first-t.patch

cf6c8e
From 5f0215694664fe0dc78ef59a7c8ca0af83896187 Mon Sep 17 00:00:00 2001
cf6c8e
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
cf6c8e
Date: Thu, 30 Oct 2014 13:19:16 +0100
cf6c8e
Subject: [PATCH] Attemp to create site library directories on first time
cf6c8e
MIME-Version: 1.0
cf6c8e
Content-Type: text/plain; charset=UTF-8
cf6c8e
Content-Transfer-Encoding: 8bit
cf6c8e
cf6c8e
Some vendors configures site library directories into /usr/local, but
cf6c8e
they do not provide the directory on their systems because an
cf6c8e
administrator can have a read-only network-mounted file system there.
cf6c8e
cf6c8e
When running CPAN for the first time, CPAN cannot find the site
cf6c8e
directories and falls back to local::lib. To restore the user
cf6c8e
expectations with writable /usr/local, this patch tries to create the
cf6c8e
missing directories before checking for their presents.
cf6c8e
cf6c8e
Signed-off-by: Petr Písař <ppisar@redhat.com>
cf6c8e
---
cf6c8e
 lib/CPAN/FirstTime.pm | 18 ++++++++++++++++++
cf6c8e
 1 file changed, 18 insertions(+)
cf6c8e
cf6c8e
diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm
cf6c8e
index 531c115..8d82795 100644
cf6c8e
--- a/lib/CPAN/FirstTime.pm
cf6c8e
+++ b/lib/CPAN/FirstTime.pm
cf6c8e
@@ -2137,6 +2137,24 @@ sub _print_urllist {
cf6c8e
 }
cf6c8e
 
cf6c8e
 sub _can_write_to_libdirs {
cf6c8e
+    for ($Config{installsitelib}, $Config{installsitearch}) {
cf6c8e
+        if (!-d $_) {
cf6c8e
+            $CPAN::Frontend->mywarn(sprintf(
cf6c8e
+                    qq{Perl site library directory "%s" does not exist.\n},
cf6c8e
+                $_));
cf6c8e
+            File::Path::make_path($_, { error => \my $failure });
cf6c8e
+            if (@$failure) {
cf6c8e
+                $CPAN::Frontend->mywarn(sprintf(
cf6c8e
+                        qq{Perl site library directory "%s" } .
cf6c8e
+                        qq{could not been created: %s.\n},
cf6c8e
+                    $_, ${$$failure[0]}{$_}));
cf6c8e
+            } else {
cf6c8e
+                $CPAN::Frontend->mywarn(sprintf(
cf6c8e
+                        qq{Perl site library directory "%s" created.\n},
cf6c8e
+                    $_));
cf6c8e
+            }
cf6c8e
+        }
cf6c8e
+    }
cf6c8e
     return -w $Config{installprivlib}
cf6c8e
         && -w $Config{installarchlib}
cf6c8e
         && -w $Config{installsitelib}
cf6c8e
-- 
cf6c8e
2.13.6
cf6c8e