Parcourir la source

dpkg-source: accept patches with missing context at the end

* scripts/Dpkg/Source/Patch.pm (analyze): Accept unexpected
end-of-file in patches if we're missing no more than 2 lines
of context. Output a warning instead.
Raphael Hertzog il y a 18 ans
Parent
commit
808ff71b82
2 fichiers modifiés avec 12 ajouts et 1 suppressions
  1. 6 0
      ChangeLog
  2. 6 1
      scripts/Dpkg/Source/Patch.pm

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2008-06-07  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/Dpkg/Source/Patch.pm (analyze): Accept unexpected
+	end-of-file in patches if we're missing no more than 2 lines
+	of context. Output a warning instead.
+
 2008-06-07  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/Dpkg/Source/Package/V3/quilt.pm (register_autopatch):

+ 6 - 1
scripts/Dpkg/Source/Patch.pm

@@ -368,7 +368,12 @@ sub analyze {
 	    # read hunk
 	    while ($olines || $nlines) {
 		unless (defined($_ = getline($diff_handle))) {
-		    error(_g("unexpected end of diff `%s'"), $diff);
+                    if (($olines == $nlines) and ($olines < 3)) {
+                        warning(_g("unexpected end of diff `%s'"), $diff);
+                        last;
+                    } else {
+                        error(_g("unexpected end of diff `%s'"), $diff);
+                    }
 		}
 		next if /^\\ No newline/;
 		# Check stats