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

[SCM] Debian package checker branch, master, updated. 2.2.12-9-ga60e4ab



The following commit has been merged in the master branch:
commit a60e4ab929a85a84572fb1b54d54fa7a4fcb8837
Author: Russ Allbery <rra@debian.org>
Date:   Sun Jun 21 22:35:39 2009 -0700

    Improvements to missing-separator-between-lines
    
    * checks/control-file{,.desc}:
      + [RA] Rework missing-separator-between-lines to only include two
        specific package stanzas in the extra tag data and not include
        newlines.  Generalize it to also detect missing commas between
        substvars, replacing missing-comma-after-substvar.

diff --git a/checks/control-file b/checks/control-file
index cc23e42..9379992 100644
--- a/checks/control-file
+++ b/checks/control-file
@@ -88,46 +88,44 @@ for my $binary_control (@binary_controls) {
 		tag 'binary-control-field-duplicates-source', "field \"$field\" in package ".$binary_control->{'package'},
 		    if ($header->{$field} && $binary_control->{$field} eq $header->{$field});
 	}
-
-	# If two substvars aren't separated by a comma, but at least one of
-	# them expands to an empty string, there will be a lurking bug.  The
-	# result will be syntactically correct, but as soon as both expand
-	# into something non-empty, there will be a syntax error.  Catch that
-	# mistake to avoid problems later.
-	#
-	# Only check the fields that use comma-separated values.
-	for my $field (qw(pre-depends depends recommends suggests breaks
-			  conflicts provides replaces enhances)) {
-		next unless $binary_control->{$field};
-		if ($binary_control->{$field} =~ /(\$\{\S+\})\s+[a-zA-Z0-9\$]/) {
-			tag 'missing-comma-after-substvar', "in $field field near $1";
-		}
-	}
 }
 
-# Check if comma-separated values that span multiple lines omit commas as in
-# the following example:
-#   Depends: foo, bar
-#    baz
+# Check that fields which should be comma-separated or pipe-separated have
+# separators.  Places where this tends to cause problems are with wrapped
+# lines such as:
+#
+#     Depends: foo, bar
+#      baz
+#
+# or with substvars.  If two substvars aren't separated by a comma, but at
+# least one of them expands to an empty string, there will be a lurking bug.
+# The result will be syntactically correct, but as soon as both expand into
+# something non-empty, there will be a syntax error.
 for my $control ($header, @binary_controls) {
 	for my $field (qw(pre-depends depends recommends suggests breaks
 			  conflicts provides replaces enhances
 			  build-depends build-depends-indep
 			  build-conflics build-conflicts-indep)) {
 		next unless $control->{$field};
-		if ($control->{$field} =~ /
-			([^,|]+)	# previous entry
-			\s*\n\s+	# new line + space
-			([a-z][^,|]+)	# next entry, must start with a letter
-			/x) {
-
+		my $value = $control->{$field};
+		$value =~ s/\n(\s)/$1/g;
+		if ($value =~ /(?:^|\s)
+			       (
+				(?:\w[^\s,|]+|\$\{\S+\})\s*
+				(?:\([^\)]*\)\s*|\[[^\]]+\]\s*)*
+			       )
+			       \s+
+			       (
+				(?:\w[^\s,|]+|\$\{\S+\})\s*
+				(?:\([^\)]*\)\s*|\[[^\]]+\]\s*)*
+			       )/x) {
 			my ($prev, $next) = ($1, $2);
 			for ($prev, $next) {
-				s/^\s+//; s/\s+$//;
+				s/\s+$//;
 			}
-			tag "missing-separator-between-items",
-			    "in $field field between '$prev' and '$next', " .
-			    ($control->{source} ? 'source' : $control->{package});
+			tag 'missing-separator-between-items', 'in',
+			    ($control->{source} ? 'source' : $control->{package}),
+			    "$field field between '$prev' and '$next'";
 		}
 	}
 }
diff --git a/checks/control-file.desc b/checks/control-file.desc
index 91c675c..e52ab90 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -131,24 +131,13 @@ Info: The listed binary packages all share the same extended description.
  particularly for users who aren't familiar with Debian's package naming
  conventions.
 
