From 27c430cc64e7ea59c7e5610809bac23cc7191d74 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Sun, 25 Nov 2018 01:51:08 +0000 Subject: [PATCH] Updates for metacpan --- apkbuild-cpan.in | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/apkbuild-cpan.in b/apkbuild-cpan.in index 8160042..62ba4d5 100644 --- a/apkbuild-cpan.in +++ b/apkbuild-cpan.in @@ -31,7 +31,7 @@ _pkgreal=[% pkgreal %] pkgver=[% pkgver %] pkgrel=0 pkgdesc="Perl module for [% pkgreal %]" -url="http://search.cpan.org/dist/[% pkgreal %]/" +url="https://metacpan.org/release/[% pkgreal %]/" arch="noarch" license="GPL PerlArtistic" cpandepends="" @@ -110,15 +110,15 @@ sub read_apkbuild { sub write_apkbuild { my ($distdata, $authors) = @_; - my $cpanid = $distdata->{releases}[0]->{cpanid}; + my $cpanid = $distdata->{releases}[0]->{id}; $cpanid = substr($cpanid, 0, 1) . "/" . substr($cpanid, 0, 2) . "/$cpanid"; my %repl = ( authors => ($authors or "# Contributor: $packager\n# Maintainer: $packager"), - pkgname => map_cpan_to_apk($distdata->{name}), - pkgreal => $distdata->{name}, - pkgver => $distdata->{releases}[0]->{version}, - source => "http://search.cpan.org/CPAN/authors/id/$cpanid/\$_pkgreal-\$pkgver.tar.gz", + pkgname => map_cpan_to_apk($distdata->{metadata}{name}), + pkgreal => $distdata->{metadata}{name}, + pkgver => $distdata->{version}, + source => $distdata->{download_url}, ); $template =~ s/\[% (.*?) %\]/$repl{$1}/g; @@ -143,16 +143,16 @@ sub parse_deps { next if $module eq 'perl'; # map module name to package name - $response = $ua->get("http://search.cpan.org/api/module/$module"); + $response = $ua->get("https://fastapi.metacpan.org/module/$module"); $response->is_success or die $response->status_line; my $moddata = $json->decode($response->decoded_content); $moddata->{error} and die "Error trying to locate $module: $moddata->{error}\n"; - $distfiles->{$moddata->{distvname}} = $moddata; + $distfiles->{$moddata->{distribution}} = $moddata; } # map package names to alpine packages foreach ( keys %{ $distfiles } ) { - $response = $ua->get("http://search.cpan.org/api/dist/$_"); + $response = $ua->get("https://fastapi.metacpan.org/releases/$_"); $response->is_success or die $response->status_line; my $distdata = $json->decode($response->decoded_content); $distdata->{error} and die "Error trying to locate $_: $distdata->{error}\n"; @@ -317,7 +317,7 @@ sub do_depends { sub get_data { my $apkbuild = read_apkbuild; $apkbuild->{_pkgreal} or die "Not apkbuild-cpan generated APKBUILD"; - my $response = $ua->get("http://search.cpan.org/api/dist/$apkbuild->{_pkgreal}"); + my $response = $ua->get("https://fastapi.metacpan.org/release/$apkbuild->{_pkgreal}"); $response->is_success or die $response->status_line; my $distdata = $json->decode($response->decoded_content); $distdata->{error} and die "Error trying to locate $apkbuild->{_pkgreal}: $distdata->{error}\n"; @@ -337,17 +337,17 @@ given ( $ARGV[0] ) { my $response; $module or die "Module name is a mandatory argument"; - $response = $ua->get("http://search.cpan.org/api/module/$module"); + $response = $ua->get("https://fastapi.metacpan.org/module/$module"); $response->is_success or die $response->status_line; my $moddata = $json->decode($response->decoded_content); $moddata->{error} and die "Error trying to locate $module: $moddata->{error}\n"; - $response = $ua->get("http://search.cpan.org/api/dist/$moddata->{distvname}"); + $response = $ua->get("https://fastapi.metacpan.org/release/$moddata->{distribution}"); $response->is_success or die $response->status_line; my $distdata = $json->decode($response->decoded_content); $distdata->{error} and die "Error trying to locate $module: $distdata->{error}\n"; - my $apkname = map_cpan_to_apk $distdata->{name}; + my $apkname = map_cpan_to_apk $distdata->{metadata}{name}; mkdir $apkname; chdir $apkname; write_apkbuild($distdata);