[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.14-32-gcc2e361



The following commit has been merged in the master branch:
commit cc2e36178d465123bc0b890d0dc29ff2001e309e
Author: Niels Thykier <niels@thykier.net>
Date:   Mon Jul 1 18:08:35 2013 +0200

    private: Convert some scripts to autodie
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/private/generate-lintian-pod b/private/generate-lintian-pod
index 6fefb4b..bd59a6c 100755
--- a/private/generate-lintian-pod
+++ b/private/generate-lintian-pod
@@ -2,6 +2,7 @@
 
 use strict;
 use warnings;
+use autodie;
 
 # Find the lib directory of lintian-root (defaulting to ./lib/)
 BEGIN {
@@ -17,7 +18,7 @@ foreach my $kw (qw(conffiles shlibs Standards-Version)){
     push @keywords, [qr/$kw/, "B<$kw>"];
 }
 
-open my $file, '<', 'man/lintian.pod.in' or fail "man/lintian.pod.in: $!";
+open(my $file, '<', 'man/lintian.pod.in');
 
 while(my $line = <$file>){
     chomp($line);
@@ -29,7 +30,7 @@ while(my $line = <$file>){
         print "$line\n";
     }
 }
-close $file;
+close($file);
 
 sub pretty_print {
     my $text = shift;
diff --git a/private/refresh-archs b/private/refresh-archs
index 9614843..ed6292a 100755
--- a/private/refresh-archs
+++ b/private/refresh-archs
@@ -20,6 +20,7 @@
 
 use strict;
 use warnings;
+use autodie;
 
 use File::Temp qw(tempfile);
 use POSIX qw (strftime);
@@ -123,25 +124,24 @@ $ENV{'LC_ALL'} = 'C';
 my $dver = `dpkg-architecture --version | head -n1`;
 chomp $dver;
 
-open my $dlfd, '-|', 'dpkg-architecture', '-L' or die "dpkg-architecture -L: $!";
+open(my $dlfd, '-|', 'dpkg-architecture', '-L');
 while ( my $archstr = <$dlfd> ) {
     my @hardening;
     my @htags;
     delete $ENV{'DEB_HOST_ARCH'};
     chomp $archstr;
-    open my $dafd, '-|', 'dpkg-architecture', "-a$archstr" or die "dpkg-architecture -a$archstr: $!";
+    open(my $dafd, '-|', 'dpkg-architecture', "-a$archstr");
     while ( my $var = <$dafd> ) {
         chomp $var;
         my ($key, $value) = split /=/, $var, 2;
         $archs{$archstr}{$key} = $value;
     }
-    close $dafd;
+    close($dafd);
 
     $ENV{'DEB_HOST_ARCH'} = $archstr;
-    open my $dbfd, '-|', 'dpkg-buildflags', '--query-features', 'hardening' or die "dpkg-buildflags --query-features hardening: $!";
+    open(my $dbfd, '-|', 'dpkg-buildflags', '--query-features', 'hardening');
     @hardening = parse_dpkg_control ($dbfd);
-    close $dbfd;
-
+    close($dbfd);
     foreach my $paragraph (@hardening) {
         if (($paragraph->{'enabled'}//'no') eq 'yes') {
             my $tag = 'hardening-no-' . $paragraph->{'feature'};
@@ -152,7 +152,7 @@ while ( my $archstr = <$dlfd> ) {
     }
     $archs{$archstr}{'HARDENING'} = join (', ', sort @htags);
 }
-close $dlfd;
+close($dlfd);
 
 
 open_data_files($dver);
@@ -193,7 +193,7 @@ sub open_data_files {
         print $fd "# With: $version\n";
         print $fd "# This file was auto-generated by $0\n";
         if ($files{$filename}->{'keep'}) {
-            open my $orig, '<', "$datapath/$filename" or die "Opening $datapath/$filename: $!";
+            open(my $orig, '<', "$datapath/$filename");
             print $fd "#\n# Lines to always be include\n";
             while ( my $line = <$orig> ) {
                 next unless $line =~ m/^#\s*Keep:\s*(.*\S)\s*$/io;
@@ -201,7 +201,7 @@ sub open_data_files {
                 print $fd "# Keep: $v\n";
                 push @{ $files{$filename}->{'lines'} } , $v;
             }
-            close $orig;
+            close($orig);
         }
         print $fd "\n";
     }
@@ -225,7 +225,7 @@ sub close_and_rename {
         foreach my $line (sort @{ $files{$filename}->{'lines'} }) {
             print $fd "$line\n";
         }
-        close $files{$filename}->{'fd'} or die "Closing $tf ($filename): $!";
+        close($files{$filename}->{'fd'});
     }
     foreach my $filename (keys %files) {
         my $tf = $files{$filename}->{'temp-file'};
diff --git a/private/refresh-hwcap b/private/refresh-hwcap
index 042efa8..f03be39 100755
--- a/private/refresh-hwcap
+++ b/private/refresh-hwcap
@@ -2,6 +2,7 @@
 
 use strict;
 use warnings;
+use autodie;
 
 use POSIX qw(strftime);
 
@@ -12,7 +13,7 @@ my @keeps = ();
 
 die "Usage: $0 path/to/lintian/data.\n" unless $datadir;
 
-open my $manpage, '-|', 'zcat', $man or die "zcat $man: $!";
+open(my $manpage, '-|', 'zcat', $man);
 while (<$manpage>) {
     next unless /^\.SH HARDWARE CAPABILITIES/;
     last;
@@ -27,11 +28,11 @@ while (<$manpage>) {
     chomp;
     $caps{$_} = 1 foreach split /,\s*/;
 }
-close $manpage or die "zcat: $!";
+close($manpage);
 
 my $path = "$datadir/shared-libs/hwcap-dirs";
 my $date = strftime '%Y-%m-%d', gmtime;
-open my $orig, '<', $path or die "Opening $path: $!";
+open(my $orig, '<', $path);
 while ( my $line = <$orig> ) {
     chomp $line;
     next unless $line =~ m/^#\s*Keep:\s*(.*\S)\s*$/o;
@@ -41,9 +42,9 @@ while ( my $line = <$orig> ) {
         $caps{$val} = 1;
     }
 }
-close $orig;
+close($orig);
 
-open my $fp, '>', $path or die "Opening $path: $!";
+open(my $fp, '>', $path);
 print $fp <<EOF ;
 # List of all known hwcap.
 #
@@ -61,7 +62,7 @@ print $fp "\n";
 foreach (sort keys %caps) {
     print $fp "$_\n";
 }
-close $fp or die "Closing $path: $!";
+close($fp);
 
 # Local Variables:
 # indent-tabs-mode: nil
diff --git a/private/refresh-locale-codes b/private/refresh-locale-codes
index cd8682f..176173f 100755
--- a/private/refresh-locale-codes
+++ b/private/refresh-locale-codes
@@ -20,6 +20,7 @@
 
 use strict;
 use warnings;
+use autodie;
 
 use POSIX qw(strftime);
 
@@ -51,7 +52,7 @@ parse_iso_xml();
 
 $outfile = "$DATADIR/files/locale-codes.new";
 
-open my $out, '>', $outfile or die "open $outfile: $!";
+open(my $out, '>', $outfile);
 
 print {$out} <<EOF ;
 # List of locale codes.  This is derived from the ISO 639-1, ISO
@@ -70,7 +71,7 @@ foreach my $code (sort keys %CODES) {
     print {$out} "\n";
 }
 
-close $out or die "close $outfile: $!";
+close($out);
 
 rename $outfile, "$DATADIR/files/locale-codes"
     or die "rename $outfile -> $DATADIR/files/locale-codes: $!";
@@ -78,8 +79,7 @@ rename $outfile, "$DATADIR/files/locale-codes"
 exit 0;
 
 sub parse_iso_xml {
-    open my $fd, '<', '/usr/share/xml/iso-codes/iso_639_3.xml'
-        or die "open iso_639_3.xml: $!";
+    open(my $fd, '<', '/usr/share/xml/iso-codes/iso_639_3.xml');
     local $_;
     local $/ = '/>';
     while (<$fd>) {
@@ -102,13 +102,12 @@ sub parse_iso_xml {
         }
     }
 
-    close $fd;
+    close($fd);
     return;
 }
 
 sub parse_iso_query {
-    open my $fd, '-|', 'isoquery', '-i', '639'
-        or die "fork/exec isoquery: $!";
+    open(my $fd, '-|', 'isoquery', '-i', '639');
     local $_;
     while (<$fd>) {
         next unless m/^\w{3}\s+(\w{3})\s+(?:(\w{2})\s+)?/;
@@ -124,7 +123,7 @@ sub parse_iso_query {
             $CODES{lc $iso2} = $iso1;
         }
     }
-    close $fd;
+    close($fd);
     return;
 }
 

-- 
Debian package checker


Reply to: