Procházet zdrojové kódy

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 před 10 roky
rodič
revize
4313ec68d8
2 změnil soubory, kde provedl 7 přidání a 2 odebrání
  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
     - Make patching a file multiple times fatal for the first quilt patch in
       Dpkg::Source. Reported by Apollon Oikonomopoulos <apoikos@debian.org>.
       Dpkg::Source. Reported by Apollon Oikonomopoulos <apoikos@debian.org>.
       Closes: #810720
       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:
   * Documentation:
     - Say value instead of option in deb-control(5).
     - Say value instead of option in deb-control(5).
     - Mark debian changelog format in bold in dpkg-parsechangelog(1).
     - 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}) {
 	if ($filepatched{$fn}) {
+            $filepatched{$fn}++;
+
             if ($opts{fatal_dupes}) {
             if ($opts{fatal_dupes}) {
                 error(g_("diff '%s' patches files multiple times; split the " .
                 error(g_("diff '%s' patches files multiple times; split the " .
                          "diff in multiple files or merge the hunks into a " .
                          "diff in multiple files or merge the hunks into a " .
                          "single one"), $diff);
                          "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 {
 	} else {
 	    $filepatched{$fn} = 1;
 	    $filepatched{$fn} = 1;