public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update
@ 2018-02-08 11:26 claudius.heine.ext
  2018-02-08 13:55 ` Alexander Smirnov
  0 siblings, 1 reply; 7+ messages in thread
From: claudius.heine.ext @ 2018-02-08 11:26 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Those tasks were broken, this patchs fixes by implementing them similar
to how openembedded-core does it.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 meta/classes/base.bbclass | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 7d44f72..448dd67 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -40,22 +40,28 @@ bbfatal() {
 addtask showdata
 do_showdata[nostamp] = "1"
 python do_showdata() {
-	import sys
-	# emit variables and shell functions
-	bb.data.emit_env(sys.__stdout__, d, True)
-	# emit the metadata which isnt valid shell
-	for e in bb.data.keys(d):
-		if bb.data.getVarFlag(e, 'python', d):
-			sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))
+    for e in d.keys():
+        if d.getVarFlag(e, 'python'):
+            bb.plain("\npython %s () {\n%s}\n" % (e, d.getVar(e, True)))
 }
 
 addtask listtasks
 do_listtasks[nostamp] = "1"
 python do_listtasks() {
-	import sys
-	for e in bb.data.keys(d):
-		if bb.data.getVarFlag(e, 'task', d):
-			sys.__stdout__.write("%s\n" % e)
+    taskdescs = {}
+    maxlen = 0
+    for e in d.keys():
+        if d.getVarFlag(e, 'task'):
+            maxlen = max(maxlen, len(e))
+            if e.endswith('_setscene'):
+                desc = "%s (setscene version)" % (d.getVarFlag(e[:-9], 'doc') or '')
+            else:
+                desc = d.getVarFlag(e, 'doc') or ''
+            taskdescs[e] = desc
+
+    tasks = sorted(taskdescs.keys())
+    for taskname in tasks:
+        bb.plain("%s  %s" % (taskname.ljust(maxlen), taskdescs[taskname]))
 }
 
 do_fetch[dirs] = "${DL_DIR}"
-- 
2.15.1


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

* Re: [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update
  2018-02-08 11:26 [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update claudius.heine.ext
@ 2018-02-08 13:55 ` Alexander Smirnov
  2018-02-08 15:24   ` Claudius Heine
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Smirnov @ 2018-02-08 13:55 UTC (permalink / raw)
  To: claudius.heine.ext, isar-users; +Cc: Claudius Heine

Hi,

On 02/08/2018 02:26 PM, claudius.heine.ext@siemens.com wrote:
> From: Claudius Heine <ch@denx.de>
> 
> Those tasks were broken, this patchs fixes by implementing them similar
> to how openembedded-core does it.
> 

I see that this code is identical to OE one, do you know which copyright 
it is? If this code is copied from OE, I think it makes sense to mention 
this explicitly in the code.

Alex

> Signed-off-by: Claudius Heine <ch@denx.de>
> ---
>   meta/classes/base.bbclass | 28 +++++++++++++++++-----------
>   1 file changed, 17 insertions(+), 11 deletions(-)
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 7d44f72..448dd67 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -40,22 +40,28 @@ bbfatal() {
>   addtask showdata
>   do_showdata[nostamp] = "1"
>   python do_showdata() {
> -	import sys
> -	# emit variables and shell functions
> -	bb.data.emit_env(sys.__stdout__, d, True)
> -	# emit the metadata which isnt valid shell
> -	for e in bb.data.keys(d):
> -		if bb.data.getVarFlag(e, 'python', d):
> -			sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))
> +    for e in d.keys():
> +        if d.getVarFlag(e, 'python'):
> +            bb.plain("\npython %s () {\n%s}\n" % (e, d.getVar(e, True)))
>   }
>   
>   addtask listtasks
>   do_listtasks[nostamp] = "1"
>   python do_listtasks() {
> -	import sys
> -	for e in bb.data.keys(d):
> -		if bb.data.getVarFlag(e, 'task', d):
> -			sys.__stdout__.write("%s\n" % e)
> +    taskdescs = {}
> +    maxlen = 0
> +    for e in d.keys():
> +        if d.getVarFlag(e, 'task'):
> +            maxlen = max(maxlen, len(e))
> +            if e.endswith('_setscene'):
> +                desc = "%s (setscene version)" % (d.getVarFlag(e[:-9], 'doc') or '')
> +            else:
> +                desc = d.getVarFlag(e, 'doc') or ''
> +            taskdescs[e] = desc
> +
> +    tasks = sorted(taskdescs.keys())
> +    for taskname in tasks:
> +        bb.plain("%s  %s" % (taskname.ljust(maxlen), taskdescs[taskname]))
>   }
>   
>   do_fetch[dirs] = "${DL_DIR}"
>

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

* Re: [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update
  2018-02-08 13:55 ` Alexander Smirnov
