From ee6dd7b99be6209c9b7bef8b4b176ca8be1b3af7 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Tue, 15 Apr 2014 22:48:26 +0000 Subject: backports: pycocci - make the Coccinelle wrapper a standalone tool This lets us share it for general use as a generic tool, we'll upkeep it here for now and if Coccinelle picks it up we can drop it and just require folks to install it. This lets us use the same solution for standard testing / regular development and also for backports without any discrepencies. Cc: Peter Senna Cc: Julia Lawall Cc: Gilles Muller Signed-off-by: Luis R. Rodriguez --- gentree.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'gentree.py') diff --git a/gentree.py b/gentree.py index b890d28e..44acb9a1 100755 --- a/gentree.py +++ b/gentree.py @@ -14,7 +14,6 @@ from lib import kconfig, patch, make from lib import bpgit as git from lib import bpgpg as gpg from lib import bpkup as kup -from lib import bpcoccinelle as coccinelle from lib.tempdir import tempdir def read_copy_list(copyfile): @@ -712,16 +711,25 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, prefix_len = len(os.path.join(source_dir, 'patches')) + 1 for cocci_file in sempatches: + # Until Coccinelle picks this up + pycocci = os.path.join(source_dir, 'devel/pycocci') + cmd = [pycocci, cocci_file] extra_spatch_args = [] if args.profile_cocci: - extra_spatch_args.append('--profile') + cmd.append('--profile-cocci') + cmd.append(args.outdir) print_name = cocci_file[prefix_len:] if args.verbose: logwrite("Applying SmPL patch %s" % print_name) - - output = coccinelle.threaded_spatch(cocci_file, args.outdir, - logwrite, print_name, - extra_args=extra_spatch_args) + sprocess = subprocess.Popen(cmd, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + close_fds=True, universal_newlines=True, + cwd=args.outdir) + output = sprocess.communicate()[0] + sprocess.wait() + if sprocess.returncode != 0: + logwrite("Failed to process SmPL patch %s" % print_name) + return 3 output = output.split('\n') if output[-1] == '': output = output[:-1] -- cgit v1.2.3