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

Bug#427577: lintian: warn on usage of deprecated substvar Source-Version



Package: lintian
Version: 1.23.30
Severity: wishlist
Tags: patch

Hi,

I'm attaching a patch to emit warnings on packages using the
deprecated substvar Source-Version.

I'm not sure about the naming of the tag, I've been pondering between:

  substvar-source-version-is-deprecated "$pkg"
  package-uses-deprecated-source-version-substvar "$pkg"
  package-uses-deprecated-substvar "$pkg $substvar"

neither of what's more appropriate, if warning per instance of the
substvar, once per field, per binary package, or globally per source
control file. I've choosen per binary package, but I don't feel I have
a global vision over lintian to see if it's correct. If it seems wrong
I can fix the patch and resend.

Also I've seen there's several instances of @dep_fields (in different
forms), which might be good to refactor into common_data.pm or
something.

regards,
guillem
diff -Naur lintian-1.23.30/checks/version-substvars lintian-1.23.30.new/checks/version-substvars
--- lintian-1.23.30/checks/version-substvars	2006-08-19 02:38:57.000000000 +0300
+++ lintian-1.23.30.new/checks/version-substvars	2007-06-05 02:59:06.000000000 +0300
@@ -41,6 +41,7 @@
 my $type = shift;
 
 my @control_data = read_dpkg_control("debfiles/control");
+my @dep_fields = qw(depends pre-depends recommends suggests conflicts replaces);
 
 shift @control_data; # skip source info entry
 
@@ -50,6 +51,14 @@
 	$pkg1 = $_->{'package'};
 	$pkg1_is_any = ($_->{'architecture'} ne 'all');
 
+	foreach my $field (@dep_fields) {
+		next unless $_->{$field};
+		if ($_->{$field} =~ m/\${Source-Version}/) {
+			tag "substvar-source-version-is-deprecated", $pkg1;
+			last;
+		}
+	}
+
 	foreach (split /,/, ($_->{'depends'} || "")) {
 		next unless m/(\S+)\s*\(\s*=\s*\${((?:Source-|source:|binary:)Version)}/x;
 
@@ -74,8 +83,6 @@
 			# (b3) all -> any (= ${either-of-them})
 			tag "not-binnmuable-all-depends-any", "$pkg1 -> $pkg2";
 		}
-
-		# TODO (post-Etch?): warn/error about ${Source-Version} being deprecated
 	}
 }
 
diff -Naur lintian-1.23.30/checks/version-substvars.desc lintian-1.23.30.new/checks/version-substvars.desc
--- lintian-1.23.30/checks/version-substvars.desc	2006-08-19 02:37:25.000000000 +0300
+++ lintian-1.23.30.new/checks/version-substvars.desc	2007-06-05 02:57:13.000000000 +0300
@@ -41,3 +41,11 @@
  (= ${binary:Version}), (= ${source:Version}), or (= ${Source-Version}),
  but the second package is not built from this source package.  Usually
  this means there is a mistake in the package name in this dependency.
+
+Tag: substvar-source-version-is-deprecated
+Type: warning
+Info: The package uses the now deprecated ${Source-Version} substvar,
+ which has misleading semantics. Please switch to ${binary:Version} or
+ ${source:Version} as appropriate. Support for ${Source-Version} might
+ get removed from dpkg-dev in the future.
+

Reply to: