commit:     4c91986e5fce707aa2bd1cd6fb6a912bb152179c
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jun  2 10:11:48 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun  5 11:22:05 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c91986e

isolated-functions.sh: store the MAKETOPTS-parsing ERE in a variable

Store the extended regular expression used for parsing MAKEOPTS in a
variable. While there is no compelling technical reason to do so, it
does make for a slightly more pleasant viewing and editing experience.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/isolated-functions.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index fefc0d2ab7..35b0e1cd2c 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -494,9 +494,11 @@ if [[ -z ${XARGS} ]] ; then
 fi
 
 ___makeopts_jobs() {
-       local jobs
+       local ere jobs
 
-       if [[ " ${MAKEOPTS} " =~ 
.*[[:space:]](-[^j]*j[[:space:]]*|--jobs(=|[[:space:]]+))([0-9]+)[[:space:]] 
]]; then
+       
ere='.*[[:space:]](-[^j]*j[[:space:]]*|--jobs(=|[[:space:]]+))([0-9]+)[[:space:]]'
+
+       if [[ " ${MAKEOPTS} " =~ $ere ]]; then
                jobs=${BASH_REMATCH[3]}
        elif jobs=$({ getconf _NPROCESSORS_ONLN || sysctl -n hw.ncpu; } 
2>/dev/null); then
                :

Reply via email to