public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] meta/classes/base: fixed listtasks by copying code from oe-core
@ 2018-02-08  9:57 claudius.heine.ext
  2018-02-08  9:58 ` Claudius Heine
  0 siblings, 1 reply; 2+ messages in thread
From: claudius.heine.ext @ 2018-02-08  9:57 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

The listtasks task seemed to be broken, here I fixed it by just copying
the code from openembedded-core.

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

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 7d44f72..ede2c3e 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -37,16 +37,23 @@ bbfatal() {
 	exit 1
 }
 
-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)))
+addtask listtasks
+do_listtasks[nostamp] = "1"
+python do_listtasks() {
+    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]))
 }
 
 addtask listtasks
-- 
2.15.1


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

* Re: [PATCH] meta/classes/base: fixed listtasks by copying code from oe-core
  2018-02-08  9:57 [PATCH] meta/classes/base: fixed listtasks by copying code from oe-core claudius.heine.ext
@ 2018-02-08  9:58 ` Claudius Heine
  0 siblings, 0 replies; 2+ messages in thread
From: Claudius Heine @ 2018-02-08  9:58 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

Hi,

please ignore, patch is wrong!

Thanks
Claudius

On 02/08/2018 10:57 AM, [ext] claudius.heine.ext@siemens.com wrote:
> From: Claudius Heine <ch@denx.de>
> 
> The listtasks task seemed to be broken, here I fixed it by just copying
> the code from openembedded-core.
> 
> Signed-off-by: Claudius Heine <ch@denx.de>
> ---
>   meta/classes/base.bbclass | 27 +++++++++++++++++----------
>   1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 7d44f72..ede2c3e 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -37,16 +37,23 @@ bbfatal() {
>   	exit 1
>   }
>   
> -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)))
> +addtask listtasks
> +do_listtasks[nostamp] = "1"
> +python do_listtasks() {
> +    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]))
>   }
>   
>   addtask listtasks
> 

-- 
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] 2+ messages in thread

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08  9:57 [PATCH] meta/classes/base: fixed listtasks by copying code from oe-core claudius.heine.ext
2018-02-08  9:58 ` Claudius Heine

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