apkbuild-cpan: port given/when to if/else

the former is deprecated syntax
This commit is contained in:
psykose 2023-07-03 21:49:52 +00:00
parent fc575e8361
commit 0e555d58a7
1 changed files with 66 additions and 71 deletions

View File

@ -574,8 +574,9 @@ $packager = $abuild_conf->{PACKAGER} if $abuild_conf->{PACKAGER};
my $user_abuild_conf = read_assignments_from_file($ENV{"HOME"} . "/.abuild/abuild.conf");
$packager = $user_abuild_conf->{PACKAGER} if $user_abuild_conf->{PACKAGER};
given ( $ARGV[0] ) {
when ("create") {
my $command = $ARGV[0];
if ($command eq "create") {
my $module = $ARGV[1];
$module or die "Module name is a mandatory argument";
@ -596,8 +597,7 @@ given ( $ARGV[0] ) {
prepare_tree;
update_functions;
do_depends $moddata->{version};
}
when ("recreate") {
} elsif ($command eq "recreate" ) {
#TODO: likely should keep pkgrel the same on recreate
my ($apkbuild, $distdata, $moddata) = get_data;
my $pkgver = $moddata->{version} =~ s/^[^0-9]+//r;
@ -610,8 +610,7 @@ given ( $ARGV[0] ) {
prepare_tree;
update_functions;
do_depends($moddata->{version}, $apkbuild);
}
when ("upgrade") {
} elsif ($command eq "upgrade") {
my ($apkbuild, $distdata, $moddata) = get_data;
my $pkgver = $moddata->{version} =~ s/^[^0-9]+//r;
@ -634,21 +633,17 @@ given ( $ARGV[0] ) {
} else {
say "Up-to-data with CPAN";
}
}
when ('check') {
} elsif ($command eq "check") {
my ($apkbuild, $distdata, $moddata) = get_data;
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);
}
}
when ("update") {
} elsif ($command eq "update") {
prepare_tree;
do_depends;
}
default {
} else {
say "Usage: apkbuild-cpan [create <Module::Name> | check | recreate | update | upgrade]";
exit;
}
}