summaryrefslogtreecommitdiffstats
path: root/apkbuild-cpan.in
diff options
context:
space:
mode:
authorTimothy Legge <timlegge@gmail.com>2020-03-03 19:14:05 +0000
committerTimothy Legge <timlegge@gmail.com>2020-03-23 18:14:47 +0000
commit28bf6f71f088d12156fba5d125870e9c8a8e50cb (patch)
tree6475e62f9d524d4a18225b07d530e5774e6fb920 /apkbuild-cpan.in
parent3d1c703562f978f769493853205250a65265b080 (diff)
downloadabuild-28bf6f71f088d12156fba5d125870e9c8a8e50cb.tar.bz2
abuild-28bf6f71f088d12156fba5d125870e9c8a8e50cb.tar.xz
apkbuild-cpan.in: fix parse_deps for multiple CPAN::Meta::Requirements return unique
do_depends can send multiple meta dependencies as additional parameters parse_deps was not itterating through each of the parameters this fix gets the entire list without duplicate entries
Diffstat (limited to 'apkbuild-cpan.in')
-rwxr-xr-xapkbuild-cpan.in31
1 files changed, 16 insertions, 15 deletions
diff --git a/apkbuild-cpan.in b/apkbuild-cpan.in
index c023deb..c538d34 100755
--- a/apkbuild-cpan.in
+++ b/apkbuild-cpan.in
@@ -124,22 +124,23 @@ sub parse_deps {
my $response;
my $deps = "";
- for my $module ($reqs->required_modules) {
- if (Module::CoreList->is_core($module)) {
- my $perlver = Module::CoreList->first_release($module);
- say "$module is part of core perl since $perlver.";
- next;
+ foreach $reqs (@_) {
+ for my $module ($reqs->required_modules) {
+ if (Module::CoreList->is_core($module)) {
+ my $perlver = Module::CoreList->first_release($module);
+ say "$module is part of core perl since $perlver.";
+ next;
+ }
+ next if $module eq 'perl';
+
+ # map module name to package name
+ $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->{$module} = $moddata->{distribution};
}
- next if $module eq 'perl';
-
- # map module name to package name
- $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->{$module} = $moddata->{distribution};
}
-
# map package names to alpine packages
foreach ( keys %{ $distfiles } ) {
$response = $ua->get("https://fastapi.metacpan.org/module/$_");
@@ -148,7 +149,7 @@ sub parse_deps {
$distdata->{error} and die "Error trying to locate $_: $distdata->{error}\n";
my $pkgname = map_cpan_to_apk($distdata->{distribution});
- $deps .= "$pkgname ";
+ $deps .= "$pkgname " unless $deps =~ m/$pkgname/;
}
$deps =~ s/\h+/ /g;
$deps =~ s/ $//;