@ 2018-02-08 15:24   ` Claudius Heine
  2018-02-08 15:40     ` Claudius Heine
  2018-02-08 15:47     ` Alexander Smirnov
  0 siblings, 2 replies; 7+ messages in thread
From: Claudius Heine @ 2018-02-08 15:24 UTC (permalink / raw)
  To: Alexander Smirnov, isar-users; +Cc: Claudius Heine

Hi Alex,

On 02/08/2018 02:55 PM, Alexander Smirnov wrote:
> Hi,
> 
> On 02/08/2018 02:26 PM, claudius.heine.ext@siemens.com wrote:
>> From: Claudius Heine <ch@denx.de>
>>
>> Those tasks were broken, this patchs fixes by implementing them similar
>> to how openembedded-core does it.
>>
> 
> I see that this code is identical to OE one, do you know which copyright 
> it is? If this code is copied from OE, I think it makes sense to mention 
> this explicitly in the code.

Sure, I got it from [1], and this file does not have an own header, so I 
suppose its MIT or GPLv2. I don't know if this falls under 'metadata' or 
not. Since Isar uses the same licenses, you might know what exactly is 
meant by that.

How are you proposing to name the authors?

Cheers,
Claudius

[1] 
http://git.openembedded.org/openembedded-core/tree/meta/classes/utility-tasks.bbclass

> 
> Alex
> 
>> Signed-off-by: Claudius Heine <ch@denx.de>
>> ---
>>   meta/classes/base.bbclass | 28 +++++++++++++++++-----------
>>   1 file changed, 17 insertions(+), 11 deletions(-)
>>
>> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
>> index 7d44f72..448dd67 100644
>> --- a/meta/classes/base.bbclass
>> +++ b/meta/classes/base.bbclass
>> @@ -40,22 +40,28 @@ bbfatal() {
>>   addtask showdata
>>   do_showdata[nostamp] = "1"
>>   python do_showdata() {
>> -    import sys
>> -    # emit variables and shell functions
>> -    bb.data.emit_env(sys.__stdout__, d, True)
>> -    # emit the metadata which isnt valid shell
>> -    for e in bb.data.keys(d):
>> -        if bb.data.getVarFlag(e, 'python', d):
>> -            sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, 
>> bb.data.getVar(e, d, 1)))
>> +    for e in d.keys():
>> +        if d.getVarFlag(e, 'python'):
>> +            bb.plain("\npython %s () {\n%s}\n" % (e, d.getVar(e, True)))
>>   }
>>   addtask listtasks
>>   do_listtasks[nostamp] = "1"
>>   python do_listtasks() {
>> -    import sys
>> -    for e in bb.data.keys(d):
>> -        if bb.data.getVarFlag(e, 'task', d):
>> -            sys.__stdout__.write("%s\n" % e)
>> +    taskdescs = {}
>> +    maxlen = 0
>> +    for e in d.keys():
>> +        if d.getVarFlag(e, 'task'):
>> +            maxlen = max(maxlen, len(e))
>> +            if e.endswith('_setscene'):
>> +                desc = "%s (setscene version)" % 
>> (d.getVarFlag(e[:-9], 'doc') or '')
>> +            else:
>> +                desc = d.getVarFlag(e, 'doc') or ''
>> +            taskdescs[e] = desc
>> +
>> +    tasks = sorted(taskdescs.keys())
>> +    for taskname in tasks:
>> +        bb.plain("%s  %s" % (taskname.ljust(maxlen), 
>> taskdescs[taskname]))
>>   }
>>   do_fetch[dirs] = "${DL_DIR}"
>>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

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

* Re: [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update
  2018-02-08 15:24   ` Claudius Heine
