diff options
author | Michał Górny <mgorny@gentoo.org> | 2016-12-13 09:57:46 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2016-12-18 14:45:43 +0100 |
commit | 639d76a02d2965f426944f7fa6d0259a99a613f9 (patch) | |
tree | 965dd1e87e9e1c4a5682236de0045a1b47ec743e /eclass/multiprocessing.eclass | |
parent | net-misc/aria2: Bump to 1.30.0 (diff) | |
download | gentoo-639d76a02d2965f426944f7fa6d0259a99a613f9.tar.gz gentoo-639d76a02d2965f426944f7fa6d0259a99a613f9.tar.bz2 gentoo-639d76a02d2965f426944f7fa6d0259a99a613f9.zip |
multiprocessing.eclass: Fix handling multiple short options (e.g. -kj)
Improve the regular expressions to handle parameters consisting of
multiple short options (such as -kj). It should be noted that the code
is not perfect but should handle all common (valid) cases; it could e.g.
incorrectly process a short option followed by string arg such as
'-Wfoo.j' although having this in MAKEOPTS is extremely unlikely.
Diffstat (limited to 'eclass/multiprocessing.eclass')
-rw-r--r-- | eclass/multiprocessing.eclass | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass index 06e004aa1669..5a5fe9acb56a 100644 --- a/eclass/multiprocessing.eclass +++ b/eclass/multiprocessing.eclass @@ -67,8 +67,8 @@ makeopts_jobs() { # This assumes the first .* will be more greedy than the second .* # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). local jobs=$(echo " $* " | sed -r -n \ - -e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ - -e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p') + -e 's:.*[[:space:]](-[a-z]*j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ + -e 's:.*[[:space:]](-[a-z]*j|--jobs)[[:space:]].*:999:p') echo ${jobs:-1} } @@ -86,8 +86,8 @@ 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|max-load)[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+).*:\3:p' \ - -e 's:.*[[:space:]](-l|--(load-average|max-load))[[:space:]].*:999:p') + -e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+).*:\3:p' \ + -e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:999:p') # Default to 999 since the default is to not use a load limit. echo ${lavg:-999} } |