summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apkbuild-cpan.in15
1 files changed, 8 insertions, 7 deletions
diff --git a/apkbuild-cpan.in b/apkbuild-cpan.in
index 7393082..fc84260 100644
--- a/apkbuild-cpan.in
+++ b/apkbuild-cpan.in
@@ -108,17 +108,17 @@ sub read_apkbuild {
}
sub write_apkbuild {
- my ($distdata, $authors) = @_;
+ my ($distdata, $authors, $moddata) = @_;
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->{metadata}{name}),
- pkgreal => $distdata->{metadata}{name},
- pkgver => $distdata->{metadata}{version},
- source => $distdata->{download_url},
+ pkgname => map_cpan_to_apk($moddata->{distribution}),
+ pkgreal => $moddata->{distribution},
+ pkgver => $moddata->{version},
+ source => $moddata->{download_url},
);
$template =~ s/\[% (.*?) %\]/$repl{$1}/g;
@@ -152,7 +152,7 @@ sub parse_deps {
# map package names to alpine packages
foreach ( keys %{ $distfiles } ) {
- $response = $ua->get("https://fastapi.metacpan.org/releases/$_");
+ $response = $ua->get("https://fastapi.metacpan.org/release/$_");
$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";
@@ -258,6 +258,7 @@ EOF
}
sub do_depends {
+
my $apkbuild = read_apkbuild;
my $metaprefix = "src/" . $apkbuild->{'_pkgreal'} . "-" . $apkbuild->{'pkgver'} . "/";
my $meta;
@@ -350,7 +351,7 @@ given ( $ARGV[0] ) {
my $apkname = map_cpan_to_apk $distdata->{metadata}{name};
mkdir $apkname;
chdir $apkname;
- write_apkbuild($distdata);
+ write_apkbuild($distdata, undef, $moddata);
prepare_tree;
update_functions;
do_depends;