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

[SCM] Debian package checker branch, master, updated. 2.2.13-17-gf71c127



The following commit has been merged in the master branch:
commit f8954243919b9dc3ab29402e67fd01828b1505e0
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Tue Jul 7 23:47:23 2009 -0500

    Fix false positives for watch file mangling
    
    The debian-watch-file-should-mangle-version check was not taking
    whether an upstream version was specified in the watch file or not,
    therefore producing false positives.
    
    Additionally, the check was being run on a global scope, even when
    multiple websites were being specified. This has been fixed and made
    those checks indicate the offending lines.

diff --git a/checks/watch-file b/checks/watch-file
index c3292b1..85cf6ce 100644
--- a/checks/watch-file
+++ b/checks/watch-file
@@ -52,7 +52,7 @@ if ($version =~ /(dfsg|debian|ds)/) {
 # diagnose on the first time through.
 open(WATCH, '<', 'debfiles/watch') or fail("cannot open watch file: $!");
 local $_;
-my ($watchver, $mangle, $dmangle, $nonempty, %dversions);
+my ($watchver, %dversions);
 while (<WATCH>) {
     next if /^\s*\#/;
     next if /^\s*$/;
@@ -76,8 +76,6 @@ while (<WATCH>) {
             tag 'debian-watch-file-unknown-version', $watchver;
         }
     } else {
-        $nonempty = 1;
-
         unless (defined($watchver)) {
             tag 'debian-watch-file-missing-version';
             $watchver = 1;
@@ -85,6 +83,7 @@ while (<WATCH>) {
         # Version 1 watch files are too broken to try checking them.
         next if ($watchver == 1);
 
+        my ($mangle, $dmangle) = (0, 0);
         my ($opts, @opts);
         if (s/^opt(?:ion)?s=\"([^\"]+)\"\s+// || s/^opt(?:ion)?s=(\S+)\s+//) {
             $opts = $1;
@@ -117,20 +116,21 @@ while (<WATCH>) {
             (undef, $lastversion, $action) = split ' ', $_, 3;
         }
         push @{$dversions{$lastversion}}, $. if (defined($lastversion));
+        $lastversion = 'debian' unless (defined($lastversion));
+
+        my $needs_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) {
+            tag 'debian-watch-file-should-mangle-version', "line $.";
+        }
+        if ($needs_mangling and $mangle and not $dmangle) {
+            tag 'debian-watch-file-should-dversionmangle-not-uversionmangle', "line $.";
+        }
     }
 }
 close WATCH;
 
-# If the version of the package contains dfsg, assume that it needs to be
-# mangled to get reasonable matches with upstream.
-if ($nonempty and $repack and not $mangle) {
-    tag 'debian-watch-file-should-mangle-version';
-}
-
-if ($repack and $mangle and not $dmangle) {
-    tag 'debian-watch-file-should-dversionmangle-not-uversionmangle';
-}
-
 my $changes = $info->changelog;
 if (defined $changes and %dversions) {
     my $data = $changes->data;
diff --git a/t/tests/watch-file-should-mangle/debian/debian/watch b/t/tests/watch-file-should-mangle/debian/debian/watch
index 92203ca..0032647 100644
--- a/t/tests/watch-file-should-mangle/debian/debian/watch
+++ b/t/tests/watch-file-should-mangle/debian/debian/watch
@@ -3,3 +3,9 @@
 
 version=2
 http://www.example.com/dist/ dh7-test\.([\d.]+)\.tar\.gz debian uupdate
+
+# version mangling is not needed in this case:
+http://www.example.com/dist/ dh7-test\.([\d.]+)\.tar\.gz 0.24 uupdate
+
+# version mangling *is* needed in this case:
+http://www.example.com/dist/ dh7-test\.([\d.]+)\.tar\.gz
diff --git a/t/tests/watch-file-should-mangle/tags b/t/tests/watch-file-should-mangle/tags
index 8e3a451..6be9d9e 100644
--- a/t/tests/watch-file-should-mangle/tags
+++ b/t/tests/watch-file-should-mangle/tags
@@ -1 +1,2 @@
-W: watch-file-should-mangle source: debian-watch-file-should-mangle-version
+W: watch-file-should-mangle source: debian-watch-file-should-mangle-version line 11
+W: watch-file-should-mangle source: debian-watch-file-should-mangle-version line 5

-- 
Debian package checker


Reply to: