public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion
@ 2016-02-28 19:01 Michał Górny
  2016-02-28 19:01 ` [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix handling of -k Michał Górny
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Michał Górny @ 2016-02-28 19:01 UTC (permalink / raw)
  To: gentoo-dev; +Cc: kde, tommy

Hello,

Just a quick two patches against cmake-utils that fix MAKEOPTS->ninja
conversion. In particular:

1. -k never takes value in make, so do not account for that, and always
   convert '-k' to '-k 0',

2. -j and -l have optional values in make, so figure out if we're being
   passed a correct value and use '-j 9999' and '-l 0' otherwise.

--
Best regards,
Michał Górny



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix handling of -k
  2016-02-28 19:01 [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion Michał Górny
@ 2016-02-28 19:01 ` Michał Górny
  2016-02-28 19:01 ` [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix plain '-j' and '-l' Michał Górny
  2016-05-26  8:10 ` [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion Michał Górny
  2 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2016-02-28 19:01 UTC (permalink / raw)
  To: gentoo-dev; +Cc: kde, tommy, Michał Górny

Fix _ninjaopts_from_makeopts to handle -k correctly. Make does not
support parameters to -k, while ninja requires one. Therefore, handle
only a single '-k' and convert it into '-k 0' (no limit of failing
tasks).
---
 eclass/cmake-utils.eclass | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index b607132..f5ed1eb 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -659,14 +659,19 @@ _ninjaopts_from_makeopts() {
 	set -- ${MAKEOPTS}
 	while (( $# )); do
 		case $1 in
-			-j|-l|-k)
+			-j|-l)
 				ninjaopts+=( $1 $2 )
 				shift 2
 				;;
-			-j*|-l*|-k*)
+			-j*|-l*)
 				ninjaopts+=( $1 )
 				shift 1
 				;;
+			-k)
+				# -k 0 = any number of tasks can fail
+				ninjaopts+=( $1 0 )
+				shift 1
+				;;
 			*) shift ;;
 		esac
 	done
-- 
2.7.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix plain '-j' and '-l'
  2016-02-28 19:01 [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion Michał Górny
  2016-02-28 19:01 ` [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix handling of -k Michał Górny
@ 2016-02-28 19:01 ` Michał Górny
  2016-05-26  8:10 ` [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion Michał Górny
  2 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2016-02-28 19:01 UTC (permalink / raw)
  To: gentoo-dev; +Cc: kde, tommy, Michał Górny

Fix the _ninjaopts_from_makeopts to handle no-parameter '-j' and '-l'
options correctly and convert them to appropriate parametrized ninja
options.
---
 eclass/cmake-utils.eclass | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index f5ed1eb..36f9821 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -660,8 +660,19 @@ _ninjaopts_from_makeopts() {
 	while (( $# )); do
 		case $1 in
 			-j|-l)
-				ninjaopts+=( $1 $2 )
-				shift 2
+				if [[ $# -eq 1 || $2 == -* ]]; then
+					if [[ $1 == -j ]]; then
+						# absurdly high job limit
+						ninjaopts+=( $1 9999 )
+					else # -l
+						# remove load limit (like make does for -l)
+						ninjaopts+=( $1 0 )
+					fi
+					shift 1
+				else
+					ninjaopts+=( $1 $2 )
+					shift 2
+				fi
 				;;
 			-j*|-l*)
 				ninjaopts+=( $1 )
-- 
2.7.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion
  2016-02-28 19:01 [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion Michał Górny
  2016-02-28 19:01 ` [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix handling of -k Michał Górny
  2016-02-28 19:01 ` [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix plain '-j' and '-l' Michał Górny
@ 2016-05-26  8:10 ` Michał Górny
  2016-05-26 13:24   ` rindeal
  2 siblings, 1 reply; 5+ messages in thread
From: Michał Górny @ 2016-05-26  8:10 UTC (permalink / raw)
  To: gentoo-dev; +Cc: kde, tommy

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

On Sun, 28 Feb 2016 20:01:56 +0100
Michał Górny <mgorny@gentoo.org> wrote:

> Hello,
> 
> Just a quick two patches against cmake-utils that fix MAKEOPTS->ninja
> conversion. In particular:
> 
> 1. -k never takes value in make, so do not account for that, and always
>    convert '-k' to '-k 0',
> 
> 2. -j and -l have optional values in make, so figure out if we're being
>    passed a correct value and use '-j 9999' and '-l 0' otherwise.

After the three-month review period I've decided to go ahead and push
it.

-- 
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion
  2016-05-26  8:10 ` [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion Michał Górny
@ 2016-05-26 13:24   ` rindeal
  0 siblings, 0 replies; 5+ messages in thread
From: rindeal @ 2016-05-26 13:24 UTC (permalink / raw)
  To: gentoo-dev; +Cc: kde, tommy

> After the three-month review period I've decided to go ahead and push
> it.

Please notice that there is a much more comprehensive proposal for
_ninjaopts_from_makeopts() in the review queue -
https://github.com/gentoo/gentoo/pull/1481


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-26 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-28 19:01 [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion Michał Górny
2016-02-28 19:01 ` [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix handling of -k Michał Górny
2016-02-28 19:01 ` [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: _ninjaopts_from_makeopts, fix plain '-j' and '-l' Michał Górny
2016-05-26  8:10 ` [gentoo-dev] cmake-utils.eclass: fixes to ninja MAKEOPTS conversion Michał Górny
2016-05-26 13:24   ` rindeal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox