From 93a91a1f112a13c705046fb089cad2664e0706c9 Mon Sep 17 00:00:00 2001 From: Luca Coelho Date: Tue, 21 Jun 2016 15:34:34 +0300 Subject: gentree: don't throw exceptions when applying patches fail In commit 4e84c2d807d5 ("backports: move legacy and SmPL patch application into helper"), the functionality was changed by raising exceptions instead of return an error when applying patches fail. This breaks git-tracker, because it expects errors to be returned in such cases, to exit gracefully and print the error messages. Fixes: 4e84c2d807d5 ("backports: move legacy and SmPL patch application into helper") Signed-off-by: Luca Coelho Signed-off-by: Johannes Berg --- gentree.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gentree.py b/gentree.py index 186a4147..f2d98cf1 100755 --- a/gentree.py +++ b/gentree.py @@ -549,7 +549,7 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda logwrite("Failed to apply changes from %s" % print_name) for line in output: logwrite('> %s' % line) - raise Exception('Patch failed') + return 2 if args.refresh: pfilef = open(pfile + '.tmp', 'a') @@ -569,7 +569,7 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda logwrite("Failed to diff to refresh %s" % print_name) pfilef.close() os.unlink(pfile + '.tmp') - raise Exception('Refresh failed') + return 2 pfilef.close() os.rename(pfile + '.tmp', pfile) @@ -602,7 +602,7 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda sprocess.wait() if sprocess.returncode != 0: logwrite("Failed to process SmPL patch %s with %i" % (print_name, sprocess.returncode)) - raise Exception('SmPL patch failed') + return 2 output = output.split('\n') if output[-1] == '': output = output[:-1] @@ -903,7 +903,9 @@ def process(kerneldir, copy_list_file, git_revision=None, bpcfg.disable_symbols(disable_list) git_debug_snapshot(args, 'Add automatic backports') - apply_patches(args, "backport", source_dir, 'patches', bpid.target_dir, logwrite) + failure = apply_patches(args, "backport", source_dir, 'patches', bpid.target_dir, logwrite) + if failure: + return failure # Kernel integration requires Kconfig.versions already generated for you, # we cannot do this for a package as we have no idea what kernel folks @@ -1074,8 +1076,10 @@ def process(kerneldir, copy_list_file, git_revision=None, f.close() git_debug_snapshot(args, "hooked backport to top level Kconfig") - apply_patches(args, "integration", source_dir, 'integration-patches/', - bpid.project_dir, logwrite) + failure = apply_patches(args, "integration", source_dir, 'integration-patches/', + bpid.project_dir, logwrite) + if failure: + return failure if (args.kup or args.kup_test): req = reqs.Req() -- cgit v1.2.3