summaryrefslogtreecommitdiffstats
path: root/support/scripts
diff options
context:
space:
mode:
authorFrancois Perrad <fperrad@gmail.com>2017-06-14 16:15:31 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-06-15 22:32:01 +0200
commitc3839e048ed37227ccac07ae8aa9bd1ddf887ec3 (patch)
treed00e5dba065499bfaa0b28cc226c9553ce3cf36d /support/scripts
parente27c0b5acbac221df4ad6a1476aa1bcd1509f274 (diff)
downloadbuildroot-c3839e048ed37227ccac07ae8aa9bd1ddf887ec3.tar.gz
buildroot-c3839e048ed37227ccac07ae8aa9bd1ddf887ec3.zip
scancpan: refactor with $mirror
Signed-off-by: Francois Perrad <francois.perrad@gadz.org> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/scripts')
-rwxr-xr-xsupport/scripts/scancpan6
1 files changed, 4 insertions, 2 deletions
diff --git a/support/scripts/scancpan b/support/scripts/scancpan
index 82c77a8575..62df225361 100755
--- a/support/scripts/scancpan
+++ b/support/scripts/scancpan
@@ -521,6 +521,7 @@ my %deps_runtime; # name -> list of target dependencies
my %deps_optional; # name -> list of optional target dependencies
my %license_files; # name -> list of license files
my %checksum; # author -> list of checksum
+my $mirror = 'http://cpan.metacpan.org'; # a CPAN mirror
my $mcpan = MetaCPAN::API::Tiny->new(base_url => 'http://fastapi.metacpan.org/v1');
my $ua = HTTP::Tiny->new();
@@ -529,7 +530,8 @@ sub get_checksum {
my($path) = $url =~ m|^[^:/?#]+://[^/?#]*([^?#]*)|;
my($basename, $dirname) = fileparse( $path );
unless ($checksum{$dirname}) {
- my $response = $ua->get(qq{http://cpan.metacpan.org${dirname}CHECKSUMS});
+ my $url = $mirror . $dirname . q{CHECKSUMS};
+ my $response = $ua->get($url);
$checksum{$dirname} = $response->{content};
}
my $chksum = Safe->new->reval($checksum{$dirname});
@@ -720,7 +722,7 @@ while (my ($distname, $dist) = each %dist) {
my $sha256 = $checksum->{sha256};
say qq{write ${hashname}} unless $quiet;
open my $fh, q{>}, $hashname;
- say {$fh} qq{# retrieved by scancpan from http://cpan.metacpan.org/};
+ say {$fh} qq{# retrieved by scancpan from ${mirror}/};
say {$fh} qq{md5 ${md5} ${filename}};
say {$fh} qq{sha256 ${sha256} ${filename}};
close $fh;
OpenPOWER on IntegriCloud