[bitbake-devel] [PATCH 1/1] cooker.py: use depends instead of tdepends to generate recipe-depends.dot

Chen Qi Qi.Chen at windriver.com
Wed Aug 21 09:01:06 UTC 2019


Currently recipe-depends.dot generated by `bitbake -g' is just
a variant of task-depends.dot. It could be generated by removing the
task names from task-depends.dot. In fact, the codes are using the
same data depgraph['tdepends'] to generate the dot files.

In other words, the current recipe-depends.dot does not provide additional
information than task-depends.dot.

What's worse, this is confusing users when they try to find out the
dependencies among recipes.

e.g.
$ grep xz recipe-depends.dot | grep bzip2
"bzip2" -> "xz"
"xz" -> "bzip2"

They would ask why 'bzip2' depends on 'xz' while 'xz' also
depends on 'bzip2'. It looks like a circular dependency. And it's not
helping user finding out which recipe depends on which.

So change to use depgraph['depends'] to generate the recipe-depends.dot.
After the change, there's no such confusing.

Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
---
 bitbake/lib/bb/cooker.py | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 0607fcc..4628f08 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -934,19 +934,12 @@ class BBCooker:
 
         with open('recipe-depends.dot', 'w') as f:
             f.write("digraph depends {\n")
-            pndeps = {}
-            for task in sorted(depgraph["tdepends"]):
-                (pn, taskname) = task.rsplit(".", 1)
-                if pn not in pndeps:
-                    pndeps[pn] = set()
-                for dep in sorted(depgraph["tdepends"][task]):
-                    (deppn, deptaskname) = dep.rsplit(".", 1)
-                    pndeps[pn].add(deppn)
-            for pn in sorted(pndeps):
+            for pn in sorted(depgraph["depends"]):
+                deps = depgraph["depends"][pn]
                 fn = depgraph["pn"][pn]["filename"]
                 version = depgraph["pn"][pn]["version"]
                 f.write('"%s" [label="%s\\n%s\\n%s"]\n' % (pn, pn, version, fn))
-                for dep in sorted(pndeps[pn]):
+                for dep in sorted(deps):
                     if dep == pn:
                         continue
                     f.write('"%s" -> "%s"\n' % (pn, dep))
-- 
1.9.1



More information about the bitbake-devel mailing list