All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2 V2] Add oe.utils.vartrue() and update BUILD_OPTIMIZATION
@ 2018-09-05  7:16 Robert Yang
  2018-09-05  7:16 ` [PATCH 1/2 V2] oe/utils.py: Add vartrue() Robert Yang
  2018-09-05  7:16 ` [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD Robert Yang
  0 siblings, 2 replies; 12+ messages in thread
From: Robert Yang @ 2018-09-05  7:16 UTC (permalink / raw)
  To: openembedded-core

* V2:
  - Improve readability as RP and Peter suggested.

* V1:
  Initial version

// Robert

The following changes since commit bd92ff5759809df2542ce1bcba2c45bbd11d1e10:

  openssl: Handle -conf package file conflicts (2018-09-04 11:03:31 +0100)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib rbt/debug
  http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/debug

Robert Yang (2):
  oe/utils.py: Add vartrue()
  bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD

 meta/conf/bitbake.conf | 4 ++--
 meta/lib/oe/utils.py   | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.7.4



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

* [PATCH 1/2 V2] oe/utils.py: Add vartrue()
  2018-09-05  7:16 [PATCH 0/2 V2] Add oe.utils.vartrue() and update BUILD_OPTIMIZATION Robert Yang
@ 2018-09-05  7:16 ` Robert Yang
  2018-09-05  7:33   ` Peter Kjellerstedt
  2018-09-05 10:38   ` Martin Jansa
  2018-09-05  7:16 ` [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD Robert Yang
  1 sibling, 2 replies; 12+ messages in thread
From: Robert Yang @ 2018-09-05  7:16 UTC (permalink / raw)
  To: openembedded-core

It can be used to simplify code like:
"${@['iffalse', 'iftrue'][var]}"

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/conf/bitbake.conf | 2 +-
 meta/lib/oe/utils.py   | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index faef771..dbadeb3 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
 # Disabled until the option works properly -feliminate-dwarf2-dups
 FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
 DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
-SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
+SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
 BUILD_OPTIMIZATION = "-O2 -pipe"
 
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index f22a6ab..914a6f2 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed):
             msg = msg + ' (%s)' % self.description
 
         return msg
+
+def vartrue(var, iftrue, iffalse, d):
+    import oe.types
+    if oe.types.boolean(d.getVar(var)):
+        return iftrue
+    else:
+        return iffalse
-- 
2.7.4



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

* [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
  2018-09-05  7:16 [PATCH 0/2 V2] Add oe.utils.vartrue() and update BUILD_OPTIMIZATION Robert Yang
  2018-09-05  7:16 ` [PATCH 1/2 V2] oe/utils.py: Add vartrue() Robert Yang
@ 2018-09-05  7:16 ` Robert Yang
  2018-09-14 13:25   ` Martin Jansa
  1 sibling, 1 reply; 12+ messages in thread
From: Robert Yang @ 2018-09-05  7:16 UTC (permalink / raw)
  To: openembedded-core

We may also need debug native tools, so make BUILD_OPTIMIZATION respect to
DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't
convenient.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index dbadeb3..93aee1a 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
 DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
 SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
-BUILD_OPTIMIZATION = "-O2 -pipe"
+BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)} -pipe"
 
 ##################################################################
 # Settings used by bitbake-layers.
-- 
2.7.4



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

* Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
  2018-09-05  7:16 ` [PATCH 1/2 V2] oe/utils.py: Add vartrue() Robert Yang
@ 2018-09-05  7:33   ` Peter Kjellerstedt
  2018-09-05  8:11     ` Robert Yang
  2018-09-05 10:38   ` Martin Jansa
  1 sibling, 1 reply; 12+ messages in thread
From: Peter Kjellerstedt @ 2018-09-05  7:33 UTC (permalink / raw)
  To: Robert Yang, openembedded-core

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> core-bounces@lists.openembedded.org> On Behalf Of Robert Yang
> Sent: den 5 september 2018 09:16
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 1/2 V2] oe/utils.py: Add vartrue()
> 
> It can be used to simplify code like:
> "${@['iffalse', 'iftrue'][var]}"
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/conf/bitbake.conf | 2 +-
>  meta/lib/oe/utils.py   | 7 +++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index faef771..dbadeb3 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types
> ${DEBUG_PREFIX_MAP}"
>  # Disabled until the option works properly -feliminate-dwarf2-dups
>  FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
>  DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
> -SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION',
> 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
> +SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
> 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
>  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION
> DEBUG_OPTIMIZATION"
>  BUILD_OPTIMIZATION = "-O2 -pipe"
> 
> diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
> index f22a6ab..914a6f2 100644
> --- a/meta/lib/oe/utils.py
> +++ b/meta/lib/oe/utils.py
> @@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed):
>              msg = msg + ' (%s)' % self.description
> 
>          return msg
> +
> +def vartrue(var, iftrue, iffalse, d):
> +    import oe.types
> +    if oe.types.boolean(d.getVar(var)):
> +        return iftrue
> +    else:
> +        return iffalse

Put it together with ifelse() and conditional() instead, where it better 
belongs.

You can also implement it as:

def vartrue(var, iftrue, iffalse, d):
    import oe.types
    return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue, iffalse):

> --
> 2.7.4

//Peter



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

* Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
  2018-09-05  7:33   ` Peter Kjellerstedt
@ 2018-09-05  8:11     ` Robert Yang
  2018-09-05 19:22       ` Peter Kjellerstedt
  2018-09-05 19:31       ` Richard Purdie
  0 siblings, 2 replies; 12+ messages in thread
From: Robert Yang @ 2018-09-05  8:11 UTC (permalink / raw)
  To: Peter Kjellerstedt, openembedded-core

Hi Peter,

On 09/05/2018 03:33 PM, Peter Kjellerstedt wrote:
>> -----Original Message-----
>> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
>> core-bounces@lists.openembedded.org> On Behalf Of Robert Yang
>> Sent: den 5 september 2018 09:16
>> To: openembedded-core@lists.openembedded.org
>> Subject: [OE-core] [PATCH 1/2 V2] oe/utils.py: Add vartrue()
>>
>> It can be used to simplify code like:
>> "${@['iffalse', 'iftrue'][var]}"
>>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   meta/conf/bitbake.conf | 2 +-
>>   meta/lib/oe/utils.py   | 7 +++++++
>>   2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
>> index faef771..dbadeb3 100644
>> --- a/meta/conf/bitbake.conf
>> +++ b/meta/conf/bitbake.conf
>> @@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types
>> ${DEBUG_PREFIX_MAP}"
>>   # Disabled until the option works properly -feliminate-dwarf2-dups
>>   FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
>>   DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
>> -SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION',
>> 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
>> +SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
>> 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
>>   SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION
>> DEBUG_OPTIMIZATION"
>>   BUILD_OPTIMIZATION = "-O2 -pipe"
>>
>> diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
>> index f22a6ab..914a6f2 100644
>> --- a/meta/lib/oe/utils.py
>> +++ b/meta/lib/oe/utils.py
>> @@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed):
>>               msg = msg + ' (%s)' % self.description
>>
>>           return msg
>> +
>> +def vartrue(var, iftrue, iffalse, d):
>> +    import oe.types
>> +    if oe.types.boolean(d.getVar(var)):
>> +        return iftrue
>> +    else:
>> +        return iffalse
> 
> Put it together with ifelse() and conditional() instead, where it better
> belongs.
> 
> You can also implement it as:
> 
> def vartrue(var, iftrue, iffalse, d):
>      import oe.types
>      return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue, iffalse):

Then we need import oe.utils, and I don't think that it's easier to read
than:

+
+def vartrue(var, iftrue, iffalse, d):
+    import oe.types
+    if oe.types.boolean(d.getVar(var)):
+        return iftrue
+    else:
+        return iffalse

// Robert

> 
>> --
>> 2.7.4
> 
> //Peter
> 
> 


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

* Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
  2018-09-05  7:16 ` [PATCH 1/2 V2] oe/utils.py: Add vartrue() Robert Yang
  2018-09-05  7:33   ` Peter Kjellerstedt
@ 2018-09-05 10:38   ` Martin Jansa
  2018-09-05 10:56     ` Richard Purdie
  1 sibling, 1 reply; 12+ messages in thread
From: Martin Jansa @ 2018-09-05 10:38 UTC (permalink / raw)
  To: Robert Yang; +Cc: openembedded-core

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

On Wed, Sep 05, 2018 at 03:16:17PM +0800, Robert Yang wrote:
> It can be used to simplify code like:
> "${@['iffalse', 'iftrue'][var]}"
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/conf/bitbake.conf | 2 +-
>  meta/lib/oe/utils.py   | 7 +++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index faef771..dbadeb3 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
>  # Disabled until the option works properly -feliminate-dwarf2-dups
>  FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
>  DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
> -SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
> +SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
>  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
>  BUILD_OPTIMIZATION = "-O2 -pipe"
>  
> diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
> index f22a6ab..914a6f2 100644
> --- a/meta/lib/oe/utils.py
> +++ b/meta/lib/oe/utils.py
> @@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed):
>              msg = msg + ' (%s)' % self.description
>  
>          return msg
> +
> +def vartrue(var, iftrue, iffalse, d):
> +    import oe.types
> +    if oe.types.boolean(d.getVar(var)):
> +        return iftrue
> +    else:
> +        return iffalse

Shouldn't we update bitbake to track var usage like in oe.utils.conditional:
http://git.openembedded.org/bitbake/commit/?id=5156b4bb6876dac636be9726df22c8ee792714dd
before this gets used more widely?

> -- 
> 2.7.4
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 201 bytes --]

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

* Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
  2018-09-05 10:38   ` Martin Jansa
@ 2018-09-05 10:56     ` Richard Purdie
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Purdie @ 2018-09-05 10:56 UTC (permalink / raw)
  To: Martin Jansa, Robert Yang; +Cc: openembedded-core

On Wed, 2018-09-05 at 12:38 +0200, Martin Jansa wrote:
> On Wed, Sep 05, 2018 at 03:16:17PM +0800, Robert Yang wrote:
> > It can be used to simplify code like:
> > "${@['iffalse', 'iftrue'][var]}"
> > 
> > Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> > ---
> >  meta/conf/bitbake.conf | 2 +-
> >  meta/lib/oe/utils.py   | 7 +++++++
> >  2 files changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index faef771..dbadeb3 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-
> > types ${DEBUG_PREFIX_MAP}"
> >  # Disabled until the option works properly -feliminate-dwarf2-dups
> >  FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
> >  DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS}
> > -pipe"
> > -SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION',
> > 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
> > +SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD
> > ', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
> >  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION
> > DEBUG_OPTIMIZATION"
> >  BUILD_OPTIMIZATION = "-O2 -pipe"
> >  
> > diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
> > index f22a6ab..914a6f2 100644
> > --- a/meta/lib/oe/utils.py
> > +++ b/meta/lib/oe/utils.py
> > @@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed):
> >              msg = msg + ' (%s)' % self.description
> >  
> >          return msg
> > +
> > +def vartrue(var, iftrue, iffalse, d):
> > +    import oe.types
> > +    if oe.types.boolean(d.getVar(var)):
> > +        return iftrue
> > +    else:
> > +        return iffalse
> 
> Shouldn't we update bitbake to track var usage like in
> oe.utils.conditional:
> http://git.openembedded.org/bitbake/commit/?id=5156b4bb6876dac636be97
> 26df22c8ee792714dd
> before this gets used more widely?

I think we need to take a step back and make sure we have the right
APIs for this before we go adding more magic to bitbake variable
tracking. There are two sides to it, the conditional expressions and
the variable typing. Something to look at in 2.7. 

I really want to add more OE namespace functions directly into the
bitbake datastore code.

Cheers,

Richard


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

* Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
  2018-09-05  8:11     ` Robert Yang
@ 2018-09-05 19:22       ` Peter Kjellerstedt
  2018-09-05 19:31       ` Richard Purdie
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Kjellerstedt @ 2018-09-05 19:22 UTC (permalink / raw)
  To: Robert Yang, openembedded-core

> -----Original Message-----
> From: Robert Yang <liezhi.yang@windriver.com>
> Sent: den 5 september 2018 10:12
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH 1/2 V2] oe/utils.py: Add vartrue()
> 
> Hi Peter,
> 
> On 09/05/2018 03:33 PM, Peter Kjellerstedt wrote:
> >> -----Original Message-----
> >> From: openembedded-core-bounces@lists.openembedded.org
> <openembedded-
> >> core-bounces@lists.openembedded.org> On Behalf Of Robert Yang
> >> Sent: den 5 september 2018 09:16
> >> To: openembedded-core@lists.openembedded.org
> >> Subject: [OE-core] [PATCH 1/2 V2] oe/utils.py: Add vartrue()
> >>
> >> It can be used to simplify code like:
> >> "${@['iffalse', 'iftrue'][var]}"
> >>
> >> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> >> ---
> >>   meta/conf/bitbake.conf | 2 +-
> >>   meta/lib/oe/utils.py   | 7 +++++++
> >>   2 files changed, 8 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> >> index faef771..dbadeb3 100644
> >> --- a/meta/conf/bitbake.conf
> >> +++ b/meta/conf/bitbake.conf
> >> @@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-
> types
> >> ${DEBUG_PREFIX_MAP}"
> >>   # Disabled until the option works properly -feliminate-dwarf2-dups
> >>   FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
> >>   DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -
> pipe"
> >> -SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION',
> >> 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
> >> +SELECTED_OPTIMIZATION =
> "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
> >> 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
> >>   SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION
> >> DEBUG_OPTIMIZATION"
> >>   BUILD_OPTIMIZATION = "-O2 -pipe"
> >>
> >> diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
> >> index f22a6ab..914a6f2 100644
> >> --- a/meta/lib/oe/utils.py
> >> +++ b/meta/lib/oe/utils.py
> >> @@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed):
> >>               msg = msg + ' (%s)' % self.description
> >>
> >>           return msg
> >> +
> >> +def vartrue(var, iftrue, iffalse, d):
> >> +    import oe.types
> >> +    if oe.types.boolean(d.getVar(var)):
> >> +        return iftrue
> >> +    else:
> >> +        return iffalse
> >
> > Put it together with ifelse() and conditional() instead, where it
> > better belongs.
> >
> > You can also implement it as:
> >
> > def vartrue(var, iftrue, iffalse, d):
> >      import oe.types
> >      return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue, iffalse):
> 
> Then we need import oe.utils, and I don't think that it's easier to
> read than:

