1 |
commit: 1bb1f5dc09f870558703fedbbb7d282830bf4251 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jul 28 01:19:41 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 1 22:38:11 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1bb1f5dc |
7 |
|
8 |
isolated-functions.sh: sync ___makeopts_jobs with multiprocessing.eclass |
9 |
|
10 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
11 |
Closes: https://github.com/gentoo/portage/pull/871 |
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
bin/isolated-functions.sh | 9 +++++---- |
15 |
1 file changed, 5 insertions(+), 4 deletions(-) |
16 |
|
17 |
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh |
18 |
index 4542c6715..0efcd5a7d 100644 |
19 |
--- a/bin/isolated-functions.sh |
20 |
+++ b/bin/isolated-functions.sh |
21 |
@@ -470,10 +470,11 @@ if [[ -z ${XARGS} ]] ; then |
22 |
fi |
23 |
|
24 |
___makeopts_jobs() { |
25 |
- # Copied from eutils.eclass:makeopts_jobs() |
26 |
- local jobs |
27 |
- jobs=$(echo " ${MAKEOPTS} " | \ |
28 |
- sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p') || die |
29 |
+ # Copied from multiprocessing.eclass:makeopts_jobs |
30 |
+ # This assumes the first .* will be more greedy than the second .* |
31 |
+ # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). |
32 |
+ local jobs=$(echo " ${MAKEOPTS} " | sed -r -n \ |
33 |
+ -e 's:.*[[:space:]](-[a-z]*j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' || die) |
34 |
echo ${jobs:-1} |
35 |
} |