From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9948D158094 for ; Thu, 29 Sep 2022 20:45:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B8AF32BC056; Thu, 29 Sep 2022 20:45:48 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A44BA2BC056 for ; Thu, 29 Sep 2022 20:45:48 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C5B7F340DA1 for ; Thu, 29 Sep 2022 20:45:47 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F29215F7 for ; Thu, 29 Sep 2022 20:45:44 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1664484340.40d634fe925bda6b3c95067cb7d23f2bce32ce36.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: /, bin/ X-VCS-Repository: proj/portage X-VCS-Files: NEWS bin/isolated-functions.sh X-VCS-Directories: bin/ / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 40d634fe925bda6b3c95067cb7d23f2bce32ce36 X-VCS-Branch: master Date: Thu, 29 Sep 2022 20:45:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a50bbd18-1e88-4274-9a1b-48bea05164b7 X-Archives-Hash: 5db0d90576619e70eb525b40448ef962 commit: 40d634fe925bda6b3c95067cb7d23f2bce32ce36 Author: Sam James gentoo org> AuthorDate: Thu Sep 29 06:37:19 2022 +0000 Commit: Sam James gentoo org> CommitDate: Thu Sep 29 20:45:40 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=40d634fe bin: isolated-functions.sh: make ___makeopts_jobs return CPUs as default, not 1 Both Portage and pkgcore interpret no MAKEOPTS as "-jN" where N is the number of available CPUs but we weren't doing this on the bash side in ___makeopts_jobs. Switch it to use nproc for consistency (it's also, really, the behaviour we're expecting). Signed-off-by: Sam James gentoo.org> NEWS | 3 +++ bin/isolated-functions.sh | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 21296d5ff..31927c819 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,9 @@ Bug fixes: * data: Fix PORTAGE_USERNAME default (bug #873088). +* bin: isolated-functions.sh: return number of CPUs in ___makeopts_jobs as default + instead of 1 to match Portage's behavior on the Python side. + * bin: ecompress: zstd: Recognize .zst as a compressed file suffix for the purposes of the internal compressed file collision check. diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 0efcd5a7d..882789132 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -475,7 +475,14 @@ ___makeopts_jobs() { # 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} + + # Fallbacks for if MAKEOPTS parsing failed + [[ -n ${jobs} ]] || \ + jobs=$(getconf _NPROCESSORS_ONLN 2>/dev/null) || \ + jobs=$(sysctl -n hw.ncpu 2>/dev/null) || \ + jobs=1 + + echo ${jobs} } # Run ${XARGS} in parallel for detected number of CPUs, if supported.