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

[SCM] Debian package checker branch, master, updated. 2.2.6-25-g9cddb28



The following commit has been merged in the master branch:
commit 9cddb282922e2282cc078b2980aff6832188a343
Author: Russ Allbery <rra@debian.org>
Date:   Sun Mar 1 22:24:36 2009 -0800

    Be robust against whitespace in fields
    
    * checks/binaries:
      + [RA] Be robust against whitespace in the Architecture field.
    * checks/cruft:
      + [RA] Be robust against whitespace in the Architecture field.
    * checks/fields:
      + [RA] Strip leading and trailing whitespace from fields and simplify
        other logic to assume that.  Thanks, Gonéri Le Bouder.
    * checks/huge-usr-share:
      + [RA] Simplify architecture checking code and be robust against
        whitespace in the field.
    * checks/nmu:
      + [RA] Be robust against whitespace in the Architecture field.
    * checks/rules:
      + [RA] Be robust against whitespace in the Architecture field.
    * checks/shared-libs:
      + [RA] Be robust against whitespace in the Architecture field.
    * checks/version-substvars:
      + [RA] Be robust against whitespace in the Architecture field.
        Thanks, Gonéri Le Bouder.  (Closes: #517555)

diff --git a/checks/binaries b/checks/binaries
index d718dcc..d9baff5 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -75,6 +75,8 @@ my $has_perl_lib = 0;
 my %SONAME;
 
 $arch = $info->field('architecture');
+$arch =~ s/^\s+//;
+$arch =~ s/\s+$//;
 
 foreach my $file (sort keys %{$info->objdump_info}) {
     my $objdump = $info->objdump_info->{$file};
diff --git a/checks/cruft b/checks/cruft
index 209e22d..a7f2dbe 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -101,7 +101,7 @@ if ($info->native) {
 my $arch;
 if (defined $info->field('architecture')) {
     my $arch = $info->field('architecture');
-    if ($pkg =~ /-docs?$/ && $arch ne 'all') {
+    if ($pkg =~ /-docs?$/ && $arch !~ /^\s*all\s*$/) {
         tag 'documentation-package-not-architecture-independent';
     }
 }
diff --git a/checks/fields b/checks/fields
index 7fc6c77..0fedbbd 100644
--- a/checks/fields
+++ b/checks/fields
@@ -274,8 +274,6 @@ for my $f (qw(maintainer uploaders)) {
 		# newlines for the .dsc, and the newlines don't hurt in debian/control
 		unfold($f, \$maintainer);
 
-		$maintainer =~ s/^\s*(.+?)\s*$/$1/; #Remove leading and trailing whitespace
-
 		if ($f eq "uploaders") {
 			my @uploaders = split /\s*,\s*/, $maintainer;
 			my %duplicate_uploaders;
@@ -410,7 +408,7 @@ if (defined $info->field('homepage')) {
 
 	unfold("homepage", \$homepage);
 
-	if ($homepage =~ /^\s*<(?:UR[LI]:)?.*>\s*$/i) {
+	if ($homepage =~ /^<(?:UR[LI]:)?.*>$/i) {
 		tag "superfluous-clutter-in-homepage", $homepage;
 	}
 
@@ -459,7 +457,6 @@ if (($type eq "binary") || ($type eq 'udeb')) {
 			#Get data and clean it
 			my $data = $info->field($field);;
 			unfold($field, \$data);
-			$data =~ s/^\s*(.+?)\s*$/$1/;
 			$fields{$field} = $data;
 
 			my (@seen_libstdcs, @seen_tcls, @seen_tclxs, @seen_tks, @seen_tkxs, @seen_libpngs);
@@ -609,7 +606,7 @@ if ($type eq "source") {
 	my $arch_dep_packages = 0;
 	foreach my $binpkg (keys %$binpkgs) {
 		my $arch = $info->binary_field($binpkg, 'architecture');
-		if ($arch eq 'all') {
+		if ($arch =~ /^\s*all\s*$/) {
 			$arch_indep_packages++;
 		} else {
 			$arch_dep_packages++;
@@ -692,7 +689,6 @@ if ($type eq "source") {
 			#Get data and clean it
 			my $data = $info->field($field);;
 			unfold($field, \$data);
-			$data =~ s/^\s*(.+?)\s*$/$1/;
 			$depend{$field} = $data;
 
 			for my $dep (split /\s*,\s*/, $data) {
@@ -839,7 +835,7 @@ if ($type eq "source") {
 	foreach my $binpkg (keys %$binpkgs) {
 		if ($binpkg =~ m/-dbg$/) {
 			push @dbg_pkgs, $binpkg;
-		} elsif ($info->binary_field($binpkg, 'architecture') ne 'all') {
+		} elsif ($info->binary_field($binpkg, 'architecture') !~ /^\s*all\s*$/) {
 			push @arch_dep_pkgs, $binpkg;
 		}
 	}
@@ -859,7 +855,7 @@ if (defined $info->field('origin')) {
 
 	unfold('origin', \$origin);
 
-	tag "redundant-origin-field", "" if $origin =~ /^\s*debian\s*$/i;
+	tag "redundant-origin-field" if lc($origin) eq 'debian';
 }
 
 #----- Bugs
@@ -870,7 +866,7 @@ if (defined $info->field('bugs')) {
 	unfold('bugs', \$bugs);
 
 	tag "redundant-bugs-field"
-	    if $bugs =~ m,^\s*debbugs://bugs.debian.org/?\s*$,i;
+	    if $bugs =~ m,^debbugs://bugs.debian.org/?$,i;
 }
 
 #----- Python-Version
@@ -914,7 +910,7 @@ if (defined $info->field('dm-upload-allowed')) {
 
 	unfold('dm-upload-allowed', \$dmupload);
 
-	unless ($dmupload =~ /^\s*yes\s*$/) {
+	unless ($dmupload eq 'yes') {
 		tag "malformed-dm-upload-allowed", "$dmupload";
 	}
 }
@@ -996,6 +992,8 @@ sub unfold {
 	if ($$line =~ s/\n//g) {
 		tag "multiline-field", "$field";
 	}
+	$$line =~ s/^\s+//;
+	$$line =~ s/\s+$//;
 }
 
 1;
diff --git a/checks/huge-usr-share b/checks/huge-usr-share
index b318a7e..85638d3 100644
--- a/checks/huge-usr-share
+++ b/checks/huge-usr-share
@@ -34,15 +34,10 @@ my $pkg = shift;
 my $type = shift;
 my $info = shift;
 
-my $arch;
+# Skip architecture-dependent packages.
+my $arch = $info->field('architecture') || '';
+return 0 if $arch =~ /^\s*all\s*$/;
 
-# read architecture
-if (defined $info->field('architecture')) {
-    $arch = $info->field('architecture');
-}
-
-# If this is a arch-independent package, this test doesn't apply
-return 0 if $arch eq 'all';
 # usr/share missing. other checks will moan about it
 # so just ignore this package
 return 0 if !-d 'unpacked/usr/share';
diff --git a/checks/nmu b/checks/nmu
index 51fc6f6..995ac7c 100644
--- a/checks/nmu
+++ b/checks/nmu
@@ -73,6 +73,7 @@ if ($firstline) {
 }
 
 my $version = $info->field("version");
+$version =~ s/\s*$//;
 my $maintainer = canonicalize($info->field("maintainer"));
 my $uploaders = $info->field("uploaders");
 
diff --git a/checks/rules b/checks/rules
index 5ecac73..a9bd18b 100644
--- a/checks/rules
+++ b/checks/rules
@@ -53,8 +53,7 @@ unless (-d "fields") {
     fail("directory in lintian laboratory for $type package $pkg missing: fields");
 }
 
-my $architecture = ""; 
-$architecture = $info->field('architecture') || "";
+my $architecture = $info->field('architecture') || "";
 
 #get build-depends:
 my $build_deps = "";
@@ -175,7 +174,7 @@ unless ($includes) {
 
 # Make sure we have no content for binary-arch if we are arch-indep:
 $rules_per_target{'binary-arch'} ||= [];
-if ($architecture eq "all" && scalar @{$rules_per_target{'binary-arch'}}) {
+if ($architecture =~ /^\s*all\s*$/ && scalar @{$rules_per_target{'binary-arch'}}) {
     my $nonempty = 0;
     foreach (@{$rules_per_target{'binary-arch'}}) {
         # dh binary-arch is actually a no-op if there is no
diff --git a/checks/shared-libs b/checks/shared-libs
index c62ca79..c398219 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -146,6 +146,8 @@ for my $cur_file (sort keys %{$info->index}) {
 	    if (not defined $objdump->{$cur_file}->{STACK}) {
 		if (defined $info->field('architecture')) {
 		    my $arch = $info->field('architecture');
+		    $arch =~ s/^\s+//;
+		    $arch =~ s/\s+$//;
 		    tag "shlib-without-PT_GNU_STACK-section", $cur_file
 			if $stack_arches{$arch};
 		}
diff --git a/checks/version-substvars b/checks/version-substvars
index d1d0c69..f8a9652 100644
--- a/checks/version-substvars
+++ b/checks/version-substvars
@@ -52,7 +52,7 @@ foreach (keys %$binpkgs) {
 	my ($pkg1, $pkg1_is_any, $pkg2, $pkg2_is_any, $substvar_strips_binNMU);
 
 	$pkg1 = $_;
-	$pkg1_is_any = ($info->binary_field($pkg1, 'architecture') ne 'all');
+	$pkg1_is_any = ($info->binary_field($pkg1, 'architecture') =~ /^\s*all\s*$/);
 
 	foreach my $field (@dep_fields) {
 		next unless $info->binary_field($pkg1, $field);
@@ -76,7 +76,7 @@ foreach (keys %$binpkgs) {
 				unless ($pkg2 =~ /\$\{\S+\}/);
 			next;
 		}
-		$pkg2_is_any = ($info->binary_field($pkg2, 'architecture') !~ m/^all$/);
+		$pkg2_is_any = ($info->binary_field($pkg2, 'architecture') !~ m/^\s*all\s*$/);
 
 		if ($pkg1_is_any) {
 			if ($pkg2_is_any and $substvar_strips_binNMU) {
diff --git a/debian/changelog b/debian/changelog
index e82ab46..1cd31d4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ lintian (2.2.7) UNRELEASED; urgency=low
       Geissert.  (Closes: #318104)
     + [RA] Avoid capturing parentheses in regexes due to their minor
       performance penalty.  Patch from Raphael Geissert.
+    + [RA] Be robust against whitespace in the Architecture field.
   * checks/changelog-file:
     + [RA] Avoid capturing parentheses in regexes due to their minor
       performance penalty.  Patch from Raphael Geissert.
@@ -20,11 +21,15 @@ lintian (2.2.7) UNRELEASED; urgency=low
     + [RA] Avoid false positive for versionless license files when the
       file is referred to without a hyphen; instead, issue a separate tag
       that explains the problem.  Based on a patch from Raphael Geissert.
+  * checks/cruft:
+    + [RA] Be robust against whitespace in the Architecture field.
   * checks/fields:
     + [RA] Precompile constant regexes with qr.  Patch from Raphael
       Geissert.
     + [RA] Load Lintian::Data objects only once.  Patch from Raphael
       Geissert.  Also use all caps for global variables.
+    + [RA] Strip leading and trailing whitespace from fields and simplify
+      other logic to assume that.  Thanks, Gonéri Le Bouder.
   * checks/files:
     + [RA] Avoid capturing parentheses in regexes due to their minor
       performance penalty.  Patch from Raphael Geissert.
@@ -32,6 +37,9 @@ lintian (2.2.7) UNRELEASED; urgency=low
       font packages if needed.  Patch from Raphael Geissert.
     + [RA] Warn about yui-*.js as well as yahoo-*.js.  Patch from Raphael
       Geissert.
+  * checks/huge-usr-share:
+    + [RA] Simplify architecture checking code and be robust against
+      whitespace in the field.
   * checks/manpages:
     + [CW] Run man with '-E UTF-8' to avoid producing bogus warnings on
       localised manual pages due to attempting to recode through ASCII.
@@ -40,6 +48,9 @@ lintian (2.2.7) UNRELEASED; urgency=low
       Geissert.  Also use all caps for global variables.
   * checks/nmu:
     + [RA] Calculate the regex for Ubuntu distributions only once.
+    + [RA] Be robust against whitespace in the Architecture field.
+  * checks/rules:
+    + [RA] Be robust against whitespace in the Architecture field.
   * checks/shared-libs:
     + [ADB] When parsing symbols files, correctly ensure that meta-information
       occurs between the end of the dependency template(s) and the start of
@@ -48,6 +59,10 @@ lintian (2.2.7) UNRELEASED; urgency=low
       alternative dependency templates used meta-information.
     + [ADB] Extend the parsing of dependency templates in symbols files to
       handle ORed dependencies.
+    + [RA] Be robust against whitespace in the Architecture field.
+  * checks/version-substvars:
+    + [RA] Be robust against whitespace in the Architecture field.
+      Thanks, Gonéri Le Bouder.  (Closes: #517555)
 
   * debian/control:
     + [CW] Depend on man-db (>= 2.4.0) for '-E UTF-8'.

-- 
Debian package checker


Reply to: