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 {
}
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;
......
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