Well, since this file actually is oe.utils, I would assume that is not 
needed (other functions in this file call oe.utils functions just fine).

> +
> +def vartrue(var, iftrue, iffalse, d):
> +    import oe.types
> +    if oe.types.boolean(d.getVar(var)):
> +        return iftrue
> +    else:
> +        return iffalse
> 
> // Robert
> 
> >
> >> --
> >> 2.7.4
> >
> > //Peter

//Peter


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

* Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
  2018-09-05  8:11     ` Robert Yang
  2018-09-05 19:22       ` Peter Kjellerstedt
@ 2018-09-05 19:31       ` Richard Purdie
  1 sibling, 0 replies; 12+ messages in thread
From: Richard Purdie @ 2018-09-05 19:31 UTC (permalink / raw)
  To: Robert Yang, Peter Kjellerstedt, openembedded-core

On Wed, 2018-09-05 at 16:11 +0800, Robert Yang wrote:
> On 09/05/2018 03:33 PM, Peter Kjellerstedt wrote:
> > > 
> > Put it together with ifelse() and conditional() instead, where it
> > better
> > belongs.
> > 
> > You can also implement it as:
> > 
> > def vartrue(var, iftrue, iffalse, d):
> >      import oe.types
> >      return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue,
> > iffalse):
> 
> Then we need import oe.utils, and I don't think that it's easier to
> read than:
> 
> +
> +def vartrue(var, iftrue, iffalse, d):
> +    import oe.types
> +    if oe.types.boolean(d.getVar(var)):
> +        return iftrue
> +    else:
> +        return iffalse

I think Robert's version is easier to read, the addition of the other
function doesn't really add much. It probably should live alongside the
other varients in the file though.

Cheers,

Richard


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

* Re: [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
  2018-09-05  7:16 ` [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD Robert Yang
@ 2018-09-14 13:25   ` Martin Jansa
  2018-09-17  5:50     ` Martin Jansa
  0 siblings, 1 reply; 12+ messages in thread
From: Martin Jansa @ 2018-09-14 13:25 UTC (permalink / raw)
  To: Robert Yang; +Cc: Patches and discussions about the oe-core layer

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

This seems to cause nativesdk-glibc failures when DEBUG_BUILD is used, it
fails like this:

../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':
../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
      b = invsqrtpi * temp / sqrtl (x);
          ~~~~~~~~~~^~~~~~

the target build suffers from the same, that's why I was using this for a
while:
# glibc-2.21 fails to build with:
# iso-2022-cn-ext.c:501:4: error: 'tmpbuf' may be used uninitialized in
this function [-Werror=maybe-uninitialized]
# connections.c:1916:1: error: inlining failed in call to 'clear_db_cache':
call is unlikely and code size would grow [-Werror=inline]
# add few -Wno-error like meta/recipes-core/glibc/glibc.inc is trying to
doin get_optimization function,
# but fails because we append -Os at the end and -O2 is found first
SELECTED_OPTIMIZATION_append_pn-glibc =
"${@bb.utils.contains('TUNE_FEATURES', 'webos-minsize', '
-Wno-error=maybe-uninitialized -Wno-error=inline', '', d)}"


There is some logic in meta/recipes-core/glibc/glibc.inc to
append -Wno-error to SELECTED_OPTIMIZATION when "-O", "-O1", "-Os" is used,
but the same would be needed for BUILD_OPTIMIZATION now.

Or maybe it would be worth marking those uninitialized/unused variables
with #pragma instead of injecting -Wno-error?

Then we can get rid of:
python () {
    opt_effective = "-O"
    for opt in d.getVar('SELECTED_OPTIMIZATION').split():
        if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):
            opt_effective = opt
    if opt_effective == "-O0":
        bb.fatal("%s can't be built with %s, try -O1 instead" %
(d.getVar('PN'), opt_effective))
    if opt_effective in ("-O", "-O1", "-Os"):
        bb.note("%s doesn't build cleanly with %s, adding -Wno-error to
SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective))
        d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
}
from meta/recipes-core/glibc/glibc.inc (not use about -O0 case) and remove
following notes:
NOTE: glibc doesn't build cleanly with -O, adding -Wno-error to
SELECTED_OPTIMIZATION
NOTE: nativesdk-glibc doesn't build cleanly with -O, adding -Wno-error to
SELECTED_OPTIMIZATION
from every build with DEBUG_BUILD enabled.

