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

[SCM] Debian package checker branch, master, updated. 2.4.3-182-gc374038



The following commit has been merged in the master branch:
commit 7cddbe6d640e4ccf71c0b9661e77c0fd4cfc871b
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Jan 26 14:49:01 2011 +0100

    Fixed PerlCritic warnings and removed brackets for tag

diff --git a/checks/binaries b/checks/binaries
index f950168..5526e35 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -20,6 +20,8 @@
 
 package Lintian::binaries;
 use strict;
+use warnings;
+
 use Util;
 use Lintian::Check qw(check_spelling);
 use Lintian::Tags qw(tag);
@@ -143,23 +145,23 @@ foreach my $file (sort keys %{$info->objdump_info}) {
 	if ($arch ne 'hppa') {
 	    if ($foo eq '.text' and $sec eq 'Base' and
 		$sym eq '__gmon_start__') {
-		tag "binary-compiled-with-profiling-enabled", "$file";
+		tag 'binary-compiled-with-profiling-enabled', "$file";
 	    }
 	} else {
 	    if ( ($sec =~ /^GLIBC_.*/) and ($sym eq '_mcount') ) {
-		tag "binary-compiled-with-profiling-enabled", "$file";
+		tag 'binary-compiled-with-profiling-enabled', "$file";
 	    }
 	}
     }
     foreach (@{$objdump->{NOTES}}) {
 	if ($_ eq 'File format not recognized') {
-            tag "apparently-corrupted-elf-binary", "$file";
+            tag 'apparently-corrupted-elf-binary', "$file";
 	} elsif ($_ eq 'File truncated') {
-            tag "apparently-truncated-elf-binary", "$file";
+            tag 'apparently-truncated-elf-binary', "$file";
 	} elsif ($_ eq 'Packed with UPX') {
-	    tag "binary-file-compressed-with-upx", "$file";
+	    tag 'binary-file-compressed-with-upx', "$file";
 	} elsif ($_ eq 'Invalid operation') {
-	    tag "binary-with-bad-dynamic-table", "$file" unless $file =~ m%^usr/lib/debug/%;
+	    tag 'binary-with-bad-dynamic-table', "$file" unless $file =~ m%^usr/lib/debug/%;
 	}
     }
 }
@@ -203,7 +205,7 @@ foreach my $expected_name (@sonames) {
     }
 }
 
-tag "package-name-doesnt-match-sonames", "@sonames"
+tag 'package-name-doesnt-match-sonames', "@sonames"
     if @sonames && !$match_found;
 
 my %directories;
