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 6213B158020 for ; Fri, 25 Nov 2022 17:05:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 445D6E09AB; Fri, 25 Nov 2022 17:05:17 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.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 A55DAE095C for ; Fri, 25 Nov 2022 17:05:14 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 1/7] ninja-utils.eclass: Split get_NINJAOPTS out Date: Fri, 25 Nov 2022 18:05:02 +0100 Message-Id: <20221125170508.23064-2-mgorny@gentoo.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221125170508.23064-1-mgorny@gentoo.org> References: <20221125170508.23064-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: be4c99f7-5851-4195-9993-8f0c55eaa22b X-Archives-Hash: 50589a95f6e75a9191276ad78ad93900 Signed-off-by: Michał Górny --- eclass/ninja-utils.eclass | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass index 0dffd2eb86ff..9be502fa8ad9 100644 --- a/eclass/ninja-utils.eclass +++ b/eclass/ninja-utils.eclass @@ -62,6 +62,16 @@ case "${NINJA}" in ;; esac +# @FUNCTION: get_NINJAOPTS +# @DESCRIPTION: +# Get the value of NINJAOPTS, inferring them from MAKEOPTS if unset. +get_NINJAOPTS() { + if [[ -z ${NINJAOPTS+set} ]]; then + NINJAOPTS="-j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS}" 0)" + fi + echo "${NINJAOPTS}" +} + # @FUNCTION: eninja # @USAGE: [...] # @DESCRIPTION: @@ -72,11 +82,8 @@ eninja() { local nonfatal_args=() [[ ${EAPI} != 5 ]] && nonfatal_args+=( -n ) - if [[ -z ${NINJAOPTS+set} ]]; then - NINJAOPTS="-j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS}" 0)" - fi [[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}" - set -- "${NINJA}" -v ${NINJAOPTS} "$@" + set -- "${NINJA}" -v $(get_NINJAOPTS) "$@" echo "$@" >&2 "$@" || die "${nonfatal_args[@]}" "${*} failed" } -- 2.38.1