summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Legge <timlegge@gmail.com>2018-11-26 03:18:10 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2019-03-20 17:10:15 +0000
commit422199858ca8d134039ff315538f11c9ce522c9d (patch)
tree7288a039e86a3f9df31b95b170b4311c69e4b041
parentf98db143cbdcaa0d125381cb8f78338a024d9703 (diff)
downloadabuild-422199858ca8d134039ff315538f11c9ce522c9d.tar.bz2
abuild-422199858ca8d134039ff315538f11c9ce522c9d.tar.xz
apkbuild-cpan.in fix issues with update, recreate, etc
-rw-r--r--apkbuild-cpan.in19
1 files changed, 12 insertions, 7 deletions
diff --git a/apkbuild-cpan.in b/apkbuild-cpan.in
index fc84260..92bf2fc 100644
--- a/apkbuild-cpan.in
+++ b/apkbuild-cpan.in
@@ -110,7 +110,7 @@ sub read_apkbuild {
sub write_apkbuild {
my ($distdata, $authors, $moddata) = @_;
- my $cpanid = $distdata->{releases}[0]->{id};
+ my $cpanid = $distdata->{id};
$cpanid = substr($cpanid, 0, 1) . "/" . substr($cpanid, 0, 2) . "/$cpanid";
my %repl = (
@@ -323,7 +323,12 @@ sub get_data {
my $distdata = $json->decode($response->decoded_content);
$distdata->{error} and die "Error trying to locate $apkbuild->{_pkgreal}: $distdata->{error}\n";
- return ($apkbuild, $distdata);
+ $response = $ua->get("https://fastapi.metacpan.org/module/$distdata->{main_module}");
+ $response->is_success or die $response->status_line;
+ my $moddata = $json->decode($response->decoded_content);
+ $moddata->{error} and die "Error trying to locate $distdata->{main_module}: $moddata->{error}\n";
+
+ return ($apkbuild, $distdata, $moddata);
}
my $abuild_conf = read_assignments_from_file("/etc/abuild.conf");
@@ -357,14 +362,14 @@ given ( $ARGV[0] ) {
do_depends;
}
when ("recreate") {
- my ($apkbuild, $distdata) = get_data;
- write_apkbuild($distdata, $apkbuild->{authors});
+ my ($apkbuild, $distdata, $moddata) = get_data;
+ write_apkbuild($distdata, $apkbuild->{authors}, $moddata);
prepare_tree;
update_functions;
do_depends;
}
when ("upgrade") {
- my ($apkbuild, $distdata) = get_data;
+ my ($apkbuild, $distdata, $moddata) = get_data;
my $pkgver = $distdata->{metadata}{version};
if ($pkgver != $apkbuild->{pkgver}) {
@@ -385,8 +390,8 @@ given ( $ARGV[0] ) {
}
}
when ('check') {
- my ($apkbuild, $distdata) = get_data;
- my $pkgver = $distdata->{releases}[0]->{version};
+ my ($apkbuild, $distdata, $moddata) = get_data;
+ my $pkgver = $distdata->{metadata}{version};
say "$apkbuild->{pkgname}: Latest version: $pkgver Packaged version: $apkbuild->{pkgver}";
if ($pkgver ne $apkbuild->{pkgver}) {
exit(1);