What would be the preferred fix?

On Wed, Sep 5, 2018 at 9:05 AM Robert Yang <liezhi.yang@windriver.com>
wrote:

> We may also need debug native tools, so make BUILD_OPTIMIZATION respect to
> DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't
> convenient.
>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/conf/bitbake.conf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index dbadeb3..93aee1a 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
>  DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
>  SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
> 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
>  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
> -BUILD_OPTIMIZATION = "-O2 -pipe"
> +BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g
> -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)} -pipe"
>
>  ##################################################################
>  # Settings used by bitbake-layers.
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 5360 bytes --]

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

* Re: [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
  2018-09-14 13:25   ` Martin Jansa
@ 2018-09-17  5:50     ` Martin Jansa
  2018-09-17  9:57       ` Robert Yang
  0 siblings, 1 reply; 12+ messages in thread
From: Martin Jansa @ 2018-09-17  5:50 UTC (permalink / raw)
  To: Robert Yang; +Cc: Patches and discussions about the oe-core layer

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

On Fri, Sep 14, 2018 at 03:25:58PM +0200, Martin Jansa wrote:
> This seems to cause nativesdk-glibc failures when DEBUG_BUILD is used, it
> fails like this:
> 
> ../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':
> ../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
>       b = invsqrtpi * temp / sqrtl (x);
>           ~~~~~~~~~~^~~~~~
> 
> the target build suffers from the same, that's why I was using this for a
> while:
> # glibc-2.21 fails to build with:
> # iso-2022-cn-ext.c:501:4: error: 'tmpbuf' may be used uninitialized in
> this function [-Werror=maybe-uninitialized]
> # connections.c:1916:1: error: inlining failed in call to 'clear_db_cache':
> call is unlikely and code size would grow [-Werror=inline]
> # add few -Wno-error like meta/recipes-core/glibc/glibc.inc is trying to
> doin get_optimization function,
> # but fails because we append -Os at the end and -O2 is found first
> SELECTED_OPTIMIZATION_append_pn-glibc =
> "${@bb.utils.contains('TUNE_FEATURES', 'webos-minsize', '
> -Wno-error=maybe-uninitialized -Wno-error=inline', '', d)}"
> 
> 
> There is some logic in meta/recipes-core/glibc/glibc.inc to
> append -Wno-error to SELECTED_OPTIMIZATION when "-O", "-O1", "-Os" is used,
> but the same would be needed for BUILD_OPTIMIZATION now.
> 
> Or maybe it would be worth marking those uninitialized/unused variables
> with #pragma instead of injecting -Wno-error?
> 
> Then we can get rid of:
> python () {
>     opt_effective = "-O"
>     for opt in d.getVar('SELECTED_OPTIMIZATION').split():
>         if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):
>             opt_effective = opt
>     if opt_effective == "-O0":
>         bb.fatal("%s can't be built with %s, try -O1 instead" %
> (d.getVar('PN'), opt_effective))
>     if opt_effective in ("-O", "-O1", "-Os"):
>         bb.note("%s doesn't build cleanly with %s, adding -Wno-error to
> SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective))
>         d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
> }
> from meta/recipes-core/glibc/glibc.inc (not use about -O0 case) and remove
> following notes:
> NOTE: glibc doesn't build cleanly with -O, adding -Wno-error to
> SELECTED_OPTIMIZATION
> NOTE: nativesdk-glibc doesn't build cleanly with -O, adding -Wno-error to
> SELECTED_OPTIMIZATION
> from every build with DEBUG_BUILD enabled.
> 
> What would be the preferred fix?

I've sent possible fix here:
http://lists.openembedded.org/pipermail/openembedded-core/2018-September/155744.html

> 
> On Wed, Sep 5, 2018 at 9:05 AM Robert Yang <liezhi.yang@windriver.com>
> wrote:
> 
> > We may also need debug native tools, so make BUILD_OPTIMIZATION respect to
> > DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't
> > convenient.
> >
> > Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> > ---
> >  meta/conf/bitbake.conf | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index dbadeb3..93aee1a 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
> >  DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
> >  SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
> > 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
> >  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
> > -BUILD_OPTIMIZATION = "-O2 -pipe"
> > +BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g
> > -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)} -pipe"
> >
> >  ##################################################################
> >  # Settings used by bitbake-layers.
> > --
> > 2.7.4
> >
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> >

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 201 bytes --]

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

* Re: [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
  2018-09-17  5:50     ` Martin Jansa
@ 2018-09-17  9:57       ` Robert Yang
  0 siblings, 0 replies; 12+ messages in thread
From: Robert Yang @ 2018-09-17  9:57 UTC (permalink / raw)
  To: Martin Jansa; +Cc: Patches and discussions about the oe-core layer



On 09/17/2018 01:50 PM, Martin Jansa wrote:
> On Fri, Sep 14, 2018 at 03:25:58PM +0200, Martin Jansa wrote:
>> This seems to cause nativesdk-glibc failures when DEBUG_BUILD is used, it
>> fails like this:
>>
>> ../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':
>> ../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used
>> uninitialized in this function [-Werror=maybe-uninitialized]
>>        b = invsqrtpi * temp / sqrtl (x);
>>            ~~~~~~~~~~^~~~~~
>>
>> the target build suffers from the same, that's why I was using this for a
>> while:
>> # glibc-2.21 fails to build with:
>> # iso-2022-cn-ext.c:501:4: error: 'tmpbuf' may be used uninitialized in
>> this function [-Werror=maybe-uninitialized]
>> # connections.c:1916:1: error: inlining failed in call to 'clear_db_cache':
>> call is unlikely and code size would grow [-Werror=inline]
>> # add few -Wno-error like meta/recipes-core/glibc/glibc.inc is trying to
>> doin get_optimization function,
>> # but fails because we append -Os at the end and -O2 is found first
>> SELECTED_OPTIMIZATION_append_pn-glibc =
>> "${@bb.utils.contains('TUNE_FEATURES', 'webos-minsize', '
>> -Wno-error=maybe-uninitialized -Wno-error=inline', '', d)}"
>>
>>
>> There is some logic in meta/recipes-core/glibc/glibc.inc to
>> append -Wno-error to SELECTED_OPTIMIZATION when "-O", "-O1", "-Os" is used,
>> but the same would be needed for BUILD_OPTIMIZATION now.
>>
>> Or maybe it would be worth marking those uninitialized/unused variables
>> with #pragma instead of injecting -Wno-error?
>>
>> Then we can get rid of:
>> python () {
>>      opt_effective = "-O"
>>      for opt in d.getVar('SELECTED_OPTIMIZATION').split():
>>          if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):
>>              opt_effective = opt
>>      if opt_effective == "-O0":
>>          bb.fatal("%s can't be built with %s, try -O1 instead" %
>> (d.getVar('PN'), opt_effective))
>>      if opt_effective in ("-O", "-O1", "-Os"):
>>          bb.note("%s doesn't build cleanly with %s, adding -Wno-error to
>> SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective))
>>          d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
>> }
>> from meta/recipes-core/glibc/glibc.inc (not use about -O0 case) and remove
>> following notes:
>> NOTE: glibc doesn't build cleanly with -O, adding -Wno-error to
>> SELECTED_OPTIMIZATION
>> NOTE: nativesdk-glibc doesn't build cleanly with -O, adding -Wno-error to
>> SELECTED_OPTIMIZATION
>> from every build with DEBUG_BUILD enabled.
>>
>> What would be the preferred fix?
> 
> I've sent possible fix here:
> http://lists.openembedded.org/pipermail/openembedded-core/2018-September/155744.html

Thanks, it seems the right fix to me.

// Robert

> 
>>
>> On Wed, Sep 5, 2018 at 9:05 AM Robert Yang <liezhi.yang@windriver.com>
>> wrote:
>>
>>> We may also need debug native tools, so make BUILD_OPTIMIZATION respect to
>>> DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't
>>> convenient.
>>>
>>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>>> ---
>>>   meta/conf/bitbake.conf | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
>>> index dbadeb3..93aee1a 100644
>>> --- a/meta/conf/bitbake.conf
>>> +++ b/meta/conf/bitbake.conf
>>> @@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
>>>   DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
>>>   SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
>>> 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
>>>   SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
>>> -BUILD_OPTIMIZATION = "-O2 -pipe"
>>> +BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g
>>> -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)} -pipe"
>>>
>>>   ##################################################################
>>>   # Settings used by bitbake-layers.
>>> --
>>> 2.7.4
>>>
>>> --
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>>
> 


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

end of thread, other threads:[~2018-09-17  9:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05  7:16 [PATCH 0/2 V2] Add oe.utils.vartrue() and update BUILD_OPTIMIZATION Robert Yang
2018-09-05  7:16 ` [PATCH 1/2 V2] oe/utils.py: Add vartrue() Robert Yang
2018-09-05  7:33   ` Peter Kjellerstedt
2018-09-05  8:11     ` Robert Yang
2018-09-05 19:22       ` Peter Kjellerstedt
2018-09-05 19:31       ` Richard Purdie
2018-09-05 10:38   ` Martin Jansa
2018-09-05 10:56     ` Richard Purdie
2018-09-05  7:16 ` [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD Robert Yang
2018-09-14 13:25   ` Martin Jansa
2018-09-17  5:50     ` Martin Jansa
2018-09-17  9:57       ` Robert Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.