@@ -232,11 +234,11 @@ foreach my $file (@{$info->sorted_file_info}) {
     # only if those libraries aren't installed in a multiarch directory.  The
     # package may be a support package for cross-compiles.
     if ($arch eq 'all') {
-	my ($arch) = ($file =~ m,^(?:usr/)?lib/([^/]+)/,);
+	my ($arch_path) = ($file =~ m,^(?:usr/)?lib/([^/]+)/,);
 	$multiarch = Lintian::Data->new('binaries/multiarch')
 	    unless defined($multiarch);
-	unless ($arch and $multiarch->known($arch)) {
-	    tag "arch-independent-package-contains-binary-or-object", "$file";
+	unless ($arch_path and $multiarch->known($arch_path)) {
+	    tag 'arch-independent-package-contains-binary-or-object', "$file";
 	}
     }
 
@@ -244,27 +246,27 @@ foreach my $file (@{$info->sorted_file_info}) {
     next unless $fileinfo =~ m/^[^,]*\bELF\b/o;
 
     if ($file =~ m,^etc/,) {
-	tag "binary-in-etc", "$file";
+	tag 'binary-in-etc', "$file";
     }
 
     if ($file =~ m,^usr/share/,) {
-	tag "arch-dependent-file-in-usr-share", "$file";
+	tag 'arch-dependent-file-in-usr-share', "$file";
     }
 
     if ($arch ne 'all' and $fileinfo !~ m/$ARCH_REGEX{$arch}/) {
 	if ($file =~ m,/lib(\d{2})/, or $file =~ m,/emul/ia(\d{2}),) {
-	    tag "binary-from-other-architecture", $file
+	    tag 'binary-from-other-architecture', $file
 		unless ($fileinfo =~ m/$ARCH_REGEX{$1}/);
 	} elsif ($arch eq 'amd64' and $fileinfo =~ m/$ARCH_REGEX{i386}/) {
 	    # Ignore i386 binaries in amd64 packages for right now.
 	} elsif (exists $arch_64bit_equivs{$arch}
 	    and $fileinfo =~ m/$ARCH_REGEX{$arch_64bit_equivs{$arch}}/
-	    and $file =~ m,^\./lib/modules/,) {
+	    and $file =~ m,^lib/modules/,) {
 	    # Allow amd64 kernel modules to be installed on i386.
 	} else {
 	    $multiarch = Lintian::Data->new('binaries/multiarch')
 		unless defined($multiarch);
-	    tag "binary-from-other-architecture", $file
+	    tag 'binary-from-other-architecture', $file
 		unless (grep { $file =~ m,/\Q$_\E/, } $multiarch->all);
 	}
     }
@@ -281,22 +283,22 @@ foreach my $file (@{$info->sorted_file_info}) {
 	    if ($fileinfo =~ m/executable/
 		and $strings =~ m/^Caml1999X0[0-9][0-9]$/m) {
 		# Check for OCaml custom executables (#498138)
-		tag "ocaml-custom-executable", $file;
+		tag 'ocaml-custom-executable', $file;
 	    } else {
-		tag "unstripped-binary-or-object", "$file";
+		tag 'unstripped-binary-or-object', "$file";
 	    }
 	}
     } else {
 	# stripped but a debug or profiling library?
 	if (($file =~ m,/lib/debug/,o) or ($file =~ m,/lib/profile/,o)) {
-	    tag "library-in-debug-or-profile-should-not-be-stripped", "$file";
+	    tag 'library-in-debug-or-profile-should-not-be-stripped', "$file";
 	} else {
 	    # appropriately stripped, but is it stripped enough?
 	    if (exists $objdump->{NOTE_SECTION}) {
-		tag "binary-has-unneeded-section", "$file .note";
+		tag 'binary-has-unneeded-section', "$file .note";
 	    }
 	    if (exists $objdump->{COMMENT_SECTION}) {
-		tag "binary-has-unneeded-section", "$file .comment";
+		tag 'binary-has-unneeded-section', "$file .comment";
 	    }
 	}
     }
@@ -307,7 +309,7 @@ foreach my $file (@{$info->sorted_file_info}) {
 	    next if $rpath =~ m,^/usr/lib/(?:games/)?\Q$pkg\E(?:/|\z),;
 	    next if $rpath =~ m,^\$\{?ORIGIN\}?,;
 	    next if $directories{$rpath} and $rpath !~ m,^(?:/usr)?/lib/?\z,;
-	    tag "binary-or-shlib-defines-rpath", "$file $rpath";
+	    tag 'binary-or-shlib-defines-rpath', "$file $rpath";
 	}
     }
 
@@ -320,7 +322,7 @@ foreach my $file (@{$info->sorted_file_info}) {
 	    next;
 	}
 	if ($strings =~ /$regex/) {
-	    tag "embedded-library", "$file: $src";
+	    tag 'embedded-library', "$file: $src";
 	}
     }
 
