Package: lintian Version: 2.3.4 Severity: wishlist Tags: patch The watch file business of dversionmangle and uversionmangle can occasionally be confusing, so I propose another check to help people along. People might do something like this
opts=dversionmangle=s/~rc/-rc/ but I finally figured out that one should do opts=uversionmangle=s/-rc/~rc/ instead so that the final release after the rc is sorted correctly by uscan. Since there is already another check that addresses a similar but opposite case, I think this would be a useful addition. Let me know what you think.
diff --git a/checks/watch-file b/checks/watch-file index a9f4bfa..aa11b7a 100644 --- a/checks/watch-file +++ b/checks/watch-file @@ -47,6 +47,10 @@ my $repack; if ($version =~ /(dfsg|debian|ds)/) { $repack = $1; } +my $prerelease; +if ($version =~ /(alpha|beta|rc)/i) { + $prerelease = $1; +} # Gather information from the watch file and look for problems we can # diagnose on the first time through. @@ -83,15 +87,17 @@ while (<WATCH>) { # Version 1 watch files are too broken to try checking them. next if ($watchver == 1); - my ($mangle, $dmangle) = (0, 0); + my ($repack_mangle, $repack_dmangle, $prerelease_mangle, $prerelease_umangle) = (0, 0, 0, 0); my ($opts, @opts); if (s/^opt(?:ion)?s=\"([^\"]+)\"\s+// || s/^opt(?:ion)?s=(\S+)\s+//) { $opts = $1; @opts = split(',', $opts); - if (defined $repack) { + if (defined $repack or defined $prerelease) { for (@opts) { - $mangle = 1 if /^[ud]?versionmangle\s*=.*($repack)/; - $dmangle = 1 if /^dversionmangle\s*=.*($repack)/; + $repack_mangle = 1 if defined $repack and /^[ud]?versionmangle\s*=.*($repack)/; + $repack_dmangle = 1 if defined $repack and /^dversionmangle\s*=.*($repack)/; + $prerelease_mangle = 1 if defined $prerelease and /^[ud]?versionmangle\s*=.*($prerelease)/; + $prerelease_umangle = 1 if defined $prerelease and /^uversionmangle\s*=.*($prerelease)/; } } } @@ -118,15 +124,20 @@ while (<WATCH>) { push @{$dversions{$lastversion}}, $. if (defined($lastversion)); $lastversion = 'debian' unless (defined($lastversion)); - my $needs_mangling = ($repack and $lastversion eq 'debian'); + my $needs_repack_mangling = ($repack and $lastversion eq 'debian'); # If the version of the package contains dfsg, assume that it needs # to be mangled to get reasonable matches with upstream. - if ($needs_mangling and not $mangle) { + if ($needs_repack_mangling and not $repack_mangle) { tag 'debian-watch-file-should-mangle-version', "line $."; } - if ($needs_mangling and $mangle and not $dmangle) { + if ($needs_repack_mangling and $repack_mangle and not $repack_dmangle) { tag 'debian-watch-file-should-dversionmangle-not-uversionmangle', "line $."; } + + my $needs_prerelease_mangling = ($prerelease and $lastversion eq 'debian'); + if ($needs_prerelease_mangling and $prerelease_mangle and not $prerelease_umangle) { + tag 'debian-watch-file-should-uversionmangle-not-dversionmangle', "line $."; + } } } close WATCH; diff --git a/checks/watch-file.desc b/checks/watch-file.desc index 454dc61..5f8b607 100644 --- a/checks/watch-file.desc +++ b/checks/watch-file.desc @@ -73,6 +73,16 @@ Info: The version of this package contains <tt>dfsg</tt>, <tt>ds</tt>, remove, instead of adding in uversionmangle, the <tt>dfsg</tt> before comparing version numbers. +Tag: debian-watch-file-should-uversionmangle-not-dversionmangle +Severity: wishlist +Certainty: certain +Ref: http://wiki.debian.org/DEHS +Info: The version of this package contains <tt>alpha</tt>, <tt>beta</tt>, + or <tt>rc</tt>, but a misleading Debian version mangling occurs in + the <tt>debian/watch</tt> file. You should use the uversionmangle + option instead of dversionmangle so that the prerelease is sorted by + uscan before a possible future final release. + Tag: debian-watch-file-in-native-package Severity: normal Certainty: certain diff --git a/debian/changelog b/debian/changelog index 85bd7ba..a42669f 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -lintian (2.3.4) UNRELEASED; urgency=low +lintian (2.3.4~privatetest) UNRELEASED; urgency=low * Summary of tag changes: + Added: @@ -13,6 +13,7 @@ lintian (2.3.4) UNRELEASED; urgency=low - unknown-file-in-debian-source - unknown-source-format - unknown-locale-code + - debian-watch-file-should-uversionmangle-not-dversionmangle * checks/binaries: + [RA] Exclude packages from the klibc source package from the @@ -108,6 +109,8 @@ lintian (2.3.4) UNRELEASED; urgency=low + [RG] Don't warn about timewarp-standards-version when the changelog's distribution is "UNRELEASED." Thanks, Raphaƫl Hertzog. (Closes: #571616) + * checks/watch-file: + + [PE] New check debian-watch-file-should-uversionmangle-not-dversionmangle * collection/debfiles: + [RA] Simplify the logic since the entire debian directory is always