Control: tag -1 + confirmed patch

On Sat, 13 Jan 2024 13:14:48 +0200, Niko Tyni wrote:

> This package fails its autopkgtest checks with Perl 5.38
> (currently in unstable.)
> 
>  autopkgtest [21:33:45]: test command1:  - - - - - - - - - - results - - - - 
> - - - - - -
>  command1             FAIL stderr: given is deprecated at /usr/bin/dh_runit 
> line 50.
>  autopkgtest [21:33:45]: test command1:  - - - - - - - - - - stderr - - - - - 
> - - - - -

Find attached a patch to get rid of given/when.


Cheers,
gregor

-- 
 .''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
   `-   
diff --git a/dh_runit b/dh_runit
index 52a1c62..6bd7dfb 100755
--- a/dh_runit
+++ b/dh_runit
@@ -11,7 +11,6 @@ use Text::Hogan::Compiler;
 use File::Slurp qw(read_file write_file);
 use File::Copy::Recursive qw(dircopy);
 use feature 'signatures';
-no warnings 'experimental';
 
 our $VERSION = "2.16.0";
 
@@ -47,21 +46,21 @@ sub template_from_data_directory {
 sub parse_options($opts) {
     my $conf = { enable => 1, onupgrade => 'restart' };
     for my $opt (split(/,/, $opts)) {
-        given($opt) {
-            when (/^disable$/)     { $conf->{enable} = 0; };
-            when (/^name=(.*)$/)   { $conf->{name} = $1; };
-            when (/^onupgrade=(.*)$/)   { $conf->{onupgrade} = $1; };
-            when (/^since=(.*)$/)  { $conf->{since} = $1; };
-            when (/^logscript$/)   { $conf->{logscript} = 1};
-            when (/^noreplace$/)   { $conf->{noreplace} = 1};
-            when (/^noscripts$/)   { $conf->{noscripts} = 1};
-            when (/^presubj$/)     { $conf->{presubj} = 1; };
-            when (/^usr$/)   { $conf->{usr} = 1};
-            when (/^finish$/)   { $conf->{finish} = 1};
-            when (/^nofinish$/)   { $conf->{nofinish} = 1};
-            when (/^bin=(.*)$/)   { $conf->{bin} = $1; };
-            when (/^defaults$/)    { "do nothing"; };
-            default                { error("unknown option `$opt'"); }
+        for($opt) {
+            if (/^disable$/)           { $conf->{enable} = 0; }
+            elsif (/^name=(.*)$/)      { $conf->{name} = $1; }
+            elsif (/^onupgrade=(.*)$/) { $conf->{onupgrade} = $1; }
+            elsif (/^since=(.*)$/)     { $conf->{since} = $1; }
+            elsif (/^logscript$/)      { $conf->{logscript} = 1}
+            elsif (/^noreplace$/)      { $conf->{noreplace} = 1}
+            elsif (/^noscripts$/)      { $conf->{noscripts} = 1}
+            elsif (/^presubj$/)        { $conf->{presubj} = 1; }
+            elsif (/^usr$/)            { $conf->{usr} = 1}
+            elsif (/^finish$/)         { $conf->{finish} = 1}
+            elsif (/^nofinish$/)       { $conf->{nofinish} = 1}
+            elsif (/^bin=(.*)$/)       { $conf->{bin} = $1; }
+            elsif (/^defaults$/)       { } # do nothing
+            else                       { error("unknown option `$opt'"); }
         }
     }
     return $conf;

Attachment: signature.asc
Description: Digital Signature

Reply via email to