public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 1/7] ninja-utils.eclass: Split get_NINJAOPTS out
Date: Fri, 25 Nov 2022 18:05:02 +0100	[thread overview]
Message-ID: <20221125170508.23064-2-mgorny@gentoo.org> (raw)
In-Reply-To: <20221125170508.23064-1-mgorny@gentoo.org>

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 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: [<args>...]
 # @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



  reply	other threads:[~2022-11-25 17:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 17:05 [gentoo-dev] [PATCH 0/7] distutils-r1.eclass: mesonpy option passing support + periodic cleanup Michał Górny
2022-11-25 17:05 ` Michał Górny [this message]
2022-11-25 17:05 ` [gentoo-dev] [PATCH 2/7] distutils-r1.eclass: Pass options to meson-python backend Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 3/7] dev-python/scipy: Pass -Dblas, -Dlapack via DISTUTILS_ARGS Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 4/7] distutils-r1.eclass: Bump min dep versions to newest stable Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 5/7] distutils-r1.eclass: Print versions of common hatch plugins Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 6/7] distutils-r1.eclass: Remove support for gpep517 < 9 Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 7/7] python-utils-r1.eclass: Bump min Python versions Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221125170508.23064-2-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox