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

Bug#485879: checks/watch-file: further improvements



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

To finally get rid of our own 'extra' Debian version mangling on DEHS please 
also trigger the debian-watch-file-should-mangle-version warning when 

if ($version =~ /dfsg|ds|debian/ and not $mangle) {

But 

$mangle = 1 if grep { /^[ud]versionmangle/ } @opts;

also needs to be improved, as one can have a package 'foo' with a Debian 
version like 1.0+dfsg-1 and a watch file like the following, and lintian will 
be silent:

version=3
opts=uversionmangle=s/RC/~$1/ \
http://domain.tld/foo-(.*)\.tar\.gz

The grep line should at least try to also match dfsg|ds|debian, to be a little 
less prone to false negatives.

And as stated in wiki.d.o/DEHS, the version mangling should occur in Debian's 
version, not upstream's version.

Attached is a patch that makes lintian check for dfsg|debian|ds, check that 
there _is_ a version mangling that mentions dfsg|debian|ds (whatever it was 
matched, but not just 'any'), and warns if the version mangling takes place 
in upstream's and not Debian's version.

Feel free to downgrade (also rename, and tweak the description) the severity 
of the new tag.

Example of a package using uversionmangle to _add_ dfsg instead of stripping 
in dversionmangle: libxml-sax-perl, more info:
http://lists.alioth.debian.org/pipermail/dehs-devel/2008-March/000299.html

Sincerely,
-- 
Atomo64 - Raphael

Please avoid sending me Word, PowerPoint or Excel attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
Index: checks/watch-file
===================================================================
--- checks/watch-file	(revision 1375)
+++ checks/watch-file	(working copy)
@@ -31,17 +31,26 @@
 my $type = shift;
 my $info = shift;
 
+my $repack = 'dfsg|debian|ds';
+
 unless ($info->native) {
     unless (-f "debfiles/watch") {
         tag 'debian-watch-file-is-missing';
         return;
     }
 
+    my $version = $info->field('version');
+    # Check if the Debian version contains anything that resembles a repackaged
+    # source package sign, for fine grained version mangling check
+    if ($version =~ /($repack)/) {
+	$repack = $1;
+    }
+
     # Gather information from the watch file and look for problems we can
     # diagnose on the first time through.
     open(WATCH, '<', 'debfiles/watch') or fail("cannot open watch file: $!");
     local $_;
-    my ($watchver, $mangle);
+    my ($watchver, $mangle, $dmangle);
     while (<WATCH>) {
         next if /^\s*\#/;
         next if /^\s*$/;
@@ -66,7 +75,8 @@
             if (s/^opts=(\S+)\s*// || s/^opts=\"([^\"]+)\"//) {
                 $opts = $1;
                 @opts = split(',', $opts);
-                $mangle = 1 if grep { /^[ud]versionmangle/ } @opts;
+                $mangle = 1 if grep { /^[ud]versionmangle.*=.*($repack)/ } @opts;
+		$dmangle = 1 if grep { /^dversionmangle.*=.*($repack)/ } @opts;
             }
         }
     }
@@ -74,10 +84,13 @@
 
     # If the version of the package contains dfsg, assume that it needs to be
     # mangled to get reasonable matches with upstream.
-    my $version = $info->field('version');
-    if ($version =~ /dfsg/ and not $mangle) {
+    if ($version =~ /$repack/ and not $mangle) {
         tag 'debian-watch-file-should-mangle-version';
     }
+
+    if ($version =~ /$repack/ and $mangle and not $dmangle) {
+        tag 'debian-watch-file-should-dversionmangle-not-uversionmangle';
+    }
 }
 
 }
Index: checks/watch-file.desc
===================================================================
--- checks/watch-file.desc	(revision 1375)
+++ checks/watch-file.desc	(working copy)
@@ -42,11 +42,22 @@
 
 Tag: debian-watch-file-should-mangle-version
 Type: warning
-Ref: uscan(1)
-Info: The version of this package contains <tt>dfsg</tt>, which normally
- indicates that the upstream source has been repackaged to comply with the
- Debian Free Software Guidelines, but there is no version mangling in the
+Ref: uscan(1), http://wiki.debian.org/DEHS
+Info: The version of this package contains <tt>dfsg</tt>, <tt>ds</tt>,
+ or <tt>debian</tt>, which normally indicates that the upstream source
+ has been repackaged to comply with the Debian Free Software Guidelines
+ (or similar reason), but there is no version mangling in the
  <tt>debian/watch</tt> file.  Since the <tt>dfsg</tt> string is not
  part of the upstream version, the <tt>debian/watch</tt> file should
- normally use the dversionmangle option to remove the <tt>dfsg</tt> before
+ use the dversionmangle option to remove the <tt>dfsg</tt> before
  version number comparison.
+
+Tag: debian-watch-file-should-dversionmangle-not-uversionmangle
+Type: warning
+Ref: http://wiki.debian.org/DEHS
+Info: The version of this package contains <tt>dfsg</tt>, <tt>ds</tt>,
+ or <tt>debian</tt>, but a misleading upstream version mangling occurs in the
+ <tt>debian/watch</tt> file.  Since the upstream source code is not
+ <tt>dfsg</tt>-free as-is, the <tt>debian/watch</tt> file should
+ use the dversionmangle option to remove, instead of adding in uversionmangle,
+ the <tt>dfsg</tt> before version number comparison.
\ No newline at end of file

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: