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

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