Updates for metacpan

This commit is contained in:
Timothy Legge 2018-11-25 01:51:08 +00:00 committed by Natanael Copa
parent 0126fbdffb
commit 27c430cc64
1 changed files with 13 additions and 13 deletions

View File

@ -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);