Commit f98db143 authored by Timothy Legge's avatar Timothy Legge Committed by Natanael Copa

Many of setings should come from module not release api

parent c8935302
...@@ -108,17 +108,17 @@ sub read_apkbuild { ...@@ -108,17 +108,17 @@ sub read_apkbuild {
} }
sub write_apkbuild { sub write_apkbuild {
my ($distdata, $authors) = @_; my ($distdata, $authors, $moddata) = @_;
my $cpanid = $distdata->{releases}[0]->{id}; my $cpanid = $distdata->{releases}[0]->{id};
$cpanid = substr($cpanid, 0, 1) . "/" . substr($cpanid, 0, 2) . "/$cpanid"; $cpanid = substr($cpanid, 0, 1) . "/" . substr($cpanid, 0, 2) . "/$cpanid";
my %repl = ( my %repl = (
authors => ($authors or "# Contributor: $packager\n# Maintainer: $packager"), authors => ($authors or "# Contributor: $packager\n# Maintainer: $packager"),
pkgname => map_cpan_to_apk($distdata->{metadata}{name}), pkgname => map_cpan_to_apk($moddata->{distribution}),
pkgreal => $distdata->{metadata}{name}, pkgreal => $moddata->{distribution},
pkgver => $distdata->{metadata}{version}, pkgver => $moddata->{version},
source => $distdata->{download_url}, source => $moddata->{download_url},
); );
$template =~ s/\[% (.*?) %\]/$repl{$1}/g; $template =~ s/\[% (.*?) %\]/$repl{$1}/g;
...@@ -152,7 +152,7 @@ sub parse_deps { ...@@ -152,7 +152,7 @@ sub parse_deps {
# map package names to alpine packages # map package names to alpine packages
foreach ( keys %{ $distfiles } ) { 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; $response->is_success or die $response->status_line;
my $distdata = $json->decode($response->decoded_content); my $distdata = $json->decode($response->decoded_content);
$distdata->{error} and die "Error trying to locate $_: $distdata->{error}\n"; $distdata->{error} and die "Error trying to locate $_: $distdata->{error}\n";
...@@ -258,6 +258,7 @@ EOF ...@@ -258,6 +258,7 @@ EOF
} }
sub do_depends { sub do_depends {
my $apkbuild = read_apkbuild; my $apkbuild = read_apkbuild;
my $metaprefix = "src/" . $apkbuild->{'_pkgreal'} . "-" . $apkbuild->{'pkgver'} . "/"; my $metaprefix = "src/" . $apkbuild->{'_pkgreal'} . "-" . $apkbuild->{'pkgver'} . "/";
my $meta; my $meta;
...@@ -350,7 +351,7 @@ given ( $ARGV[0] ) { ...@@ -350,7 +351,7 @@ given ( $ARGV[0] ) {
my $apkname = map_cpan_to_apk $distdata->{metadata}{name}; my $apkname = map_cpan_to_apk $distdata->{metadata}{name};
mkdir $apkname; mkdir $apkname;
chdir $apkname; chdir $apkname;
write_apkbuild($distdata); write_apkbuild($distdata, undef, $moddata);
prepare_tree; prepare_tree;
update_functions; update_functions;
do_depends; do_depends;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment