From 765e071c0ca67bccfdc17e6d32c92b8d274cc008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 1 Oct 2026 14:28:41 -0400 Subject: [PATCH] mutate.py: cores from OMAPHOTO_CPUS, 32 by default --- scripts/mutate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/mutate.py b/scripts/mutate.py index 22dc8c7..b2aca48 100755 --- a/scripts/mutate.py +++ b/scripts/mutate.py @@ -23,13 +23,15 @@ if not os.path.isfile(os.path.join(repo, 'CMakeLists.txt')): sys.exit('run mutate.py from the repository root') original = open(args.path).read() targets = [t for t in args.targets.split(',') if t] +# Cores for docker and the build, shared by parallel workers. +cpus = os.environ.get('OMAPHOTO_CPUS', '32') def docker(command): uid, gid = os.getuid(), os.getgid() runtime = '/run/user/%d' % uid done = subprocess.run( - ['docker', 'run', '--rm', '--init', '--cpus=32', '-u', '%d:%d' % (uid, gid), '-e', 'HOME=/tmp', '-e', 'QT_QPA_PLATFORM=offscreen', + ['docker', 'run', '--rm', '--init', '--cpus=' + cpus, '-u', '%d:%d' % (uid, gid), '-e', 'HOME=/tmp', '-e', 'QT_QPA_PLATFORM=offscreen', '--tmpfs', '%s:uid=%d,gid=%d,mode=0700' % (runtime, uid, gid), '-e', 'XDG_RUNTIME_DIR=' + runtime, '-v', '%s:%s' % (repo, repo), '-w', repo, 'omaphoto-dev', 'timeout', '600', 'sh', '-c', command], capture_output=True, text=True) @@ -38,7 +40,7 @@ def docker(command): def build(): wanted = ' --target ' + ' '.join(targets) if targets else '' - return docker('cmake -S . -B build -G Ninja -DOMAPHOTO_WERROR=ON >/dev/null && cmake --build build -j32' + wanted) + return docker('cmake -S . -B build -G Ninja -DOMAPHOTO_WERROR=ON >/dev/null && cmake --build build -j' + cpus + wanted) def test():