@ 2018-02-08 15:40     ` Claudius Heine
  2018-02-08 15:47     ` Alexander Smirnov
  1 sibling, 0 replies; 7+ messages in thread
From: Claudius Heine @ 2018-02-08 15:40 UTC (permalink / raw)
  To: Alexander Smirnov, isar-users; +Cc: Claudius Heine

Hi again,

On 02/08/2018 04:24 PM, [ext] Claudius Heine wrote:
> Hi Alex,
> 
> On 02/08/2018 02:55 PM, Alexander Smirnov wrote:
>> Hi,
>>
>> On 02/08/2018 02:26 PM, claudius.heine.ext@siemens.com wrote:
>>> From: Claudius Heine <ch@denx.de>
>>>
>>> Those tasks were broken, this patchs fixes by implementing them similar
>>> to how openembedded-core does it.
>>>
>>
>> I see that this code is identical to OE one, do you know which 
>> copyright it is? If this code is copied from OE, I think it makes 
>> sense to mention this explicitly in the code.
> 
> Sure, I got it from [1], and this file does not have an own header, so I 
> suppose its MIT or GPLv2. I don't know if this falls under 'metadata' or 
> not. Since Isar uses the same licenses, you might know what exactly is 
> meant by that.

Just randomly read in the bitbake manual that recipes and classes [1] 
are considered metadata, so they would be MIT and naming authors would 
not be needed in this case.

Cheers,
Claudius

[1] 
https://www.yoctoproject.org/docs/latest/bitbake-user-manual/bitbake-user-manual.html#bitbake-style-python-functions-versus-python-functions 
(second note box)

> 
> How are you proposing to name the authors?
> 
> Cheers,
> Claudius
> 
> [1] 
> http://git.openembedded.org/openembedded-core/tree/meta/classes/utility-tasks.bbclass 
> 
> 
>>
>> Alex
>>
>>> Signed-off-by: Claudius Heine <ch@denx.de>
>>> ---
>>>   meta/classes/base.bbclass | 28 +++++++++++++++++-----------
>>>   1 file changed, 17 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
>>> index 7d44f72..448dd67 100644
>>> --- a/meta/classes/base.bbclass
>>> +++ b/meta/classes/base.bbclass
>>> @@ -40,22 +40,28 @@ bbfatal() {
>>>   addtask showdata
>>>   do_showdata[nostamp] = "1"
>>>   python do_showdata() {
>>> -    import sys
>>> -    # emit variables and shell functions
>>> -    bb.data.emit_env(sys.__stdout__, d, True)
>>> -    # emit the metadata which isnt valid shell
>>> -    for e in bb.data.keys(d):
>>> -        if bb.data.getVarFlag(e, 'python', d):
>>> -            sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, 
>>> bb.data.getVar(e, d, 1)))
>>> +    for e in d.keys():
>>> +        if d.getVarFlag(e, 'python'):
>>> +            bb.plain("\npython %s () {\n%s}\n" % (e, d.getVar(e, 
>>> True)))
>>>   }
>>>   addtask listtasks
>>>   do_listtasks[nostamp] = "1"
>>>   python do_listtasks() {
>>> -    import sys
>>> -    for e in bb.data.keys(d):
>>> -        if bb.data.getVarFlag(e, 'task', d):
>>> -            sys.__stdout__.write("%s\n" % e)
>>> +    taskdescs = {}
>>> +    maxlen = 0
>>> +    for e in d.keys():
>>> +        if d.getVarFlag(e, 'task'):
>>> +            maxlen = max(maxlen, len(e))
>>> +            if e.endswith('_setscene'):
>>> +                desc = "%s (setscene version)" % 
>>> (d.getVarFlag(e[:-9], 'doc') or '')
>>> +            else:
>>> +                desc = d.getVarFlag(e, 'doc') or ''
>>> +            taskdescs[e] = desc
>>> +
>>> +    tasks = sorted(taskdescs.keys())
>>> +    for taskname in tasks:
>>> +        bb.plain("%s  %s" % (taskname.ljust(maxlen), 
>>> taskdescs[taskname]))
>>>   }
>>>   do_fetch[dirs] = "${DL_DIR}"
>>>
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

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

