Browse Source

Dpkg::Source::Patch: Only warn once when a diff patches a file multiple times

Reword the warning message to make it clear that the diff might be
patching the file more than once, not just twice, which might be
incorrect. And only emit a single warning.
Guillem Jover 8 years ago
parent
commit
4313ec68d8
2 changed files with 7 additions and 2 deletions
  1. 3 0
      debian/changelog
  2. 4 2
      scripts/Dpkg/Source/Patch.pm

+ 3 - 0
debian/changelog

@@ -14,6 +14,9 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
     - Make patching a file multiple times fatal for the first quilt patch in
       Dpkg::Source. Reported by Apollon Oikonomopoulos <apoikos@debian.org>.
       Closes: #810720
+    - Only warn once when a diff patches a file multiple times in
+      Dpkg::Source::Patch, and fix the warning message to make it clear that
+      the diff might be patchig the file more than once, not just twice.
   * Documentation:
     - Say value instead of option in deb-control(5).
     - Mark debian changelog format in bold in dpkg-parsechangelog(1).

+ 4 - 2
scripts/Dpkg/Source/Patch.pm

@@ -491,12 +491,14 @@ sub analyze {
 	}
 
 	if ($filepatched{$fn}) {
+            $filepatched{$fn}++;
+
             if ($opts{fatal_dupes}) {
                 error(g_("diff '%s' patches files multiple times; split the " .
                          "diff in multiple files or merge the hunks into a " .
                          "single one"), $diff);
-            } elsif ($opts{verbose}) {
-                warning(g_("diff '%s' patches file %s twice"), $diff, $fn)
+            } elsif ($opts{verbose} and $filepatched{$fn} == 2) {
+                warning(g_("diff '%s' patches file %s more than once"), $diff, $fn)
             }
 	} else {
 	    $filepatched{$fn} = 1;