From 709e720caa66816f32c6adc6050549fa40b9cf52 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 8 Sep 2017 12:40:48 +0200 Subject: use spatch's built-in concurrency Signed-off-by: Johannes Berg --- gentree.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'gentree.py') diff --git a/gentree.py b/gentree.py index 026afdc2..7d3f4a4f 100755 --- a/gentree.py +++ b/gentree.py @@ -5,6 +5,7 @@ import argparse, sys, os, errno, shutil, re, subprocess import tarfile, gzip +from multiprocessing import cpu_count # find self source_dir = os.path.abspath(os.path.dirname(__file__)) @@ -584,13 +585,18 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda prefix_len = len(os.path.join(source_dir, patch_src)) + 1 for cocci_file in sempatches: - # Until Coccinelle picks this up - pycocci = os.path.join(source_dir, 'devel/pycocci') - cmd = [pycocci, cocci_file] + cmd = ['spatch', + '--sp-file', cocci_file, + '--in-place', + '--recursive-includes', + '--relax-include-path', + '--use-coccigrep', + '--timeout', '120', + '-j', '%d' % cpu_count(), + '--dir', os.path.abspath(target_dir) ] extra_spatch_args = [] if args.profile_cocci: - cmd.append('--profile-cocci') - cmd.append(os.path.abspath(target_dir)) + cmd.append('--profile') print_name = cocci_file[prefix_len:] if args.verbose: logwrite("Applying SmPL patch %s" % print_name) -- cgit v1.2.3