summaryrefslogtreecommitdiff
path: root/mdbp/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'mdbp/common.py')
-rw-r--r--mdbp/common.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/mdbp/common.py b/mdbp/common.py
index 77cbd33..097c7a3 100644
--- a/mdbp/common.py
+++ b/mdbp/common.py
@@ -7,6 +7,7 @@ import contextlib
import hashlib
import importlib.resources
import json
+import multiprocessing
import pathlib
import tempfile
import typing
@@ -57,8 +58,14 @@ def compute_env(build: JsonObject) -> typing.Dict[str, str]:
"""Compute the process environment from the build object."""
env = dict(PATH="/usr/bin:/bin")
env.update(build.get("environment", {}))
- if build.get("options"):
- env["DEB_BUILD_OPTIONS"] = " ".join(build["options"])
+ parallel = build.get("parallel")
+ if parallel == "auto":
+ parallel = "%d" % multiprocessing.cpu_count()
+ options = build.get("options", [])
+ if parallel:
+ options.append("parallel=" + parallel)
+ if options:
+ env["DEB_BUILD_OPTIONS"] = " ".join(options)
return env
class HashSumMismatch(Exception):