summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-11-24 12:02:31 -0500
committerMike Frysinger <vapier@gentoo.org>2015-11-24 12:03:49 -0500
commitddd7a0bc1e06c0f7737799b784c110b7903f0a58 (patch)
tree7bb4daf0fd0283b464e61501104c674173ce4634 /eclass/multiprocessing.eclass
parentapp-emulation/docker: version bump, fixes #566432 (diff)
downloadgentoo-ddd7a0bc1e06c0f7737799b784c110b7903f0a58.tar.gz
gentoo-ddd7a0bc1e06c0f7737799b784c110b7903f0a58.tar.bz2
gentoo-ddd7a0bc1e06c0f7737799b784c110b7903f0a58.zip
multiprocessing.eclass: makeopts_loadavg: various fixes #543116
- Add support for --max-load option - Fix default load value if not specified (999) - Fix trailing flag consumption so we don't leave garbage behind - Add tests!
Diffstat (limited to 'eclass/multiprocessing.eclass')
-rw-r--r--eclass/multiprocessing.eclass7
1 files changed, 4 insertions, 3 deletions
diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
index 534b35c56b96..06e004aa1669 100644
--- a/eclass/multiprocessing.eclass
+++ b/eclass/multiprocessing.eclass
@@ -86,9 +86,10 @@ makeopts_loadavg() {
# This assumes the first .* will be more greedy than the second .*
# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
local lavg=$(echo " $* " | sed -r -n \
- -e 's:.*[[:space:]](-l|--load-average[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+)[^0-9.]*:\2:p' \
- -e 's:.*[[:space:]](-l|--load-average)[[:space:]].*:999:p')
- echo ${lavg:-1}
+ -e 's:.*[[:space:]](-l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+).*:\3:p' \
+ -e 's:.*[[:space:]](-l|--(load-average|max-load))[[:space:]].*:999:p')
+ # Default to 999 since the default is to not use a load limit.
+ echo ${lavg:-999}
}
# @FUNCTION: multijob_init