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) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A4F6D15800A for ; Mon, 31 Jul 2023 09:31:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E408EE0C0C; Mon, 31 Jul 2023 09:31:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B0B36E0B5D for ; Mon, 31 Jul 2023 09:31:32 +0000 (UTC) References: <20230724185800.288216-1-flow@gentoo.org> <30ac5261f9bd6fc771ee4b117b7ad23fcbb6db7f.camel@gentoo.org> <1d6f9832c3c181cdfc8c07fdaf4c24f2f54e3b0e.camel@gentoo.org> User-agent: mu4e 1.10.4; emacs 30.0.50 From: Sam James To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average Date: Mon, 31 Jul 2023 10:31:01 +0100 Organization: Gentoo In-reply-to: Message-ID: <87v8e0ctqn.fsf@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: quoted-printable X-Archives-Salt: 249f873f-6cfe-4c22-bf7b-45153e3654d4 X-Archives-Hash: 87caa28e372b36d41d07c08223646e35 Florian Schmaus writes: > [[PGP Signed Part:Undecided]] > On 25/07/2023 10.32, Micha=C5=82 G=C3=B3rny wrote: >> On Tue, 2023-07-25 at 08:26 +0200, Florian Schmaus wrote: >>> On 25/07/2023 06.50, Micha=C5=82 G=C3=B3rny wrote: >>>> On Mon, 2023-07-24 at 20:57 +0200, Florian Schmaus wrote: >>>>> Since --load-average may not be found in other Make implementations >>>>> besides GNU MAKE, it is potentially found in GNUMAKEFLAGS and not in >>>>> MAKEOPTS. >>>>> >>>>> Signed-off-by: Florian Schmaus >>>>> --- >>>>> eclass/multiprocessing.eclass | 6 +++--- >>>>> 1 file changed, 3 insertions(+), 3 deletions(-) >>>>> >>>>> diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.e= class >>>>> index e55be636a02c..6489ecbb44a6 100644 >>>>> --- a/eclass/multiprocessing.eclass >>>>> +++ b/eclass/multiprocessing.eclass >>>>> @@ -1,4 +1,4 @@ >>>>> -# Copyright 1999-2022 Gentoo Authors >>>>> +# Copyright 1999-2023 Gentoo Authors >>>>> # Distributed under the terms of the GNU General Public License v2 >>>>> # @ECLASS: multiprocessing.eclass >>>>> @@ -86,7 +86,7 @@ makeopts_jobs() { >>>>> # @FUNCTION: makeopts_loadavg >>>>> # @USAGE: [${MAKEOPTS}] [${inf:-999}] >>>>> # @DESCRIPTION: >>>>> -# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the = value set >>>>> +# Searches the arguments (defaults to ${MAKEOPTS} ${GNUMAKEFLAGS}) a= nd extracts the value set >>>>> # for load-average. For make and ninja based builds this will mean= new jobs are >>>>> # not only limited by the jobs-value, but also by the current load= - which might >>>>> # get excessive due to I/O and not just due to CPU load. >>>>> @@ -95,7 +95,7 @@ makeopts_jobs() { >>>>> # If no limit is specified or --load-average is used without a num= ber, ${inf} >>>>> # (defaults to 999) is returned. >>>>> makeopts_loadavg() { >>>>> - [[ $# -eq 0 ]] && set -- "${MAKEOPTS}" >>>>> + [[ $# -eq 0 ]] && set -- "${MAKEOPTS} ${GNUMAKEFLAGS}" >>>>> # This assumes the first .* will be more greedy than the second .* >>>>> # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). >>>>> local lavg=3D$(echo " $* " | sed -r -n \ >>>> >>>> I'm pretty sure [GNU]MAKEFLAGS has incompatible format, in particular = it >>>> makes hyphens optional. >>> >>> Yes, hyphens are optional in GNUMAKEFLAGS. >>> >>> However, makeopts_loadavg() would still be able to extract the >>> hyphen-prefixed short (-l) and long (--load-average) options from >>> GNUMAKEFLAGS. Hence having makeopts_loadavg() also inspect GNUMAKEFLAGS >>> seems like an improvement over the current situation. >>> >> Also, shouldn't you handle MAKEFLAGS then as well? If we're to >> support >> arbitrary variables used by build systems. > > We could. > > But GNUMAKEFLAGS was not arbitrary chosen. The idea is that portage > may set --load-average via GNUMAKEFLAGS if the user did not set > MAKEOPTS and GNUMAKEFLAGS. > > See https://github.com/gentoo/portage/pull/1072 > > I first put --load-average into MAKEOPTS, but --load-average is not a > portable make option, that is, some Make implementation do not support > it. Adding it to GNUMAKEFLAGS, a variable already set by portage, we > avoid passing this option to a make implementation that does not > support it. > > Hence, just adding GNUMAKEFLAGS is sufficient for the purpose of > propagating portage's potential new default into > multiprocessing.eclass & Co. But this exposed a problem in that we're missing other variables that make recognises, so we need to handle the other case too.