-Tag: missing-comma-after-substvar
-Severity: normal
-Certainty: possible
-Info: The given field in the <tt>debian/control</tt> file has a substvar
- (something of the form <tt>${Variable}</tt>) that isn't followed by a
- comma.  This is normally a lurking bug.  As long as the variable isn't
- defined or expands to an empty string, the generated control file will be
- syntactically valid, but as soon as the variable has a non-empty value,
- the control file will have a syntax error.  You probably meant to put a
- comma after the substvar expansion.
-
 Tag: missing-separator-between-items
 Severity: important
 Certainty: certain
 Info: The given field in the <tt>debian/control</tt> file contains a list
- of items separated by commas and pipes.  It appears that when wrapping
- the list on multiple lines, a separator was missed at the end of a line.
- This can lead to bogus or incomplete dependencies, conflicts etc.
+ of items separated by commas and pipes.  It appears a separator was
+ missed between two items.  This can lead to bogus or incomplete
+ dependencies, conflicts etc.
 
 Tag: package-depends-on-hardcoded-libc
 Severity: normal
diff --git a/debian/changelog b/debian/changelog
index 53e5edc..aad174c 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,14 @@
 lintian (2.2.13) UNRELEASED; urgency=low
 
+  * Summary of tag changes:
+    + Removed:
+      - missing-comma-after-substvar
+
+  * checks/control-file{,.desc}:
+    + [RA] Rework missing-separator-between-lines to only include two
+      specific package stanzas in the extra tag data and not include
+      newlines.  Generalize it to also detect missing commas between
+      substvars, replacing missing-comma-after-substvar.
   * checks/cruft:
     + [RA] Don't warn about outdated libtool if the package build-depends
       on libtool.  Thanks, Kurt Roeckx.  (Closes: #534134)
diff --git a/t/tests/control-file-general/debian/debian/control.in b/t/tests/control-file-general/debian/debian/control.in
index 796eaac..7f2a587 100644
--- a/t/tests/control-file-general/debian/debian/control.in
+++ b/t/tests/control-file-general/debian/debian/control.in
@@ -43,6 +43,11 @@ Depends: $\{shlibs:Depends\}, $\{misc:Depends\}, foo
   bar (>= 1), baz
   (<< 2),
   fizz (= 2.0)
+Suggests: p1
+ p2
+ p3
+ p4
+ p5
 Description: {$description} (three)
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
diff --git a/t/tests/control-file-general/desc b/t/tests/control-file-general/desc
index 15f3c72..4776256 100644
--- a/t/tests/control-file-general/desc
+++ b/t/tests/control-file-general/desc
@@ -7,7 +7,6 @@ Test-For:
  build-info-in-binary-control-file-section
  duplicate-long-description
  duplicate-short-description
- missing-comma-after-substvar
  missing-separator-between-items
  no-section-field-for-source
  package-depends-on-itself
diff --git a/t/tests/control-file-general/tags b/t/tests/control-file-general/tags
index 76cea17..53ca602 100644
--- a/t/tests/control-file-general/tags
+++ b/t/tests/control-file-general/tags
@@ -1,9 +1,10 @@
 E: control-file-general source: build-info-in-binary-control-file-section Package control-file-general
-E: control-file-general source: missing-separator-between-items in depends field between 'foo' and 'bar (>= 1)', control-file-general-3
+E: control-file-general source: missing-separator-between-items in control-file-general depends field between '${shlibs:Depends}' and '${misc:Depends}'
+E: control-file-general source: missing-separator-between-items in control-file-general-3 depends field between 'foo' and 'bar (>= 1)'
+E: control-file-general source: missing-separator-between-items in control-file-general-3 suggests field between 'p1' and 'p2'
 I: control-file-general source: binary-control-field-duplicates-source field "maintainer" in package control-file-general
 I: control-file-general source: duplicate-long-description control-file-general control-file-general-1 control-file-general-2 control-file-general-3 control-file-general-4
 I: control-file-general source: duplicate-short-description control-file-general control-file-general-1
-W: control-file-general source: missing-comma-after-substvar in depends field near ${shlibs:Depends}
 W: control-file-general source: no-section-field-for-source
 W: control-file-general source: package-depends-on-itself control-file-general depends
 W: control-file-general source: stronger-dependency-implies-weaker control-file-general depends -> recommends foo

-- 
Debian package checker


Reply to: