Skip to contentSkip to conversation

backport patch to oe-depends-dot

PATCH New [email protected] 1 participant 2 messages Jul 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backport patch to oe-depends-dot

Without this patch, the call to oe-depends-dot will have no valid output.

Best,
Jan-Simon

#1 lore raw

PATCH 1/1 oe-depends-dot: Handle new format for task-depends.dot

From: Rusty Howell <[email protected]>

The .dot file created by bitbake -g changed formats a while ago, which broke oe-depends-dot.

Also add some useful examples to the --help output.

(cherry picked from commit 7751bc4909f3834e43db020ebb91665a5d7960a9)
---
 scripts/oe-depends-dot | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
scripts/oe-depends-dot +20 -1
index 5eb3e12769..1c2d51c6ec 100755
@@ -15,7 +15,7 @@ class Dot(object):
     def __init__(self):
         parser = argparse.ArgumentParser(
             description="Analyse recipe-depends.dot generated by bitbake -g",
-            epilog="Use %(prog)s --help to get help")
+            formatter_class=argparse.RawDescriptionHelpFormatter)
         parser.add_argument("dotfile",
             help = "Specify the dotfile", nargs = 1, action='store', default='')
         parser.add_argument("-k", "--key",
@@ -32,6 +32,21 @@ class Dot(object):
                     " For example, A->B, B->C, A->C, then A->C can be removed.",
             action="store_true", default=False)
 
+        parser.epilog = """
+Examples:
+First generate the .dot file:
+    bitbake -g core-image-minimal
+
+To find out why a package is being built:
+    %(prog)s -k <package> -w ./task-depends.dot
+
+To find out what a package depends on:
+    %(prog)s -k <package> -d ./task-depends.dot
+
+Reduce the .dot file packages only, no tasks:
+    %(prog)s -r ./task-depends.dot
+"""
+
         self.args = parser.parse_args()
 
         if len(sys.argv) != 3 and len(sys.argv) < 5:
@@ -99,6 +114,10 @@ class Dot(object):
                 if key == "meta-world-pkgdata":
                     continue
                 dep = m.group(2)
+                key = key.split('.')[0]
+                dep = dep.split('.')[0]
+                if key == dep:
+                    continue
                 if key in depends:
                     if not key in depends[key]:
                         depends[key].add(dep)

--
2.41.0