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

[SCM] Debian package checker branch, master, updated. 9b076d8deddc678f2f04dc57455972383cff02ce



The following commit has been merged in the master branch:
commit 9b076d8deddc678f2f04dc57455972383cff02ce
Author: Russ Allbery <rra@debian.org>
Date:   Thu Jun 26 13:58:14 2008 -0700

    More watch test improvements
    
    * checks/watch-file{,.desc}:
      + [RA] Warn about watch files in native packages and check those watch
        files for other problems anyway.  Allow whitespace around the
        version declaration.  More correctly handle continuation lines.
        Patch from Raphael Geissert.

diff --git a/checks/watch-file b/checks/watch-file
index 14edf80..01dbfdf 100644
--- a/checks/watch-file
+++ b/checks/watch-file
@@ -31,65 +31,76 @@ my $pkg = shift;
 my $type = shift;
 my $info = shift;
 
-unless ($info->native) {
-    unless (-f "debfiles/watch") {
-        tag 'debian-watch-file-is-missing';
-        return;
-    }
+if (! -f "debfiles/watch") {
+    tag 'debian-watch-file-is-missing' unless ($info->native);
+    return;
+}
+
+# Perform the other checks even if it is a native package
+tag 'debian-watch-file-in-native-package' if ($info->native);
+
+# Check if the Debian version contains anything that resembles a repackaged
+# source package sign, for fine grained version mangling check
+my $version = $info->field('version');
+my $repack;
+if ($version =~ /(dfsg|debian|ds)/) {
+    $repack = $1;
+}
 
-    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
-    my $repack;
-    if ($version =~ /(dfsg|debian|ds)/) {
-        $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, $dmangle);
+while (<WATCH>) {
+    next if /^\s*\#/;
+    next if /^\s*$/;
+    s/^\s*//;
+    if (s/(?<!\\)\\$//) {
+        # This is caught by uscan.
+        last if eof(WATCH);
+        $_ .= <WATCH>;
     }
 
-    # 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, $dmangle);
-    while (<WATCH>) {
-        next if /^\s*\#/;
-        next if /^\s*$/;
-        if (/^version=(\d+)(\s|\Z)/) {
-            if (defined $watchver) {
-                tag 'debian-watch-file-declares-multiple-versions', "line $.";
-            }
-            $watchver = $1;
-            if ($watchver ne '2' and $watchver ne '3') {
-                tag 'debian-watch-file-unknown-version', $watchver;
-            }
-        } else {
-            unless ($watchver) {
-                tag 'debian-watch-file-missing-version';
-                $watchver = 1;
-            }
-            while (s/\\\s*$//) {
-                $_ .= <WATCH>;
-            }
-            chomp;
-            my ($opts, @opts);
-            if (s/^opts=\"([^\"]+)\"// || s/^opts=(\S+)\s*//) {
-                $opts = $1;
-                @opts = split(',', $opts);
-                $mangle = 1 if grep { /^[ud]versionmangle.*=.*($repack)/ } @opts;
-                $dmangle = 1 if grep { /^dversionmangle.*=.*($repack)/ } @opts;
+    if (/^version\s*=\s*(\d+)(\s|\Z)/) {
+        if (defined $watchver) {
+            tag 'debian-watch-file-declares-multiple-versions', "line $.";
+        }
+        $watchver = $1;
+        if ($watchver ne '2' and $watchver ne '3') {
+            tag 'debian-watch-file-unknown-version', $watchver;
+        }
+    } else {
+        unless (defined($watchver)) {
+            tag 'debian-watch-file-missing-version';
+            $watchver = 1;
+        }
+        while (s/\\\s*$//) {
+            $_ .= <WATCH>;
+        }
+        chomp;
+        my ($opts, @opts);
+        if (s/^opt(ion)?s=\"([^\"]+)\"\s+// || s/^opt(ion)?s=(\S+)\s+//) {
+            $opts = $2;
+            @opts = split(',', $opts);
+            if (defined $repack) {
+                for (@opts) {
+                    $mangle = 1 if /^[ud]versionmangle.*=.*($repack)/;
+                    $dmangle = 1 if /^dversionmangle.*=.*($repack)/;
+                }
             }
         }
     }
-    close WATCH;
-
-    # If the version of the package contains dfsg, assume that it needs to be
-    # mangled to get reasonable matches with upstream.
-    if ($repack and not $mangle) {
-        tag 'debian-watch-file-should-mangle-version';
-    }
+}
+close WATCH;
 
-    if ($repack and $mangle and not $dmangle) {
-        tag 'debian-watch-file-should-dversionmangle-not-uversionmangle';
-    }
+# If the version of the package contains dfsg, assume that it needs to be
+# mangled to get reasonable matches with upstream.
+if ($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';
 }
 
 }
diff --git a/checks/watch-file.desc b/checks/watch-file.desc
index 4ed9fd6..4ab8b0a 100644
--- a/checks/watch-file.desc
+++ b/checks/watch-file.desc
@@ -56,8 +56,17 @@ Tag: debian-watch-file-should-dversionmangle-not-uversionmangle
 Type: info
 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.
+ or <tt>debian</tt>, but a misleading upstream version mangling occurs in
+ the <tt>debian/watch</tt> file.  Since the <tt>dfsg</tt> string is not
+ part of the upstream version and its addition is Debian-specific, the
+ the <tt>debian/watch</tt> file should use the dversionmangle option to
+ remove, instead of adding in uversionmangle, the <tt>dfsg</tt> before
+ comparing version numbers.
+
+Tag: debian-watch-file-in-native-package
+Type: warning
+Ref: http://wiki.debian.org/DEHS
+Info: The package ships a watch file although it is a Debian native
+ package.  DEHS does not process watch files in native packages based on
+ the reasoning that native packages do not have upstreams to check for new
+ releases.
diff --git a/debian/changelog b/debian/changelog
index e7c6081..88420ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -33,6 +33,10 @@ lintian (1.24.2) unstable; urgency=low
       number.  Issue an info tag if the watch file uses
       uversionsmangle to add the Debian specific string. Patch
       by Raphael Geissert.  (Closes: #485879)
+    + [RA] Warn about watch files in native packages and check those watch
+      files for other problems anyway.  Allow whitespace around the
+      version declaration.  More correctly handle continuation lines.
+      Patch from Raphael Geissert.
 
   * data/fields/obsolete-packages:
     + [RA] mailx is not obsolete.  It's a virtual package.  Thanks, martin
diff --git a/testset/foo++/debian/watch b/testset/foo++/debian/watch
new file mode 100644
index 0000000..26f9a3c
--- /dev/null
+++ b/testset/foo++/debian/watch
@@ -0,0 +1,6 @@
+# A comment \
+version=0
+
+# uscan does not interpret the backslash above, it is just part of the comment
+
+http://domain.tld/file-(.*)\.tar\.gz
diff --git a/testset/maintainer-scripts/debian/changelog b/testset/maintainer-scripts/debian/changelog
index 0f8063d..a0c6dc5 100644
--- a/testset/maintainer-scripts/debian/changelog
+++ b/testset/maintainer-scripts/debian/changelog
@@ -1,4 +1,4 @@
-maintainer-scripts (7-0.1) unstable; urgency=low
+maintainer-scripts (7+dfsg-0.1) unstable; urgency=low
 
   * Doing an upload for QA  but I fail to give it a correct version number,
     have some uploaders, and also fail to mention it... Bad me ;)
diff --git a/testset/maintainer-scripts/debian/watch b/testset/maintainer-scripts/debian/watch
new file mode 100644
index 0000000..982696c
--- /dev/null
+++ b/testset/maintainer-scripts/debian/watch
@@ -0,0 +1,11 @@
+# A whitespace is fine for uscan:
+ version=4
+
+# Following line should not be matched:
+#opts=uversionmangle=s/$/+debian/,dversionmangle=s/foo/bar/ \
+# Following one is incorrect, there's a missing backslash at the end
+opts=uversionmangle=s/$/+dfsg/,dversionmangle=s/foo/bar/
+
+# 'active' is useless here, but it works anyway
+options=active \
+http://domain.tld/foo-(.+)\.tar\.gz
\ No newline at end of file
diff --git a/testset/tags.foo++ b/testset/tags.foo++
index 43a1477..3a1ff76 100644
--- a/testset/tags.foo++
+++ b/testset/tags.foo++
@@ -15,6 +15,8 @@ E: foo++: no-copyright-file
 E: foo++: wrong-debian-qa-address-set-as-maintainer Lintian Maintainer <debian-qa@lists.debian.org>
 I: foo++: no-md5sums-control-file
 W: foo++ source: ancient-standards-version 3.1.1 (current is 3.8.0)
+W: foo++ source: debian-watch-file-in-native-package
+W: foo++ source: debian-watch-file-unknown-version 0
 W: foo++ source: uploader-address-looks-weird Jeroen van Wolffelaar<jeroen@localhost.localdomain>
 W: foo++ source: uploader-not-full-name Frank
 W: foo++ source: uploader-not-full-name Josip
diff --git a/testset/tags.maintainer-scripts b/testset/tags.maintainer-scripts
index 8ffbf7d..203060d 100644
--- a/testset/tags.maintainer-scripts
+++ b/testset/tags.maintainer-scripts
@@ -30,8 +30,11 @@ I: maintainer-scripts: no-md5sums-control-file
 I: maintainer-scripts: output-of-updaterc.d-not-redirected-to-dev-null bar postrm
 W: maintainer-scripts source: ancient-standards-version 3.1.1 (current is 3.8.0)
 W: maintainer-scripts source: changelog-should-mention-qa
+W: maintainer-scripts source: debian-watch-file-in-native-package
+W: maintainer-scripts source: debian-watch-file-should-mangle-version
+W: maintainer-scripts source: debian-watch-file-unknown-version 4
 W: maintainer-scripts source: package-uses-deprecated-debhelper-compat-version 1
-W: maintainer-scripts source: qa-upload-has-incorrect-version-number 7-0.1
+W: maintainer-scripts source: qa-upload-has-incorrect-version-number 7+dfsg-0.1
 W: maintainer-scripts: ancient-dpkg-epoch-check preinst:8
 W: maintainer-scripts: ancient-dpkg-long-filenames-check preinst:9
 W: maintainer-scripts: ancient-dpkg-multi-conrep-check preinst:10

-- 
Debian package checker


Reply to: