Many of setings should come from module not release api

This commit is contained in:
Timothy Legge 2018-11-25 17:43:37 +00:00 committed by Natanael Copa
parent c893530293
commit f98db143cb

View File

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