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

Submitted by Qi.Chen@windriver.com on Aug. 21, 2019, 9:01 a.m. | Patch ID: 164173

Details

Message ID 95ce0e9944624dbdceaa340b762a32e60f115679.1566378022.git.Qi.Chen@windriver.com
State New
Headers show

Commit Message

Qi.Chen@windriver.com Aug. 21, 2019, 9:01 a.m.
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@windriver.com>
---
 bitbake/lib/bb/cooker.py | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

Patch hide | download patch | download mbox

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))

Comments

Richard Purdie Aug. 21, 2019, 2:28 p.m.
On Wed, 2019-08-21 at 17:01 +0800, Chen Qi wrote:
> 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.

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