oe-depends-dot: improve '-w' behavior

The '-w' option is not giving very helpful information. For example,
if we add 'spice' to IMAGE_INSTALL, bitbake -g core-image-minimal,
and then run `oe-depends-dot -k nspr -w task-depends.dot', the result is:

  $ oe-depends-dot -k nspr -w task-depends.dot
  Because: core-image-minimal nss
  core-image-minimal -> nss -> nspr

The result is not showing the full dependency chain which brings in nspr.
With this patch, the result is:

  $ oe-depends-dot -k nspr -w task-depends.dot
  Because: core-image-minimal nss libcacard spice
  core-image-minimal -> spice -> libcacard -> nss -> nspr

This patch also fixes a typo in help message: recipe-depends.dot -> task-depends.dot.

(From OE-Core rev: 222302810c472c8eb2efceaa757a253dcac5618f)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chen Qi 2023-08-30 01:21:58 -07:00 committed by Richard Purdie
parent 81b2eedb69
commit 597c42f3df

View File

@ -14,7 +14,7 @@ import re
class Dot(object):
def __init__(self):
parser = argparse.ArgumentParser(
description="Analyse recipe-depends.dot generated by bitbake -g",
description="Analyse task-depends.dot generated by bitbake -g",
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("dotfile",
help = "Specify the dotfile", nargs = 1, action='store', default='')
@ -159,9 +159,14 @@ Reduce the .dot file packages only, no tasks:
reverse_deps = []
if self.args.why:
for k, v in depends.items():
if self.args.key in v and not k in reverse_deps:
reverse_deps.append(k)
key_list = [self.args.key]
current_key = self.args.key
while (len(key_list) != 0):
current_key = key_list.pop()
for k, v in depends.items():
if current_key in v and not k in reverse_deps:
reverse_deps.append(k)
key_list.append(k)
print('Because: %s' % ' '.join(reverse_deps))
Dot.print_dep_chains(self.args.key, reverse_deps, depends)