From f8acf446eaf3cddd2678ea504ffcf63bb0b83f43 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 2 Sep 2015 06:55:43 +0200 Subject: [PATCH] patchupdate.py: Fix a bug in the code to generate IfDefined patch files, show more useful error messages. --- debian/tools/patchupdate.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/debian/tools/patchupdate.py b/debian/tools/patchupdate.py index 863106a9..4e1fd89e 100755 --- a/debian/tools/patchupdate.py +++ b/debian/tools/patchupdate.py @@ -489,12 +489,26 @@ def generate_ifdefined(all_patches): # Reconstruct the state after applying the dependencies original = get_wine_file(f) - for _, (_, p) in select_patches(enabled_patches, depends, f).iteritems(): - original = patchutils.apply_patch(original, p, fuzz=0) + selected_patches = select_patches(enabled_patches, depends, f) + failed = [] + + try: + for j in depends: + failed.append(j) + original = patchutils.apply_patch(original, selected_patches[j][1], fuzz=0) + except patchutils.PatchApplyError: + raise PatchUpdaterError("Changes to file %s don't apply: %s" % + (f, ", ".join([all_patches[j].name for j in failed]))) # Now apply the main patch p = extract_patch(patch, f)[1] - patched = patchutils.apply_patch(original, p, fuzz=0) + + try: + failed.append(i) + patched = patchutils.apply_patch(original, p, fuzz=0) + except patchutils.PatchApplyError: + raise PatchUpdaterError("Changes to file %s don't apply: %s" % + (f, ", ".join([all_patches[j].name for j in failed]))) # Now get the diff between both diff = patchutils.generate_ifdef_patch(original, patched, ifdef=patch.ifdefined)