* [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average
@ 2023-07-24 18:57 Florian Schmaus
2023-07-24 18:57 ` [gentoo-dev] [PATCH 2/3] ninja-utils.eclass: " Florian Schmaus
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Florian Schmaus @ 2023-07-24 18:57 UTC (permalink / raw
To: gentoo-dev; +Cc: Florian Schmaus
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 <flow@gentoo.org>
---
eclass/multiprocessing.eclass | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
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}) and 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 number, ${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=$(echo " $* " | sed -r -n \
--
2.41.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH 2/3] ninja-utils.eclass: search also GNUMAKEFLAGS for --load-average
2023-07-24 18:57 [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average Florian Schmaus
@ 2023-07-24 18:57 ` Florian Schmaus
2023-07-24 18:58 ` [gentoo-dev] [PATCH 3/3] meson.eclass: " Florian Schmaus
2023-07-25 4:50 ` [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: " Michał Górny
2 siblings, 0 replies; 9+ messages in thread
From: Florian Schmaus @ 2023-07-24 18:57 UTC (permalink / raw
To: gentoo-dev; +Cc: Florian Schmaus
Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
eclass/ninja-utils.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
index 5a211e81131d..3d15a32c5e6c 100644
--- a/eclass/ninja-utils.eclass
+++ b/eclass/ninja-utils.eclass
@@ -72,7 +72,7 @@ esac
# 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)"
+ NINJAOPTS="-j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS} ${GNUMAKEFLAGS}" 0)"
fi
echo "${NINJAOPTS}"
}
--
2.41.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH 3/3] meson.eclass: search also GNUMAKEFLAGS for --load-average
2023-07-24 18:57 [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average Florian Schmaus
2023-07-24 18:57 ` [gentoo-dev] [PATCH 2/3] ninja-utils.eclass: " Florian Schmaus
@ 2023-07-24 18:58 ` Florian Schmaus
2023-07-25 4:50 ` [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: " Michał Górny
2 siblings, 0 replies; 9+ messages in thread
From: Florian Schmaus @ 2023-07-24 18:58 UTC (permalink / raw
To: gentoo-dev; +Cc: Florian Schmaus
Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
eclass/meson.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 5aff3eb58930..65fc10b81e72 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -389,7 +389,7 @@ meson_src_compile() {
local mesoncompileargs=(
-C "${BUILD_DIR}"
--jobs "$(makeopts_jobs "${MAKEOPTS}" 0)"
- --load-average "$(makeopts_loadavg "${MAKEOPTS}" 0)"
+ --load-average "$(makeopts_loadavg "${MAKEOPTS} ${GNUMAKEFLAGS}" 0)"
)
case ${MESON_VERBOSE} in
--
2.41.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average
2023-07-24 18:57 [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average Florian Schmaus
2023-07-24 18:57 ` [gentoo-dev] [PATCH 2/3] ninja-utils.eclass: " Florian Schmaus
2023-07-24 18:58 ` [gentoo-dev] [PATCH 3/3] meson.eclass: " Florian Schmaus
@ 2023-07-25 4:50 ` Michał Górny
2023-07-25 6:26 ` Florian Schmaus
2 siblings, 1 reply; 9+ messages in thread
From: Michał Górny @ 2023-07-25 4:50 UTC (permalink / raw
To: gentoo-dev; +Cc: Florian Schmaus
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 <flow@gentoo.org>
> ---
> eclass/multiprocessing.eclass | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
> 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}) and 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 number, ${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=$(echo " $* " | sed -r -n \
I'm pretty sure [GNU]MAKEFLAGS has incompatible format, in particular it
makes hyphens optional.
--
Best regards,
Michał Górny
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average
2023-07-25 4:50 ` [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: " Michał Górny
@ 2023-07-25 6:26 ` Florian Schmaus
2023-07-25 8:32 ` Michał Górny
0 siblings, 1 reply; 9+ messages in thread
From: Florian Schmaus @ 2023-07-25 6:26 UTC (permalink / raw
To: Michał Górny, gentoo-dev
[-- Attachment #1.1.1: Type: text/plain, Size: 2447 bytes --]
On 25/07/2023 06.50, Michał Górny 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 <flow@gentoo.org>
>> ---
>> eclass/multiprocessing.eclass | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
>> 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}) and 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 number, ${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=$(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.
But maybe I am missing something? I am not sure if your comment just a
remark, or do you oppose the change?
- Flow
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 17273 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average
2023-07-25 6:26 ` Florian Schmaus
@ 2023-07-25 8:32 ` Michał Górny
2023-07-25 9:09 ` Florian Schmaus
0 siblings, 1 reply; 9+ messages in thread
From: Michał Górny @ 2023-07-25 8:32 UTC (permalink / raw
To: gentoo-dev
On Tue, 2023-07-25 at 08:26 +0200, Florian Schmaus wrote:
> On 25/07/2023 06.50, Michał Górny 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 <flow@gentoo.org>
> > > ---
> > > eclass/multiprocessing.eclass | 6 +++---
> > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
> > > 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}) and 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 number, ${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=$(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.
--
Best regards,
Michał Górny
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average
2023-07-25 8:32 ` Michał Górny
@ 2023-07-25 9:09 ` Florian Schmaus
2023-07-31 9:31 ` Sam James
0 siblings, 1 reply; 9+ messages in thread
From: Florian Schmaus @ 2023-07-25 9:09 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1.1.1: Type: text/plain, Size: 3361 bytes --]
On 25/07/2023 10.32, Michał Górny wrote:
> On Tue, 2023-07-25 at 08:26 +0200, Florian Schmaus wrote:
>> On 25/07/2023 06.50, Michał Górny 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 <flow@gentoo.org>
>>>> ---
>>>> eclass/multiprocessing.eclass | 6 +++---
>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
>>>> 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}) and 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 number, ${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=$(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.
- Flow
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 17843 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average
2023-07-25 9:09 ` Florian Schmaus
@ 2023-07-31 9:31 ` Sam James
2023-07-31 10:50 ` Florian Schmaus
0 siblings, 1 reply; 9+ messages in thread
From: Sam James @ 2023-07-31 9:31 UTC (permalink / raw
To: gentoo-dev
Florian Schmaus <flow@gentoo.org> writes:
> [[PGP Signed Part:Undecided]]
> On 25/07/2023 10.32, Michał Górny wrote:
>> On Tue, 2023-07-25 at 08:26 +0200, Florian Schmaus wrote:
>>> On 25/07/2023 06.50, Michał Górny 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 <flow@gentoo.org>
>>>>> ---
>>>>> eclass/multiprocessing.eclass | 6 +++---
>>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
>>>>> 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}) and 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 number, ${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=$(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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average
2023-07-31 9:31 ` Sam James
@ 2023-07-31 10:50 ` Florian Schmaus
0 siblings, 0 replies; 9+ messages in thread
From: Florian Schmaus @ 2023-07-31 10:50 UTC (permalink / raw
To: gentoo-dev, Sam James
[-- Attachment #1.1.1: Type: text/plain, Size: 3817 bytes --]
On 31/07/2023 11.31, Sam James wrote:
> Florian Schmaus <flow@gentoo.org> writes:
>> [[PGP Signed Part:Undecided]]
>> On 25/07/2023 10.32, Michał Górny wrote:
>>> On Tue, 2023-07-25 at 08:26 +0200, Florian Schmaus wrote:
>>>> On 25/07/2023 06.50, Michał Górny 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 <flow@gentoo.org>
>>>>>> ---
>>>>>> eclass/multiprocessing.eclass | 6 +++---
>>>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>>>
>>>>>> diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
>>>>>> 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}) and 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 number, ${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=$(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.
Sure, which one do you have in mind?
- Flow
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 17273 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-07-31 10:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-24 18:57 [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: search also GNUMAKEFLAGS for --load-average Florian Schmaus
2023-07-24 18:57 ` [gentoo-dev] [PATCH 2/3] ninja-utils.eclass: " Florian Schmaus
2023-07-24 18:58 ` [gentoo-dev] [PATCH 3/3] meson.eclass: " Florian Schmaus
2023-07-25 4:50 ` [gentoo-dev] [PATCH 1/3] multiprocessing.eclass: " Michał Górny
2023-07-25 6:26 ` Florian Schmaus
2023-07-25 8:32 ` Michał Górny
2023-07-25 9:09 ` Florian Schmaus
2023-07-31 9:31 ` Sam James
2023-07-31 10:50 ` Florian Schmaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox