apkbuild-cpan.in: always start pkgver with a digit

The 'version' string from CPAN can start with 'v...' or similar.
This commit is contained in:
Joseph Burt 2019-08-20 19:38:23 +00:00 committed by Natanael Copa
parent dbf0e80e62
commit baf17c8dd7

View File

@ -107,10 +107,11 @@ sub write_apkbuild {
authors => ($authors or "# Contributor: $packager\n# Maintainer: $packager"),
pkgname => map_cpan_to_apk($moddata->{distribution}),
pkgreal => $moddata->{distribution},
pkgver => $moddata->{version},
source => $moddata->{download_url} =~ s/$moddata->{version}/\$pkgver/r,
pkgver => $moddata->{version} =~ s/^[^0-9]+//r,
source => $moddata->{download_url},
pkgdesc => $distdata->{abstract},
);
$repl{source} =~ s/$repl{pkgver}/\$pkgver/g;
$template =~ s/\[% (.*?) %\]/$repl{$1}/g;
open my $fh, '>', "APKBUILD" or die;
@ -338,7 +339,7 @@ given ( $ARGV[0] ) {
when ("upgrade") {
my ($apkbuild, $distdata, $moddata) = get_data;
my $pkgver = $moddata->{version};
my $pkgver = $moddata->{version} =~ s/^[^0-9]+//r;
if ($pkgver != $apkbuild->{pkgver}) {
say "Upgrading CPAN module from $apkbuild->{pkgver} to $pkgver";
@ -358,7 +359,7 @@ given ( $ARGV[0] ) {
}
when ('check') {
my ($apkbuild, $distdata, $moddata) = get_data;
my $pkgver = $moddata->{version};
my $pkgver = $moddata->{version} =~ s/^[^0-9]+//r;
say "$apkbuild->{pkgname}: Latest version: $pkgver Packaged version: $apkbuild->{pkgver}";
if ($pkgver ne $apkbuild->{pkgver}) {
exit(1);