apkbuild-cpan.in fix issues with update, recreate, etc
This commit is contained in:
parent
f98db143cb
commit
422199858c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue