commit: 1bb1f5dc09f870558703fedbbb7d282830bf4251 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Thu Jul 28 01:19:41 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Aug 1 22:38:11 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1bb1f5dc
isolated-functions.sh: sync ___makeopts_jobs with multiprocessing.eclass Signed-off-by: Sam James <sam <AT> gentoo.org> Closes: https://github.com/gentoo/portage/pull/871 Signed-off-by: Sam James <sam <AT> gentoo.org> bin/isolated-functions.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 4542c6715..0efcd5a7d 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -470,10 +470,11 @@ if [[ -z ${XARGS} ]] ; then fi ___makeopts_jobs() { - # Copied from eutils.eclass:makeopts_jobs() - local jobs - jobs=$(echo " ${MAKEOPTS} " | \ - sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p') || die + # Copied from multiprocessing.eclass: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 " ${MAKEOPTS} " | sed -r -n \ + -e 's:.*[[:space:]](-[a-z]*j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' || die) echo ${jobs:-1} }