Skip to contentSkip to conversation

cooker.py: use depends instead of tdepends to generate recipe-depends.dot

PATCH In review Chen Qi 2 participants 3 messages Aug 21, 2019

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover cooker.py: use depends instead of tdepends to generate recipe-depends.dot

*** BLURB HERE ***
The following changes since commit 20946c63c272b2128e6dc76490313b174ee97d8e:

bitbake: runqueue: Ensure target_tids is filtered (2019-08-16 10:05:33 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/recipe-depends
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/recipe-depends

Chen Qi (1):
cooker.py: use depends instead of tdepends to generate
recipe-depends.dot

 bitbake/lib/bb/cooker.py | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

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

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.

---
 bitbake/lib/bb/cooker.py | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
bitbake/lib/bb/cooker.py +3 -10
index 0607fcc..4628f08 100644
@@ -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))
Signature · 1 line
1.9.1
#2 lore raw
Quoted 17 lines · Chen Qi

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"
Quoted 7 lines

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.

We can't win with this and I'd rather remove it than give misleading information.

"depends" doesn't account for rdepends or task dependencies so after this change, task-depends could show A -> B but recipe-depends.dot and this is even more confusing to the user.

http://git.yoctoproject.org/cgit.cgi/poky/commit/bitbake/lib/bb/cooker.py?id=6cfc1c83b90c9c9dd5290749aed49896327739e6

is the commit where we attempted to fix this. Keeping a "flattened tree" was done to try and help users but I don't want to go back to where we had misleading information which using "depends" would do.

Cheers,

Richard