summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Legge <timlegge@gmail.com>2020-03-03 22:33:19 +0000
committerTimothy Legge <timlegge@gmail.com>2020-03-27 02:02:24 +0000
commitbcbb8979c74b61ee2d7872d84439d5d9313023c7 (patch)
tree080296c0f37a5da2546e4e9fb878abb204fae633
parent0387b8014add0ff031b6850396d1b68fc192b58c (diff)
downloadabuild-bcbb8979c74b61ee2d7872d84439d5d9313023c7.tar.bz2
abuild-bcbb8979c74b61ee2d7872d84439d5d9313023c7.tar.xz
apkbuild-cpan.in: fix missing variables fails and remove empty vars
aports convention is to delete empty variables from APKBUILD files this causes and issue with updating existing APKBUILD files new depends, makedepends or checkdepends are added to process the file properly. Empty variables are then deleted once the file processes correctly
-rwxr-xr-xapkbuild-cpan.in14
1 files changed, 11 insertions, 3 deletions
diff --git a/apkbuild-cpan.in b/apkbuild-cpan.in
index 6a7ff52..cc1b416 100755
--- a/apkbuild-cpan.in
+++ b/apkbuild-cpan.in
@@ -302,11 +302,19 @@ sub do_depends {
die "Can't find license line in APKBUILD";
}
$text =~ s/^depends=\"([^\"]*)\"$/depends=\"$deps\"/mg or
- die "Can't find depends line in APKBUILD";
+ $text =~ s/(license=.*\n)/$1depends=\"$deps\"\n/gm or
+ die "Can't insert depends line in APKBUILD";
+
$text =~ s/^makedepends=\"([^\"]*)\"$/makedepends=\"perl-dev $makedeps\"/mg or
- die "Can't find makedepends line in APKBUILD";
+ $text =~ s/(depends=.*\n)/$1makedepends=\"$makedeps\"\n/gm or
+ die "Can't insert makedepends line in APKBUILD";
+
$text =~ s/^checkdepends=\"([^\"]*)\"$/checkdepends=\"$checkdeps\"/mg or
- die "Can't find checkdepends line in APKBUILD";
+ $text =~ s/(makedepends=.*\n)/$1checkdepends=\"$checkdeps\"\n/gm or
+ die "Can't insert checkdepends line in APKBUILD";
+
+ # remove empty variables
+ $text =~ s/.*=""\n//g;
open my $fh, '>', "APKBUILD" or die;
print $fh $text;