@@ -341,7 +343,7 @@ foreach my $file (@{$info->sorted_file_info}) {
     # Something other than detached debugging symbols in /usr/lib/debug paths.
     if ($file =~ m,^usr/lib/debug/(?:lib\d*|s?bin|usr|opt|dev|emul)/,) {
 	if (exists($objdump->{NEEDED})) {
-	    tag "debug-file-should-use-detached-symbols", $file;
+	    tag 'debug-file-should-use-detached-symbols', $file;
 	}
     }
 
@@ -349,7 +351,7 @@ foreach my $file (@{$info->sorted_file_info}) {
     if ($file =~ m,^usr/lib/debug/[^/]+$,) {
 	unless (exists($objdump->{NEEDED})
 	    || $fileinfo =~ m/statically linked/) {
-	    tag "debug-symbols-directly-in-usr-lib-debug", $file;
+	    tag 'debug-symbols-directly-in-usr-lib-debug', $file;
 	}
     }
 
@@ -360,12 +362,12 @@ foreach my $file (@{$info->sorted_file_info}) {
             # loader (which itself has no dependencies).
             next if ($file =~ m%^usr/lib/debug/%);
             next if ($file =~ m%^lib(?:|32|64)/(?:[\w/]+/)?ld-[\d.]+\.so$%);
-	    tag "shared-lib-without-dependency-information", "$file";
+	    tag 'shared-lib-without-dependency-information', "$file";
 	} else {
 	    # Some exceptions: files in /boot, /usr/lib/debug/*, named *-static or
 	    # *.static, or *-static as package-name.
 	    next if ($file =~ m%^boot/%);
-	    next if ($file =~ /(?:\.|-)static$/);
+	    next if ($file =~ /[\.-]static$/);
 	    next if ($pkg =~ /-static$/);
 	    # klibc binaries appear to be static.
 	    next if ($objdump->{KLIBC});
@@ -373,7 +375,7 @@ foreach my $file (@{$info->sorted_file_info}) {
 	    next if ($file =~ m%^usr/lib/debug/%);
 	    # ldconfig must be static.
 	    next if ($file eq 'sbin/ldconfig');
-	    tag "statically-linked-binary", "$file";
+	    tag 'statically-linked-binary', "$file";
 	}
     } else {
 	my $lib;
@@ -389,9 +391,9 @@ foreach my $file (@{$info->sorted_file_info}) {
 	}
 	if ($no_libc and not $file =~ m,/libc\b,) {
 	    if ($fileinfo =~ m/shared object/) {
-		tag "library-not-linked-against-libc", "$file";
+		tag 'library-not-linked-against-libc', "$file";
 	    } else {
-		tag "program-not-linked-against-libc", "$file";
+		tag 'program-not-linked-against-libc', "$file";
 	    }
 	}
     }
@@ -419,11 +421,11 @@ if ($needs_depends_line) {
             if ($needs_libc_count > 0) {
                 $others = " and $needs_libc_count others";
             }
-            tag "missing-dependency-on-libc",
+            tag 'missing-dependency-on-libc',
 		"needed by $needs_libc_file$others";
         }
     } elsif (!$depends) {
-	tag "missing-depends-line";
+	tag 'missing-depends-line';
     }
 }
 
diff --git a/checks/changes-file b/checks/changes-file
index 887d19e..9788d49 100644
--- a/checks/changes-file
+++ b/checks/changes-file
@@ -20,8 +20,9 @@
 
 package Lintian::changes_file;
 use strict;
-use Util;
+use warnings;
 
+use Util;
 use Lintian::Tags qw(tag);
 use Lintian::Check qw(check_maintainer);
 
@@ -36,14 +37,14 @@ my $info = shift;
 # If we don't have a Format key, something went seriously wrong.
 # Tag the file and skip remaining processing.
 if (!$info->field('format')) {
-    tag('malformed-changes-file');
+    tag 'malformed-changes-file';
     return 0;
 }
 
 # Description is mandated by dak, but only makes sense if binary
 # packages are included.  Don't tag pure source uploads.
 if (!$info->field('description') && $info->field('architecture') ne 'source') {
-    tag("no-description-in-changes-file");
+    tag 'no-description-in-changes-file';
 }
 
 # check distribution field
@@ -56,9 +57,9 @@ if (defined $info->field('distribution')) {
 	    # ignore
 	} elsif ($info->field('version') =~ /ubuntu|$ubuntu_regex/
 	    or $distribution =~ /$ubuntu_regex/) {
-		if ($distribution !~ /^($ubuntu_regex)(-(proposed|updates|backports|security))?$/ ) {
-		    tag("bad-ubuntu-distribution-in-changes-file",
-			$distribution);
+		if ($distribution !~ /^(?:$ubuntu_regex)(?:-(?:proposed|updates|backports|security))?$/ ) {
+		    tag 'bad-ubuntu-distribution-in-changes-file',
+			$distribution;
 		}
 	} elsif (! (($distribution eq 'oldstable')
 		     or ($distribution eq 'stable')
@@ -71,24 +72,24 @@ if (defined $info->field('distribution')) {
 		     or ($distribution =~ /^\w+-volatile$/))
 		) {
 	    # bad distribution entry
-	    tag("bad-distribution-in-changes-file", $distribution);
+	    tag 'bad-distribution-in-changes-file', $distribution;
 	}
     }
 
     if ($#distributions > 0) {
-	tag("multiple-distributions-in-changes-file",
-	    $info->field('distribution'));
-	}
+	tag 'multiple-distributions-in-changes-file',
+	    $info->field('distribution');
     }
