[SCM] Debian package checker branch, master, updated. 2.5.11-201-ge323d72
The following commit has been merged in the master branch:
commit 5d23dd16c91dc12a8aba1dd165a71419283eb1ad
Author: Niels Thykier <niels@thykier.net>
Date: Sat Mar 30 13:23:21 2013 +0100
Fix "useless interpolation" warnings in the code base
... and (where spotted) fixed a couple of error messages.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/apache2 b/checks/apache2
index bb48c54..ae148f9 100644
--- a/checks/apache2
+++ b/checks/apache2
@@ -72,14 +72,14 @@ sub run {
# Package appears to be a legacy web application
elsif ($file =~ m#^etc/apache2/conf\.d/(.*)$#) {
- tag "apache2-reverse-dependency-uses-obsolete-directory", $file;
+ tag 'apache2-reverse-dependency-uses-obsolete-directory', $file;
check_web_application_package ($pkg, $type, $info, $file, 'conf', $1);
$seen_apache2_special_file++;
}
# Package does scary things
elsif ($file =~ m#^etc/apache2/(?:conf|sites|mods)-enabled/.*$#) {
- tag "apache2-reverse-dependency-ships-file-in-not-allowed-directory", $file;
+ tag 'apache2-reverse-dependency-ships-file-in-not-allowed-directory', $file;
$seen_apache2_special_file++;
}
@@ -94,7 +94,7 @@ sub run {
sub check_web_application_package {
my ($pkg, $type, $info, $file, $pkgtype, $webapp) = @_;
- tag "non-standard-apache2-configuration-name", $webapp, '!=', "$pkg.conf"
+ tag 'non-standard-apache2-configuration-name', $webapp, '!=', "$pkg.conf"
if $webapp ne "$pkg.conf" or $webapp =~ m/^local-./;
my $rel = Lintian::Relation->and ($info->relation ('strong'),
@@ -161,13 +161,13 @@ sub check_module_package {
$conf_file =~ s#^mod.(.*)$#etc/apache2/mods-available/$1.conf#;
if (defined $info->index ($load_file)) {
- inspect_conf_file ($info, "mods", $load_file);
+ inspect_conf_file ($info, 'mods', $load_file);
} else {
tag 'apache2-module-does-not-ship-load-file', $load_file;
}
if (defined $info->index ($conf_file)) {
- inspect_conf_file ($info, "mods", $conf_file);
+ inspect_conf_file ($info, 'mods', $conf_file);
}
}
@@ -236,9 +236,10 @@ sub inspect_conf_file {
}
if (m/^#\s*(Depends|Conflicts):\s+(.*?)\s*$/) {
- tag 'apache2-unsupported-dependency', $file, $1
- if $1 eq 'Conflicts' and $conftype ne 'mods';
- my @dependencies = split( /[\n\s]+/, $2 );
+ my ($field, $value) = ($1, $2);
+ tag 'apache2-unsupported-dependency', $file, $field
+ if $field eq 'Conflicts' and $conftype ne 'mods';
+ my @dependencies = split( /[\n\s]+/, $value );
foreach my $dep (@dependencies) {
tag 'apache2-unparseable-dependency', $file, $dep
if $dep =~ m/\W/ or
diff --git a/checks/cruft b/checks/cruft
index ae9587d..9f02bb5 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -26,7 +26,7 @@ package Lintian::cruft;
use strict;
use warnings;
use v5.10;
-use feature "switch";
+use feature qw(switch);
# Half of the size used in the "sliding window" for detecting bad
# licenses like GFDL with invariant sections.
diff --git a/checks/group-checks b/checks/group-checks
index 22abd4a..1713a1e 100644
--- a/checks/group-checks
+++ b/checks/group-checks
@@ -155,7 +155,7 @@ sub _check_multiarch {
if ($dma eq 'same' or $dma eq 'foreign') {
1; # OK
} else {
- tag 'dependency-is-not-multi-archified', $proc->pkg_name . " depends on " . $dep->pkg_name . " (multi-arch: $dma)";
+ tag 'dependency-is-not-multi-archified', $proc->pkg_name . ' depends on ' . $dep->pkg_name . " (multi-arch: $dma)";
}
}
} elsif ($ma ne 'same' and $proc->info->field ('section', 'none') =~ m,(?:^|/)debug$,o) {
diff --git a/checks/menus b/checks/menus
index 0006d50..c086519 100644
--- a/checks/menus
+++ b/checks/menus
@@ -93,7 +93,7 @@ for my $file ($info->sorted_index) {
# menu file?
if ($file =~ m,^usr/(lib|share)/menu/\S,o) { # correct permissions?
if ($operm & 0111) {
- tag 'executable-menu-file', sprintf("%s %04o",$file,$operm);
+ tag 'executable-menu-file', sprintf('%s %04o', $file, $operm);
}
next if $file =~ m,^usr/(lib|share)/menu/README$,;
@@ -111,7 +111,7 @@ for my $file ($info->sorted_index) {
# doc-base file?
elsif ($file =~ m,^usr/share/doc-base/\S,o) { # correct permissions?
if ($operm & 0111) {
- tag 'executable-in-usr-share-docbase', $file, sprintf("%04o",$operm);
+ tag 'executable-in-usr-share-docbase', $file, sprintf('%04o', $operm);
}
$docbase_file = $file;
}
@@ -184,7 +184,7 @@ if ($prerm{'calls-installdocs'} or $prerm{'calls-installdocs-r'}) {
# docbase file?
if ($docbase_file) {
opendir DOCBASEDIR, $info->lab_data_path ('doc-base')
- or fail "cannot read doc-base directory";
+ or fail 'cannot read doc-base directory';
my $dbfile;
while (defined ($dbfile = readdir DOCBASEDIR)) {
my $dbpath = $info->lab_data_path ("doc-base/$dbfile");
@@ -443,13 +443,13 @@ sub check_doc_base_field {
if (/manage\s+online\s+manuals\s.*Debian/o) {
tag 'doc-base-abstract-field-is-template', "$dbfile:$line"
unless $pkg eq 'doc-base';
- } elsif (/^(\s+)\.(\s*)$/o and ($1 ne " " or $2)) {
+ } elsif (/^(\s+)\.(\s*)$/o and ($1 ne ' ' or $2)) {
tag 'doc-base-abstract-field-separator-extra-whitespaces',
"$dbfile:" . ($line - $#{$vals} + $idx);
} elsif (!$leadsp && /^(\s+)(\S)/o) {
# The regexp should always match.
($leadsp, $charafter) = ($1, $2);
- $leadsp_ok = $leadsp eq " ";
+ $leadsp_ok = $leadsp eq ' ';
} elsif (!$leadsp_ok && /^(\s+)(\S)/o) {
# The regexp should always match.
undef $charafter if $charafter && $charafter ne $2;
@@ -502,7 +502,7 @@ sub add_file_link_info {
my $link = $info->index ($file)->link;
my $ishard = $info->index ($file)->is_hardlink;
- $file = "/" . $file if (not $file =~ m%^/%); # make file absolute
+ $file = '/' . $file if (not $file =~ m%^/%); # make file absolute
$file =~ s%/+%/%g; # remove duplicated `/'
$all_files->{$file} = 1;
@@ -511,7 +511,7 @@ sub add_file_link_info {
if ($ishard) {
$link =~ s,^\./,/,;
} elsif (not $link =~ m,^/,) { # not absolute link
- $link = "/" . $link; # make sure link starts with '/'
+ $link = '/' . $link; # make sure link starts with '/'
$link =~ s,/+\./+,/,g; # remove all /./ parts
my $dcount = 1;
while ($link =~ s,^/+\.\./+,/,) { #\ count & remove
diff --git a/checks/patch-systems b/checks/patch-systems
index 01f462a..a703406 100644
--- a/checks/patch-systems
+++ b/checks/patch-systems
@@ -37,7 +37,7 @@ sub run {
#meant to use:
my $build_deps = $info->relation('build-depends-all');
# Get source package format
- my $format = "";
+ my $format = '';
if (defined $info->field('format')) {
$format = $info->field('format');
}
@@ -47,7 +47,7 @@ sub run {
my $dpdir = "$droot/patches";
#----- dpatch
- if ($build_deps->implies("dpatch")) {
+ if ($build_deps->implies('dpatch')) {
$uses_patch_system++;
#check for a debian/patches file:
if (! -r "$dpdir/00list") {
@@ -104,7 +104,7 @@ sub run {
}
close(PATCH_FILE);
unless ($has_comment) {
- tag "dpatch-missing-description", $patch_file;
+ tag 'dpatch-missing-description', $patch_file;
}
}
check_patch($dpdir, $patch_file);
@@ -114,7 +114,7 @@ sub run {
}
#----- quilt
- if ($build_deps->implies("quilt") or $quilt_format) {
+ if ($build_deps->implies('quilt') or $quilt_format) {
$uses_patch_system++;
#check for a debian/patches file:
if (! -r "$dpdir/series") {
@@ -137,7 +137,7 @@ sub run {
}
close(IN);
if (scalar(@badopts)) {
- tag "quilt-patch-with-non-standard-options", @badopts;
+ tag 'quilt-patch-with-non-standard-options', @badopts;
}
# Check each patch.
@@ -161,7 +161,7 @@ sub run {
}
close(PATCH_FILE);
unless ($has_description) {
- tag "quilt-patch-missing-description", $patch_file;
+ tag 'quilt-patch-missing-description', $patch_file;
}
}
check_patch($dpdir, $patch_file);
@@ -186,12 +186,12 @@ sub run {
#----- look for README.source
if ($uses_patch_system && ! $quilt_format && ! -f "$droot/README.source") {
- tag "patch-system-but-no-source-readme";
+ tag 'patch-system-but-no-source-readme';
}
#----- general cruft checking:
if ($uses_patch_system > 1) {
- tag "more-than-one-patch-system";
+ tag 'more-than-one-patch-system';
}
my @direct;
open(STAT, '<', $info->diffstat) or fail("cannot open diffstat file: $!");
@@ -204,9 +204,9 @@ sub run {
if (@direct) {
my $files = (@direct > 1) ? "$direct[0] and $#direct more" : $direct[0];
- tag "patch-system-but-direct-changes-in-diff", $files
+ tag 'patch-system-but-direct-changes-in-diff', $files
if ($uses_patch_system);
- tag "direct-changes-in-diff-but-no-patch-system", $files
+ tag 'direct-changes-in-diff-but-no-patch-system', $files
if (not $uses_patch_system);
}
}
diff --git a/collection/java-info b/collection/java-info
index cfe4d3a..c1bd1d6 100755
--- a/collection/java-info
+++ b/collection/java-info
@@ -38,7 +38,7 @@ my $info = Lintian::Collect->new ($pkg, $type, $dir);
# Sanity check
unless ( -d "$dir/unpacked/") {
- fail "java-info called with the wrong dir argument!";
+ fail 'java-info called with the wrong dir argument';
}
if ( -f "$dir/java-info" ) {
diff --git a/debian/rules b/debian/rules
index ebdd676..cbbdbbc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -103,7 +103,7 @@ binary-indep: $(neededfiles) build
dh_install
# some manual work
- sed -i 's/my $$LINTIAN_VERSION = "<VERSION>"/my $$LINTIAN_VERSION = "$(VER)"/' $(tmp)/usr/bin/lintian
+ sed -i 's/my $$LINTIAN_VERSION = q{<VERSION>}/my $$LINTIAN_VERSION = q{$(VER)}/' $(tmp)/usr/bin/lintian
install -m 644 doc/lintianrc.example $(tmp)/etc/lintianrc
dh_installdocs
dh_installchangelogs
diff --git a/frontend/lintian b/frontend/lintian
index debfda8..2457075 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -65,7 +65,9 @@ qw(
### "Normal" application variables
# Version number - Is replaced during build with sed, see d/rules
-my $LINTIAN_VERSION = "<VERSION>"; #External Version number
+# - use q{} here because we use '' in the snippet to replace the
+# the string (and escaping it would be a pain...)
+my $LINTIAN_VERSION = q{<VERSION>}; #External Version number
if ($LINTIAN_VERSION eq '<VERSION>') {
# For some reason the version above has not be substituted.
# Most likely this means we are a git clone or an unpacked
@@ -1145,7 +1147,7 @@ foreach my $gname (sort $pool->get_group_names()) {
clear_group_cache($group);
# Double check that no processes are running; hopefully
# it will catch regressions like 3bbcc3b earlier.
- fail ("Unreaped processes after running checks!?")
+ fail ('Unreaped processes after running checks!?')
if waitpid (-1, WNOHANG) != -1;
}
}
@@ -1463,7 +1465,7 @@ sub handle_lab_query {
# But the frontend sends it here, because the file denoted by
# that string does not exist.
warning ("\"$orig\" cannot be processed.");
- warning ("It is not a valid lab query and it is not an existing file.");
+ warning ('It is not a valid lab query and it is not an existing file.');
exit 2;
}
diff --git a/lib/Lintian/Command/Simple.pm b/lib/Lintian/Command/Simple.pm
index 5c54787..4bc0eea 100644
--- a/lib/Lintian/Command/Simple.pm
+++ b/lib/Lintian/Command/Simple.pm
@@ -19,7 +19,7 @@ use strict;
use warnings;
use Exporter qw(import);
-use POSIX ":sys_wait_h";
+use POSIX qw(:sys_wait_h);
our @EXPORT_OK = qw(rundir background background_dir wait_any kill_all);
@@ -34,8 +34,8 @@ Lintian::Command::Simple - Run commands without pipes
Lintian::Command::Simple::rundir ('./some-dir/', 'echo', 'hello world');
# Start a command in the background:
- Lintian::Command::Simple::background("sleep", 10);
- print wait() > 0 ? "success" : "failure";
+ Lintian::Command::Simple::background('sleep', 10);
+ print wait() > 0 ? 'success' : 'failure';
=head1 DESCRIPTION
diff --git a/lib/Lintian/Data.pm b/lib/Lintian/Data.pm
index 15a809e..efdb694 100644
--- a/lib/Lintian/Data.pm
+++ b/lib/Lintian/Data.pm
@@ -84,7 +84,7 @@ sub new {
# Returns a listref of profile names
sub _get_vendor_names {
my ($self) = @_;
- croak "No vendor given" unless $profile;
+ croak 'No vendor given' unless $profile;
my @vendors = ();
push @vendors, reverse @{ $profile->profile_list };
return \@vendors;
diff --git a/lib/Lintian/Lab.pm b/lib/Lintian/Lab.pm
index c2e42dd..7106f4b 100644
--- a/lib/Lintian/Lab.pm
+++ b/lib/Lintian/Lab.pm
@@ -265,7 +265,7 @@ sub get_package {
$proc = $pkg;
} else {
$pkg_name = $pkg;
- croak "Package name and type must be defined" unless $pkg_name && $pkg_type;
+ croak 'Package name and type must be defined' unless $pkg_name && $pkg_type;
}
# get_package only works with "real" types (and not views).
@@ -478,7 +478,7 @@ sub _get_lab_manifest_data {
# Note this is also used by reporting/html_reports
sub _get_lab_index {
my ($self, $pkg_type) = @_;
- croak "Undefined (or empty) package type" unless $pkg_type;
+ croak 'Undefined (or empty) package type' unless $pkg_type;
croak "Unknown package type $pkg_type"
unless $SUPPORTED_TYPES{$pkg_type} or $SUPPORTED_VIEWS{$pkg_type};
@@ -565,7 +565,7 @@ removing them.
sub repair {
my ($self) = @_;
my $updates = 0;
- croak "Lab is not open" unless $self->is_open;
+ croak 'Lab is not open' unless $self->is_open;
foreach my $pkg_type (keys %SUPPORTED_TYPES) {
my $index = $self->_get_lab_index ($pkg_type);
my $visitor = sub {
@@ -761,7 +761,7 @@ L</create> directly.
sub open {
my ($self) = @_;
my $dir;
- my $msg = "Open Lab failed";
+ my $msg = 'Open Lab failed';
croak ('Lab is already open') if $self->is_open;
if ($self->is_temp) {
$self->create unless $self->exists;
diff --git a/lib/Lintian/Lab/Manifest.pm b/lib/Lintian/Lab/Manifest.pm
index 1a94572..b063a7c 100644
--- a/lib/Lintian/Lab/Manifest.pm
+++ b/lib/Lintian/Lab/Manifest.pm
@@ -213,14 +213,14 @@ croak.
sub read_list {
my ($self, $file) = @_;
- croak "Cannot read a GROUP manifest" if $self->type eq 'GROUP';
+ croak 'Cannot read a GROUP manifest' if $self->type eq 'GROUP';
my $header;
my $fields;
my $qf;
# Accept a scalar (as an "in-memory file") - write_list does the same
if (my $r = ref $file) {
- croak "Attempt to pass non-scalar ref to read_list.\n" unless $r eq 'SCALAR';
+ croak 'Attempt to pass non-scalar ref to read_list' unless $r eq 'SCALAR';
} else {
# FIXME: clear the manifest if -s $file
return unless -s $file;
@@ -246,7 +246,7 @@ On error, the contents of FILE are undefined.
sub write_list {
my ($self, $file) = @_;
- croak "Cannot write a GROUP manifest" if $self->type eq 'GROUP';
+ croak 'Cannot write a GROUP manifest' if $self->type eq 'GROUP';
my ($header, $fields, undef) = $self->_type_to_fields;
my $visitor;
@@ -352,7 +352,7 @@ to ENTRY will not affect the data in the manifest.
sub set {
my ($self, $entry) = @_;
- croak "Cannot alter a GROUP manifest directly"
+ croak 'Cannot alter a GROUP manifest directly'
if $self->type eq 'GROUP';
my %pdata;
my (undef, $fields, $qf) = $self->_type_to_fields;
@@ -421,7 +421,7 @@ See L</get (KEYS...)> for the key names.
sub delete {
my ($self, @keys) = @_;
- croak "Cannot alter a GROUP manifest directly"
+ croak 'Cannot alter a GROUP manifest directly'
if $self->type eq 'GROUP';
return $self->_do_delete (@keys);
}
@@ -467,7 +467,7 @@ L<Lintian::Lab::ManifestDiff> for more information.
sub diff {
my ($self, $other) = @_;
- croak "Cannot diff a GROUP manifest" if $self->type eq 'GROUP';
+ croak 'Cannot diff a GROUP manifest' if $self->type eq 'GROUP';
my $copy;
my @changed;
my @added;
diff --git a/lib/Lintian/Processable.pm b/lib/Lintian/Processable.pm
index ab3bbc1..35a4103 100644
--- a/lib/Lintian/Processable.pm
+++ b/lib/Lintian/Processable.pm
@@ -103,7 +103,7 @@ sub new_from_metadata {
if ($self->{'pkg_src'} =~ /^([-+\.\w]+)\s+\((.+)\)$/) {
$self->{'pkg_src'} = $1;
$self->{'pkg_src_version'} = $2;
- croak "Two source-versions given (source + source-version)"
+ croak 'Two source-versions given (source + source-version)'
if exists $self->{'source-version'};
} else {
$rename_field->('source-version', 'pkg_src_version',
@@ -111,7 +111,7 @@ sub new_from_metadata {
}
if (not exists $self->{'pkg_path'}) {
my $fn = delete $self->{'filename'};
- croak "Missing required \"filename\" field"
+ croak 'Missing required "filename" field'
unless defined $fn;
$self->{'pkg_path'} = "$basepath/$fn";
}
@@ -133,7 +133,7 @@ sub new_from_metadata {
$self->{'pkg_path'} = "$basepath/${dir}$file";
last;
}
- croak "dsc file not listed in \"Files\""
+ croak 'dsc file not listed in "Files"'
unless defined $self->{'pkg_path'};
}
} elsif ($pkg_type eq 'changes') {
@@ -141,7 +141,7 @@ sub new_from_metadata {
$self->{'pkg_src'} = $self->pkg_name;
$self->{'pkg_src_version'} = $self->pkg_version;
$rename_field->('architecture', 'pkg_arch');
- croak ".changes file must have pkg_path set"
+ croak '.changes file must have pkg_path set'
unless defined $self->{'pkg_path'};
} else {
croak "Unsupported type $pkg_type";
@@ -160,7 +160,7 @@ sub new_from_metadata {
# Shadow Class::Accessor - otherwise you get some very "funny" errors
# from Class::Accessor if you get the constructor wrong.
-sub new { croak "Not implemented"; }
+sub new { croak 'Not implemented'; }
=back
@@ -255,7 +255,7 @@ provide an "info" field.
sub info {
my ($self) = @_;
return $self->{info} if exists $self->{info};
- croak "Not implemented.\n";
+ croak 'Not implemented.';
}
=item $proc->clear_cache
diff --git a/lib/Lintian/Profile.pm b/lib/Lintian/Profile.pm
index ffff742..a090557 100644
--- a/lib/Lintian/Profile.pm
+++ b/lib/Lintian/Profile.pm
@@ -116,7 +116,7 @@ sub new {
if $name =~ m,^/,o or $name =~ m/\./o;
($profile, undef) = $self->_find_vendor_profile ($name);
}
- croak "Cannot find profile $name (in " . join(', ', map { "$_/profiles" } @$ipath).")"
+ croak "Cannot find profile $name (in " . join(', ', map { "$_/profiles" } @$ipath).')'
unless $profile;
# Implementation detail: Ensure that the "lintian" check is always
@@ -597,7 +597,7 @@ sub _find_vendor_profile {
@vendors = @{ $self->{'_vendor_cache'} } if exists $self->{'_vendor_cache'};
unless (@vendors) {
my $vendor = Dpkg::Vendor::get_current_vendor ();
- croak "Could not determine the current vendor"
+ croak 'Could not determine the current vendor'
unless $vendor;
push @vendors, lc $vendor;
while ($vendor) {
diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index a831b15..322d394 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -88,7 +88,7 @@ sub new {
croak 'no tag specified' unless $tag;
%copy = %$tag;
$self = \%copy;
- croak "Missing Tag field" unless $self->{'tag'};
+ croak 'Missing Tag field' unless $self->{'tag'};
$tagname = $self->{'tag'};
croak "Missing Severity field for $tagname" unless $self->{'severity'};
croak "Missing Certainty field for $tagname" unless $self->{'certainty'};
diff --git a/lib/Lintian/Unpacker.pm b/lib/Lintian/Unpacker.pm
index 4882542..571d677 100644
--- a/lib/Lintian/Unpacker.pm
+++ b/lib/Lintian/Unpacker.pm
@@ -168,7 +168,7 @@ sub new {
$ccmap->unlink ($node);
}
# ccmap should not be inconsistent by this change.
- fail "Inconsistent collmap after deletion"
+ fail 'Inconsistent collmap after deletion'
if $ccmap->missing;
}
$self->{'extra-coll'} = $extra;
diff --git a/lib/Lintian/Util.pm b/lib/Lintian/Util.pm
index 9efde3f..8dd9a14 100644
--- a/lib/Lintian/Util.pm
+++ b/lib/Lintian/Util.pm
@@ -969,12 +969,12 @@ stringified and used directly.
sub fail {
my $str = 'internal error: ';
if (@_) {
- $str .= join " ", @_;
+ $str .= join ' ', @_;
} else {
if ($!) {
$str .= "$!";
} else {
- $str .= "No context.";
+ $str .= 'No context.';
}
}
$! = 2; # set return code outside eval()
--
Debian package checker
Reply to: