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

one more tag for watch-file



Hi all,

Attached is a patch adding a check for empty watch files.

This tag has been added because of situations like #489050.

The patch also removes a lax attempt of handling line continuations and
improves the one I added a couple of days ago.

Cheers,
-- 
Atomo64 - Raphael

Please avoid sending me Word, PowerPoint or Excel attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
diff --git a/checks/watch-file b/checks/watch-file
index e3addb5..68e005d 100644
--- a/checks/watch-file
+++ b/checks/watch-file
@@ -52,14 +52,19 @@ if ($version =~ /(dfsg|debian|ds)/) {
 open(WATCH, '<', 'debfiles/watch') or fail("cannot open watch file: $!");
 local $_;
 my ($watchver, $mangle, $dmangle);
+my $empty = 1;
 while (<WATCH>) {
     next if /^\s*\#/;
     next if /^\s*$/;
     s/^\s*//;
+
+    CHOMP:
+    chomp;
     if (s/(?<!\\)\\$//) {
         # This is caught by uscan.
         last if eof(WATCH);
         $_ .= <WATCH>;
+	goto CHOMP;
     }
 
     if (/^version\s*=\s*(\d+)(\s|\Z)/) {
@@ -75,10 +80,8 @@ while (<WATCH>) {
             tag 'debian-watch-file-missing-version';
             $watchver = 1;
         }
-        while (s/\\\s*$//) {
-            $_ .= <WATCH>;
-        }
-        chomp;
+        $empty = 0;
+
         my ($opts, @opts);
         if (s/^opt(ion)?s=\"([^\"]+)\"\s+// || s/^opt(ion)?s=(\S+)\s+//) {
             $opts = $2;
@@ -107,6 +110,10 @@ if ($repack and $mangle and not $dmangle) {
     tag 'debian-watch-file-should-dversionmangle-not-uversionmangle';
 }
 
+if ($empty) {
+    tag "debian-watch-file-is-empty";
+}
+
 }
 
 1;
diff --git a/checks/watch-file.desc b/checks/watch-file.desc
index 339b3f4..1ee0136 100644
--- a/checks/watch-file.desc
+++ b/checks/watch-file.desc
@@ -77,3 +77,7 @@ Info: The watch file seems to be passing arguments to the redirector
  other than a path. Calling the SourceForge redirector with parameters like
  <tt>project</tt> prevents uscan from generating working uri's to the files
  and thus has been deprecated and is no longer supported by the redirector.
+
+Tag: debian-watch-file-is-empty
+Type: warning
+Info: The watch file is present but does not contain any URI to be checked.


Reply to: