diff options
author | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2014-04-15 22:48:26 +0000 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2014-04-17 16:23:09 -0700 |
commit | ee6dd7b99be6209c9b7bef8b4b176ca8be1b3af7 (patch) | |
tree | 895e1fc3182512521e42f1140d33780ed3c3bec5 /gentree.py | |
parent | ecec075043a34fa0e88c2716c5f4eca3782f7ca3 (diff) |
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 <peter.senna@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Diffstat (limited to 'gentree.py')
-rwxr-xr-x | gentree.py | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -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] |