* Re: [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update
  2018-02-08 15:24   ` Claudius Heine
  2018-02-08 15:40     ` Claudius Heine
@ 2018-02-08 15:47     ` Alexander Smirnov
  2018-02-08 16:13       ` Jan Kiszka
  1 sibling, 1 reply; 7+ messages in thread
From: Alexander Smirnov @ 2018-02-08 15:47 UTC (permalink / raw)
  To: Kiszka, Jan, isar-users; +Cc: Claudius Heine

On 02/08/2018 06:24 PM, Claudius Heine wrote:
> Hi Alex,
> 
> On 02/08/2018 02:55 PM, Alexander Smirnov wrote:
>> Hi,
>>
>> On 02/08/2018 02:26 PM, claudius.heine.ext@siemens.com wrote:
>>> From: Claudius Heine <ch@denx.de>
>>>
>>> Those tasks were broken, this patchs fixes by implementing them similar
>>> to how openembedded-core does it.
>>>
>>
>> I see that this code is identical to OE one, do you know which 
>> copyright it is? If this code is copied from OE, I think it makes 
>> sense to mention this explicitly in the code.
> 
> Sure, I got it from [1], and this file does not have an own header, so I 
> suppose its MIT or GPLv2. I don't know if this falls under 'metadata' or 
> not. Since Isar uses the same licenses, you might know what exactly is 
> meant by that.
> 
> How are you proposing to name the authors?

I see it something like:

# Derived from openembedded-core/meta/classes/utility-tasks.bbclass

@Jan: do you think we should keep this reference?

Alex

> 
> Cheers,
> Claudius
> 
> [1] 
> http://git.openembedded.org/openembedded-core/tree/meta/classes/utility-tasks.bbclass 
> 
> 
>>
>> Alex
>>
>>> Signed-off-by: Claudius Heine <ch@denx.de>
>>> ---
>>>   meta/classes/base.bbclass | 28 +++++++++++++++++-----------
>>>   1 file changed, 17 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
>>> index 7d44f72..448dd67 100644
>>> --- a/meta/classes/base.bbclass
>>> +++ b/meta/classes/base.bbclass
>>> @@ -40,22 +40,28 @@ bbfatal() {
>>>   addtask showdata
>>>   do_showdata[nostamp] = "1"
>>>   python do_showdata() {
>>> -    import sys
>>> -    # emit variables and shell functions
>>> -    bb.data.emit_env(sys.__stdout__, d, True)
>>> -    # emit the metadata which isnt valid shell
>>> -    for e in bb.data.keys(d):
>>> -        if bb.data.getVarFlag(e, 'python', d):
>>> -            sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, 
>>> bb.data.getVar(e, d, 1)))
>>> +    for e in d.keys():
>>> +        if d.getVarFlag(e, 'python'):
>>> +            bb.plain("\npython %s () {\n%s}\n" % (e, d.getVar(e, 
>>> True)))
>>>   }
>>>   addtask listtasks
>>>   do_listtasks[nostamp] = "1"
>>>   python do_listtasks() {
>>> -    import sys
>>> -    for e in bb.data.keys(d):
>>> -        if bb.data.getVarFlag(e, 'task', d):
>>> -            sys.__stdout__.write("%s\n" % e)
>>> +    taskdescs = {}
>>> +    maxlen = 0
>>> +    for e in d.keys():
>>> +        if d.getVarFlag(e, 'task'):
>>> +            maxlen = max(maxlen, len(e))
>>> +            if e.endswith('_setscene'):
>>> +                desc = "%s (setscene version)" % 
>>> (d.getVarFlag(e[:-9], 'doc') or '')
>>> +            else:
>>> +                desc = d.getVarFlag(e, 'doc') or ''
>>> +            taskdescs[e] = desc
>>> +
>>> +    tasks = sorted(taskdescs.keys())
>>> +    for taskname in tasks:
>>> +        bb.plain("%s  %s" % (taskname.ljust(maxlen), 
>>> taskdescs[taskname]))
>>>   }
>>>   do_fetch[dirs] = "${DL_DIR}"
>>>
> 

-- 
With best regards,
Alexander Smirnov

ilbers GmbH
Baierbrunner Str. 28c
D-81379 Munich
+49 (89) 122 67 24-0
http://ilbers.de/
Commercial register Munich, HRB 214197
General manager: Baurzhan Ismagulov

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

