[debhelper-devel] [debhelper] 04/08: dh_*: Prefer 3-arg open
Niels Thykier
nthykier at moszumanska.debian.org
Sun May 1 08:06:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit e2420e4c81dd303be862a7de4048ed495bd6b316
Author: Niels Thykier <niels at thykier.net>
Date: Sun May 1 07:28:28 2016 +0000
dh_*: Prefer 3-arg open
Signed-off-by: Niels Thykier <niels at thykier.net>
---
dh_installdocs | 6 +++---
dh_installman | 4 ++--
dh_installmanpages | 6 +++---
dh_md5sums | 7 ++++---
dh_perl | 9 ++++-----
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/dh_installdocs b/dh_installdocs
index da7b517..8101654 100755
--- a/dh_installdocs
+++ b/dh_installdocs
@@ -304,8 +304,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
next if $fn=~/\.EX$/;
next if excludefile($fn);
# Parse the file to get the doc id.
- open (IN, "debian/$fn") || die "Cannot read debian/$fn.";
- while (<IN>) {
+ open(my $fd, '<', "debian/$fn") || die "Cannot read debian/$fn.";
+ while (<$fd>) {
s/\s*$//;
if (/^Document\s*:\s*(.*)/) {
$doc_ids{$fn}=$1;
@@ -315,7 +315,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! exists $doc_ids{$fn}) {
warning("Could not parse $fn for doc-base Document id; skipping");
}
- close IN;
+ close($fd);
}
closedir(DEB);
diff --git a/dh_installman b/dh_installman
index 46b0366..93f9356 100755
--- a/dh_installman
+++ b/dh_installman
@@ -128,7 +128,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
open (IN, "zcat $page|") or die "$page: $!";
}
else {
- open (IN, $page) or die "$page: $!";
+ open(IN, '<', $page) or die "$page: $!";
}
while (<IN>) {
if (/^\.TH\s+\S+\s+"?(\d+[^"\s]*)"?/ ||
@@ -232,7 +232,7 @@ sub find_so_man {
open (SOTEST, "zcat $_|") or die "$_: $!";
}
else {
- open (SOTEST,$_) || die "$_: $!";
+ open(SOTEST, '<', $_) || die "$_: $!";
}
my $l=<SOTEST>;
close SOTEST;
diff --git a/dh_installmanpages b/dh_installmanpages
index d393500..7f83089 100755
--- a/dh_installmanpages
+++ b/dh_installmanpages
@@ -110,9 +110,9 @@ sub find_so_man {
}
# Test first line of file for the .so thing.
- open (SOTEST,$_);
- my $l=<SOTEST>;
- close SOTEST;
+ open(my $fd, '<', $_);
+ my $l = <$fd>;
+ close($fd);
if ($l=~m/\.so\s+(.*)/) {
my $solink=$1;
# This test is here to prevent links like ... man8/../man8/foo.8
diff --git a/dh_md5sums b/dh_md5sums
index b0cf0b6..c720b11 100755
--- a/dh_md5sums
+++ b/dh_md5sums
@@ -63,13 +63,14 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
my $exclude="";
if (! $dh{INCLUDE_CONFFILES} && -r "$tmp/DEBIAN/conffiles") {
# Generate exclude regexp.
- open (CONFF,"$tmp/DEBIAN/conffiles");
- while (<CONFF>) {
+ open(my $fd, '<', "$tmp/DEBIAN/conffiles")
+ or die("open $tmp/DEBIAN/conffiles failed: $!");
+ while (<$fd>) {
chomp;
s/^\///;
$exclude.="! -path \"./$_\" ";
}
- close CONFF;
+ close($fd);
}
# See if we should exclude other files.
diff --git a/dh_perl b/dh_perl
index 44facf4..c6088d4 100755
--- a/dh_perl
+++ b/dh_perl
@@ -110,13 +110,12 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
find sub {
return unless -f and (-x or /\.pl$/);
return if $File::Find::dir=~/\/usr\/share\/doc\//;
-
- local *F;
- return unless open F, $_;
- if (read F, local $_, 32 and m%^#!\s*(/usr/bin/perl|/usr/bin/env\s+perl)\s%) {
+
+ return unless open(my $fd, '<', $_);
+ if (read($fd, local $_, 32) and m%^#!\s*(/usr/bin/perl|/usr/bin/env\s+perl)\s%) {
$deps |= PROGRAM;
}
- close F;
+ close($fd);
}, $tmp;
if ($deps) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list