+}
 
     # Urgency is only recommended by Policy.
     if (!$info->field('urgency')) {
-	tag("no-urgency-in-changes-file");
+	tag 'no-urgency-in-changes-file';
     } else {
 	my $urgency = lc $info->field('urgency');
-	$urgency =~ s/ .*//;
-	unless ($urgency =~ /^(low|medium|high|critical|emergency)$/i) {
-	    tag("bad-urgency-in-changes-file", $info->field('urgency'));
+	$urgency =~ s/ .*//o;
+	unless ($urgency =~ /^(?:low|medium|high|critical|emergency)$/io) {
+	    tag 'bad-urgency-in-changes-file', $info->field('urgency');
 	}
     }
 
@@ -105,16 +106,16 @@ if (defined $info->field('distribution')) {
 	# check section
 	if (($file_info->{section} eq 'non-free') or
 	    ($file_info->{section} eq 'contrib')) {
-	    tag("bad-section-in-changes-file", $file, $file_info->{section});
+	    tag 'bad-section-in-changes-file', $file, $file_info->{section};
 	}
 
 	foreach my $alg (qw(sha1 sha256)) {
 	    my $checksum_info = $file_info->{checksums}{$alg};
 	    if (defined $checksum_info) {
 		if ($file_info->{size} != $checksum_info->{filesize}) {
-		    tag( "file-size-mismatch-in-changes-file", $file,
+		    tag 'file-size-mismatch-in-changes-file', $file,
 			$file_info->{size} . ' != ' .
-			$checksum_info->{filesize} );
+			$checksum_info->{filesize};
 		}
 	    }
 	}
@@ -126,19 +127,19 @@ if (defined $info->field('distribution')) {
 	my $size = -s $filename;
 
 	if ($size ne $file_info->{size}) {
-	    tag( "file-size-mismatch-in-changes-file", $file,
-		 $file_info->{size} . " != $size");
+	    tag 'file-size-mismatch-in-changes-file', $file,
+		 $file_info->{size} . " != $size";
 	}
 
 	# check checksums
-	if ($check_checksums or $file =~ /\.dsc$/) {
+	if ($check_checksums or $file =~ m/\.dsc$/o) {
 	    foreach my $alg (qw(md5 sha1 sha256)) {
 		next unless exists $file_info->{checksums}{$alg};
 
 		my $real_checksum = get_file_checksum($alg, $filename);
 
 		if ($real_checksum ne $file_info->{checksums}{$alg}{sum}) {
-		    tag( "checksum-mismatch-in-changes-file", $alg, $file );
+		    tag 'checksum-mismatch-in-changes-file', $alg, $file;
 		}
 	    }
 	}
diff --git a/checks/debian-source-dir b/checks/debian-source-dir
index ddff2b6..75d87e5 100644
--- a/checks/debian-source-dir
+++ b/checks/debian-source-dir
@@ -36,21 +36,21 @@ my $pkg = shift;
 my $type = shift;
 my $info = shift;
 
-if (-e "debfiles/source/format") {
-    open(FORMAT, "<", "debfiles/source/format") or
+if (-e 'debfiles/source/format') {
+    open(FORMAT, '<', 'debfiles/source/format') or
         fail("cannot read debian/source/format: $!");
     my $format = <FORMAT>;
     chomp $format;
-    tag "unknown-source-format", $format unless $KNOWN_FORMATS{$format};
+    tag 'unknown-source-format', $format unless $KNOWN_FORMATS{$format};
 } else {
-    tag "missing-debian-source-format";
+    tag 'missing-debian-source-format';
 }
 
-if (-d "debfiles/source") {
-    opendir(DEBSRC, "debfiles/source") or fail("cannot opendir debian/source/: $!");
+if (-d 'debfiles/source') {
+    opendir(DEBSRC, 'debfiles/source') or fail("cannot opendir debian/source/: $!");
     my $file;
     while ($file = readdir(DEBSRC)) {
-        next if $file eq "." or $file eq "..";
+        next if $file eq '.' or $file eq '..';
         tag "unknown-file-in-debian-source", $file
             unless $KNOWN_FILES->known($file);
     }

-- 
Debian package checker


Reply to: