In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/fea97686030c8c2a333a9db3d7a250ac81c5212c?hp=95db2efbae5edc9942892a1153e1db8056d6ca06>

- Log -----------------------------------------------------------------
commit fea97686030c8c2a333a9db3d7a250ac81c5212c
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sun Sep 24 14:05:56 2017 -0700

    sync-with-cpan: curl support

M       Porting/sync-with-cpan

commit 54ed4dc462a20cd99c2dfeb4b0bdd34bfce1ac83
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sun Sep 24 13:27:18 2017 -0700

    Porting/sync-with-cpan: 5.12 compatibility
    
    So I can type simply ‘Porting/sync-with-cpan Test::Simple’ and run
    it with the system perl.

M       Porting/sync-with-cpan
-----------------------------------------------------------------------

Summary of changes:
 Porting/sync-with-cpan | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/Porting/sync-with-cpan b/Porting/sync-with-cpan
index 0176e18045..db42fc4afa 100755
--- a/Porting/sync-with-cpan
+++ b/Porting/sync-with-cpan
@@ -295,6 +295,22 @@ if ($cpan_mod =~ /-/ && $cpan_mod !~ /::/) {
     $cpan_mod =~ s/-/::/g;
 }
 
+sub wget {
+    my ($url, $saveas) = @_;
+    eval {
+        require HTTP::Tiny;
+        my $http= HTTP::Tiny->new();
+        $http->mirror( $url => $saveas );
+        1
+    } or
+       # Some system do not have wget.  Fall back to curl if we do not
+       # have it.  On Windows, `which wget` is not going to work, so
+       # just use wget, as this script has always done.
+       WIN32 || -x substr(`which wget`, 0, -1)
+         ? system wget => $url, '-qO', $saveas
+         : system curl => $url, '-sSo', $saveas;
+}
+
 #
 # Find the information from CPAN.
 #
@@ -313,12 +329,7 @@ else {
     # Poor man's cache
     #
     unless (-f $package_file && -M $package_file < 1) {
-        eval {
-            require HTTP::Tiny;
-            my $http= HTTP::Tiny->new();
-            $http->mirror( $package_url => $package_file );
-            1
-        } or system wget => $package_url, '-qO', $package_file;
+        wget $package_url, $package_file;
     }
 
     open my $fh, '<', $package_file;
@@ -339,12 +350,7 @@ else {
     #
     # Fetch the new distro
     #
-    eval {
-        require HTTP::Tiny;
-        my $http= HTTP::Tiny->new();
-        $http->mirror( $url => $new_file );
-        1
-    } or system wget => $url, '-qO', $new_file;
+    wget $url, $new_file;
 }
 
 my  $old_dir      = "$pkg_dir-$old_version";
@@ -486,7 +492,7 @@ if (@de_exec && @delete) {
 # Mustn't change the +x bit on files that are whitelisted
 #
 if (@de_exec) {
-    my %permitted = map +(tr/\n//dr => 1), grep !/^#/,
+    my %permitted = map { (my $x = $_) =~ tr/\n//d; $x => 1 } grep !/^#/,
         do { local @ARGV = '../Porting/exec-bit.txt'; <> };
     @de_exec = grep !$permitted{"cpan/$pkg_dir/$_"}, @de_exec;
 }

--
Perl5 Master Repository

Reply via email to