* Re: [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update
  2018-02-08 15:47     ` Alexander Smirnov
@ 2018-02-08 16:13       ` Jan Kiszka
  2018-02-08 16:18         ` Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2018-02-08 16:13 UTC (permalink / raw)
  To: Alexander Smirnov, isar-users; +Cc: Claudius Heine

On 2018-02-08 16:47, Alexander Smirnov wrote:
> On 02/08/2018 06:24 PM, Claudius Heine wrote:
>> Hi Alex,
>>
>> On 02/08/2018 02:55 PM, Alexander Smirnov wrote:
>>> Hi,
>>>
>>> On 02/08/2018 02:26 PM, claudius.heine.ext@siemens.com wrote:
>>>> From: Claudius Heine <ch@denx.de>
>>>>
>>>> Those tasks were broken, this patchs fixes by implementing them similar
>>>> to how openembedded-core does it.
>>>>
>>>
>>> I see that this code is identical to OE one, do you know which
>>> copyright it is? If this code is copied from OE, I think it makes
>>> sense to mention this explicitly in the code.
>>
>> Sure, I got it from [1], and this file does not have an own header, so
>> I suppose its MIT or GPLv2. I don't know if this falls under
>> 'metadata' or not. Since Isar uses the same licenses, you might know
>> what exactly is meant by that.
>>
>> How are you proposing to name the authors?
> 
> I see it something like:
> 
> # Derived from openembedded-core/meta/classes/utility-tasks.bbclass
> 
> @Jan: do you think we should keep this reference?

It doesn't harm us, I would say.

In general, it would be better for Isar (compared to OE) to have clear
licensing statements in each file. State-of-the-art is leaving the right
SPDX-License-Identifier behind.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

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

* Re: [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update
  2018-02-08 16:13       ` Jan Kiszka
@ 2018-02-08 16:18         ` Jan Kiszka
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Kiszka @ 2018-02-08 16:18 UTC (permalink / raw)
  To: Alexander Smirnov, isar-users; +Cc: Claudius Heine

On 2018-02-08 17:13, Jan Kiszka wrote:
> On 2018-02-08 16:47, Alexander Smirnov wrote:
>> On 02/08/2018 06:24 PM, Claudius Heine wrote:
>>> Hi Alex,
>>>
>>> On 02/08/2018 02:55 PM, Alexander Smirnov wrote:
>>>> Hi,
>>>>
>>>> On 02/08/2018 02:26 PM, claudius.heine.ext@siemens.com wrote:
>>>>> From: Claudius Heine <ch@denx.de>
>>>>>
>>>>> Those tasks were broken, this patchs fixes by implementing them similar
>>>>> to how openembedded-core does it.
>>>>>
>>>>
>>>> I see that this code is identical to OE one, do you know which
>>>> copyright it is? If this code is copied from OE, I think it makes
>>>> sense to mention this explicitly in the code.
>>>
>>> Sure, I got it from [1], and this file does not have an own header, so
>>> I suppose its MIT or GPLv2. I don't know if this falls under
>>> 'metadata' or not. Since Isar uses the same licenses, you might know
>>> what exactly is meant by that.
>>>
>>> How are you proposing to name the authors?
>>
>> I see it something like:
>>
>> # Derived from openembedded-core/meta/classes/utility-tasks.bbclass
>>
>> @Jan: do you think we should keep this reference?
> 
> It doesn't harm us, I would say.
> 
> In general, it would be better for Isar (compared to OE) to have clear
> licensing statements in each file. State-of-the-art is leaving the right
> SPDX-License-Identifier behind.

...which I didn't do either in my recent patches. Will fix and send v2.

How about this pattern:

# SPDX-License-Identifier: MIT
#
# <some optional file description>
#
# This software is a part of ISAR.
# Copyright (c) Siemens AG, 2018
#

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

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

end of thread, other threads:[~2018-02-08 16:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 11:26 [PATCH] meta/classes/base: Fix showdata and liststasks after bitbake update claudius.heine.ext
2018-02-08 13:55 ` Alexander Smirnov
2018-02-08 15:24   ` Claudius Heine
2018-02-08 15:40     ` Claudius Heine
2018-02-08 15:47     ` Alexander Smirnov
2018-02-08 16:13       ` Jan Kiszka
2018-02-08 16:18         ` Jan Kiszka

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