[SCM] Debian package checker branch, master, updated. 2.4.3-161-g2d27e5d
The following commit has been merged in the master branch:
commit f89b1e32059185b0484f57616c7cf4d28f4d386a
Author: Raphael Geissert <atomo64@gmail.com>
Date: Tue Jan 25 23:51:03 2011 -0600
Fix a few warnings
diff --git a/collection/changelog-file b/collection/changelog-file
index a553761..2d66805 100755
--- a/collection/changelog-file
+++ b/collection/changelog-file
@@ -24,13 +24,13 @@ use strict;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Util;
-($#ARGV == 1) or fail("syntax: changelog-file <pkg> <type>");
+($#ARGV == 1) or fail('syntax: changelog-file <pkg> <type>');
my $pkg = shift;
my $type = shift;
--f "fields/package" or fail("changelog-file invoked in wrong directory");
+-f 'fields/package' or fail('changelog-file invoked in wrong directory');
-unlink("changelog") or fail("cannot remove changelog file: $!")
+unlink('changelog') or fail("cannot remove changelog file: $!")
if ( -e 'changelog' or -l 'changelog');
# Pick the first of these files that exists.
@@ -63,7 +63,7 @@ for (@changelogs) {
# intentinally broken symlink so that checks can do the right thing.
if (defined ($chl) && -l $chl) {
my $link = readlink $chl or fail("cannot readlink $chl: $!");
- if ($link =~ /\.\./ || ($link =~ m%/% && $link !~ m%^[^/]+(/+[^/]+)*\z%)) {
+ if ($link =~ /\.\./ || ($link =~ m%/% && $link !~ m%^[^/]+(?:/+[^/]+)*\z%)) {
symlink('file-is-in-another-package', 'changelog')
or fail("cannot create changelog symlink: $!");
undef $chl;
@@ -88,7 +88,7 @@ if (not defined $chl) {
close CHL;
close (COPY) or fail("cannot write changelog: $!");
} else {
- link($chl, "changelog")
+ link($chl, 'changelog')
or fail("cannot link $chl to changelog: $!");
}
@@ -100,13 +100,13 @@ my $news = "unpacked/usr/share/doc/$pkg/NEWS.Debian.gz";
if (-f $news) {
if (-l $news) {
my $link = readlink $news or fail("cannot readlink $chl: $!");
- if ($link =~ /\.\./ || ($link =~ m%/% && $link !~ m%^[^/]+(/+[^/]+)*\z%)) {
+ if ($link =~ /\.\./ || ($link =~ m%/% && $link !~ m%^[^/]+(?:/+[^/]+)*\z%)) {
undef $news;
} elsif (! -f $news) {
undef $news;
}
}
if ($news) {
- gunzip_file($news, "NEWS.Debian");
+ gunzip_file($news, 'NEWS.Debian');
}
}
diff --git a/collection/copyright-file b/collection/copyright-file
index 04425dd..a968393 100755
--- a/collection/copyright-file
+++ b/collection/copyright-file
@@ -26,13 +26,13 @@ use Util;
use File::Copy qw(copy);
-($#ARGV == 1) or fail("syntax: copyright-file <pkg> <type>");
+($#ARGV == 1) or fail('syntax: copyright-file <pkg> <type>');
my $pkg = shift;
my $type = shift;
--f "fields/package" or fail("copyright-file invoked in wrong directory");
+-f 'fields/package' or fail('copyright-file invoked in wrong directory');
-unlink("copyright");
+unlink('copyright');
my $file1 = "unpacked/usr/share/doc/$pkg/copyright";
my $file2 = "unpacked/usr/doc/$pkg/copyright";
@@ -46,13 +46,13 @@ else { $file = $file2; }
# unpack. Be careful about what symlinks we allow, though.
if (-l $file) {
my $link = readlink($file) or fail("cannot readlink $file: $!");
- if ($link =~ /\.\./ || ($link =~ m%/% && $link !~ m%^[^/]+(/+[^/]+)*\z%)) {
- touch_file("copyright");
+ if ($link =~ /\.\./ || ($link =~ m%/% && $link !~ m%^[^/]+(?:/+[^/]+)*\z%)) {
+ touch_file('copyright');
} else {
- copy($file, "copyright") or fail("cannot copy $file: $!");
+ copy($file, 'copyright') or fail("cannot copy $file: $!");
}
} elsif (-f $file) {
- link($file, "copyright")
+ link($file, 'copyright')
or fail("cannot link $file to copyright: $!");
} elsif (-f "$file.gz") {
gunzip_file($file, 'copyright');
diff --git a/collection/file-info b/collection/file-info
index 593f2e0..903b2ad 100755
--- a/collection/file-info
+++ b/collection/file-info
@@ -20,20 +20,21 @@
# MA 02110-1301, USA.
use strict;
+use warnings;
use FileHandle;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Util;
use Lintian::Command qw(spawn reap);
-($#ARGV == 1) or fail("syntax: file-info <pkg> <type>");
+($#ARGV == 1) or fail('syntax: file-info <pkg> <type>');
my $pkg = shift;
my $type = shift;
--f "fields/source" or fail("file-info invoked in wrong directory");
+-f 'fields/source' or fail('file-info invoked in wrong directory');
-unlink("file-info");
-chdir("unpacked")
+unlink('file-info');
+chdir('unpacked')
or fail("cannot chdir to unpacked directory: $!");
# We ignore failures from file because sometimes file returns a non-zero exit
@@ -49,7 +50,7 @@ open(INDEX, '<', "../index")
or fail("cannot open index file: $!");
while (<INDEX>) {
chomp;
- $_ = (split(" ", $_, 6))[5];
+ $_ = (split(' ', $_, 6))[5];
s/ link to .*//;
s/ -> .*//;
s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
diff --git a/collection/md5sums b/collection/md5sums
index 4a3af6f..d892357 100755
--- a/collection/md5sums
+++ b/collection/md5sums
@@ -26,14 +26,14 @@ use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Lintian::Command qw(spawn reap);
use Util;
-($#ARGV == 1) or fail("syntax: md5sums <pkg> <type>");
+($#ARGV == 1) or fail('syntax: md5sums <pkg> <type>');
my $pkg = shift;
my $type = shift;
--f "fields/package" or fail("md5sums invoked in wrong directory");
+-f 'fields/package' or fail('md5sums invoked in wrong directory');
-unlink("md5sums");
-chdir("unpacked")
+unlink('md5sums');
+chdir('unpacked')
or fail("cannot chdir to unpacked directory: $!");
my %opts = ( pipe_in => FileHandle->new,
@@ -41,12 +41,12 @@ my %opts = ( pipe_in => FileHandle->new,
fail => 'error' );
spawn(\%opts, ['xargs', '-0r', 'md5sum'] );
$opts{pipe_in}->blocking(1);
-open(INDEX, '<', "../index")
+open(INDEX, '<', '../index')
or fail("cannot open index file: $!");
while (<INDEX>) {
next unless m/^-/;
chop;
- $_ = (split(" ", $_, 6))[5];
+ $_ = (split(' ', $_, 6))[5];
s/ link to .*//;
s/\\(\d+)/chr(oct($1))/eg;
s/\\\\/\\/g;
diff --git a/frontend/lintian-info b/frontend/lintian-info
index 8c69b00..df4ad6c 100755
--- a/frontend/lintian-info
+++ b/frontend/lintian-info
@@ -21,6 +21,7 @@
# MA 02110-1301, USA.
use strict;
+use warnings;
use Getopt::Long;
diff --git a/lib/Checker.pm b/lib/Checker.pm
index 7aa7e23..cb9cc62 100644
--- a/lib/Checker.pm
+++ b/lib/Checker.pm
@@ -21,6 +21,7 @@
package Checker;
use strict;
no strict 'refs';
+use warnings;
# Quiet "Name "main::LINTIAN_ROOT" used only once"
# The variable comes from 'lintian'
diff --git a/lib/Lab.pm b/lib/Lab.pm
index 9227f50..f2654d4 100644
--- a/lib/Lab.pm
+++ b/lib/Lab.pm
@@ -20,6 +20,7 @@
package Lab;
use strict;
+use warnings;
use Util;
use Lintian::Output qw(:messages);
@@ -60,7 +61,7 @@ sub setup {
$self->{mode} = 'static';
$self->{dir} = $dir;
$self->{dist} = $dist;
-
+
if (-d "$dir" && ! -d "$dir/changes") {
mkdir("$dir/changes", 0777)
or fail("cannot create lab directory $dir/changes");
@@ -89,7 +90,7 @@ sub setup_static {
my ( $self ) = @_;
unless ( $self->{mode} eq 'static' and $self->{dir} ) {
- warning("no laboratory specified (need to define LINTIAN_LAB)");
+ warning('no laboratory specified (need to define LINTIAN_LAB)');
return 0;
}
@@ -148,13 +149,13 @@ sub populate_with_dist {
my %opts = ( out => $Lintian::Output::GLOBAL->stdout );
spawn(\%opts, ["$LINTIAN_ROOT/unpack/list-binpkg",
"$self->{dir}/info/binary-packages", $v])
- or fail("cannot create binary package list");
+ or fail('cannot create binary package list');
spawn(\%opts, ["$LINTIAN_ROOT/unpack/list-srcpkg",
"$self->{dir}/info/source-packages", $v])
- or fail("cannot create source package list");
+ or fail('cannot create source package list');
spawn(\%opts, ["$LINTIAN_ROOT/unpack/list-udebpkg",
"$self->{dir}/info/udeb-packages", $v])
- or fail("cannot create udeb package list");
+ or fail('cannot create udeb package list');
return 1;
}
@@ -163,7 +164,7 @@ sub delete_static {
my ( $self ) = @_;
unless ( $self->{mode} eq 'static' and $self->{dir} ) {
- warning("no laboratory specified (need to define LINTIAN_LAB)");
+ warning('no laboratory specified (need to define LINTIAN_LAB)');
return 0;
}
@@ -233,7 +234,7 @@ sub delete_force {
}
}
- $self->{dir} = "";
+ $self->{dir} = '';
return 1;
}
diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
index a0e3219..2b948c6 100644
--- a/lib/Lintian/Check.pm
+++ b/lib/Lintian/Check.pm
@@ -219,7 +219,7 @@ sub check_spelling {
next if ($word =~ /^[A-Z]{1,5}\z/);
my $lcword = lc $word;
if ($corrections->known($lcword) &&
- not exists ($exceptions->{$lcword})) {
+ !exists ($exceptions->{$lcword})) {
$counter++;
my $correction = $corrections->value($lcword);
if ($word =~ /^[A-Z]+$/) {
@@ -275,7 +275,7 @@ sub check_spelling_picky {
# removed below.
if ($text =~ m,meta\s+package,) {
$counter++;
- _tag($tag, $filename, "meta package", "metapackage")
+ _tag($tag, $filename, 'meta package', 'metapackage')
if defined $tag;
}
diff --git a/lib/Lintian/Collect.pm b/lib/Lintian/Collect.pm
index e916086..3d828a7 100644
--- a/lib/Lintian/Collect.pm
+++ b/lib/Lintian/Collect.pm
@@ -18,6 +18,7 @@
package Lintian::Collect;
use strict;
+use warnings;
# Take the package name and type, initialize an appropriate collect object
# based on the package type, and return it. Returns undef for an unknown
diff --git a/lib/Lintian/DepMap.pm b/lib/Lintian/DepMap.pm
index dc69ea8..7cf3529 100644
--- a/lib/Lintian/DepMap.pm
+++ b/lib/Lintian/DepMap.pm
@@ -19,9 +19,6 @@ use strict;
use warnings;
use Util ();
-my ($nodes, $selected, $known, $unknown, $map);
-my ($satisfied_nodes);
-
=head1 NAME
Lintian::DepMap - Dependencies map/tree creator
@@ -213,11 +210,11 @@ sub satisfy {
if (grep {$_ eq $node} $self->missing()) {
Util::fail("Attempted to mark node '$node' as satisfied but it is not ".
- "reachable, perhaps you forgot to add() it first?");
+ 'reachable, perhaps you forgot to add() it first?');
}
if (not exists($self->{'nodes'}{$node})) {
Util::fail("Attempted to mark node '$node' as satisfied but it is not ".
- "reachable, perhaps you forgot to satisfy() its dependencies first?");
+ 'reachable, perhaps you forgot to satisfy() its dependencies first?');
}
return 0 unless (exists($self->{'map'}{$node}));
@@ -298,7 +295,7 @@ sub unlink {
if (not exists($self->{'nodes'}{$node})) {
Util::fail("Attempted to unlink node '$node' but it can not be found".
- ", perhaps it has already been satisfied?");
+ ', perhaps it has already been satisfied?');
}
delete $self->{'map'}{$node}
@@ -313,7 +310,7 @@ sub unlink {
if exists $self->{'nodes'}{$parent}{'branches'}{$node};
delete $self->{'nodes'}{$node}{'parents'}{$parent};
}
-
+
for my $branch (keys %{$self->{'nodes'}{$node}->{'branches'}}) {
delete $self->{'nodes'}{$branch}{'parents'}{$node};
delete $self->{'nodes'}{$node}{'branches'}{$branch};
@@ -350,7 +347,7 @@ sub select {
if (not exists($self->{'map'}{$node})) {
Util::fail("Attempted to mark node '$node' as selected but it is not ".
- "known, perhaps its parents are not yet satisfied?");
+ 'known, perhaps its parents are not yet satisfied?');
}
return 0 if (exists($self->{'selected'}{$node}));
@@ -442,7 +439,7 @@ sub parents {
if (not exists($self->{'nodes'}{$node})) {
Util::fail("Attempted to get the parents of node '$node' but it is not".
- "known, perhaps you forgot to add() it first?");
+ 'known, perhaps you forgot to add() it first?');
}
return keys %{$self->{'nodes'}{$node}{'parents'}};
diff --git a/lib/Read_pkglists.pm b/lib/Read_pkglists.pm
index 74a950e..b4e1f69 100644
--- a/lib/Read_pkglists.pm
+++ b/lib/Read_pkglists.pm
@@ -20,6 +20,7 @@
# MA 02110-1301, USA.
use strict;
+use warnings;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Util;
diff --git a/lib/Text_utils.pm b/lib/Text_utils.pm
index 96e745a..1121edf 100644
--- a/lib/Text_utils.pm
+++ b/lib/Text_utils.pm
@@ -21,12 +21,13 @@
package Text_utils;
+use strict;
+use warnings;
+
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(split_paragraphs wrap_paragraphs dtml_to_html dtml_to_text);
-use strict;
-
# requires wrap() function
use Text::Wrap;
# requires fail() function
@@ -41,7 +42,7 @@ sub html_wrap {
# subtract 1 to compensate for the lack of a space before the first word.
my $ll = length($lead) - 1;
my $cnt = 0;
- my $r = "";
+ my $r = '';
while ($cnt <= $#words) {
if ($ll + 1 + length($words[$cnt]) > 76) {
@@ -74,7 +75,7 @@ sub html_wrap {
# Paragraphs are separated by empty lines. Each empty line is a
# paragraph. Furthermore, indented lines are considered a paragraph.
sub split_paragraphs {
- return "" unless (@_);
+ return '' unless (@_);
my $t = join("\n",@_);
@@ -100,7 +101,7 @@ sub split_paragraphs {
}
# what else can happen?
else {
- fail("internal error in wrap");
+ fail('internal error in wrap');
}
}
#FLUSH;
@@ -133,7 +134,7 @@ sub dtml_to_html {
# preformatted line?
elsif (/^\s/o) {
if (not $pre) {
- push(@o,"<pre>");
+ push(@o,'<pre>');
$pre=1;
}
push(@o,"$_");
@@ -141,14 +142,14 @@ sub dtml_to_html {
# normal line
else {
if ($pre) {
- push(@o,"</pre>");
+ push(@o,'</pre>');
$pre=0;
}
push(@o,"<p>$_\n");
}
}
if ($pre) {
- push(@o,"</pre>");
+ push(@o,'</pre>');
$pre=0;
}
@@ -198,7 +199,7 @@ sub wrap_paragraphs {
my $o;
for my $t (split_paragraphs(@_)) {
# empty or indented line?
- if ($t =~ /^$/ or $t =~ /^\s/) {
+ if ($t eq '' or $t =~ /^\s/) {
$o .= "$lead$t\n";
} else {
if ($html) {
diff --git a/lib/Util.pm b/lib/Util.pm
index 136a04d..1a019fa 100644
--- a/lib/Util.pm
+++ b/lib/Util.pm
@@ -21,6 +21,7 @@
package Util;
use strict;
+use warnings;
use Exporter;
@@ -78,7 +79,7 @@ sub parse_dpkg_control {
next if /^\#/;
# empty line?
- if ((!$debconf_flag && m/^\s*$/) or ($debconf_flag && m/^$/)) {
+ if ((!$debconf_flag && m/^\s*$/) or ($debconf_flag && $_ eq '')) {
if ($open_section) { # end of current section
$cur_section++;
$open_section = 0;
@@ -138,7 +139,7 @@ sub read_dpkg_control {
my ($file, $debconf_flag) = @_;
if (not _ensure_file_is_sane($file)) {
- return undef;
+ return;
}
open(my $CONTROL, '<', $file)
@@ -153,7 +154,7 @@ sub get_deb_info {
my ($file) = @_;
if (not _ensure_file_is_sane($file)) {
- return undef;
+ return;
}
# dpkg-deb -f $file is very slow. Instead, we use ar and tar.
--
Debian package checker
Reply to: