Skip to contentSkip to conversation

oe-depends-dot: Handle new format for task-depends.dot

PATCH In review Rusty Howell 4 participants 5 messages May 24, 2022 – Jan 9, 2023 1 message not in the archive

lore
Share & tools
lore
#0 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.

---
 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)
Signature · 1 line
2.25.1
#1 lore raw

Hi Rusty,

Il giorno Tue, 24 May 2022 15:02:40 -0600 "Rusty Howell" <[email protected]> ha scritto:

Quoted 10 lines

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.

---
 scripts/oe-depends-dot | 21 ++++++++++++++++++++-

Thanks for you rpatch. However it should be sent to the oe-core mailing list, as described in README.poky.md.

No need to resend it I'm taking for testing on the appropriate repository, but please keep this in mind in case you send other patches in the future.

Kind regards.

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

A message that is not in the archive (sent off-list or not yet received): CAE+BM3kGWGTcOaAS9bD=z3W6fY6MpU0EmXLkkw4zW5TFZ5sSbg@mail.gmail.com

#3 lore raw

Il giorno Wed, 25 May 2022 10:46:14 -0600
Rusty Howell <[email protected]> ha scritto:

Quoted 2 lines

Thanks for the information. I've never submitted a patch to OSS stuff before, so sorry for the mess up.

No problem. Your patch is already cleaner than many I see daily. A good achievement if this is your first submission!

Only, in the future please use "reply to all", so the mailing list is kept updated on the discussion. Thanks!

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
In reply to Rusty Howell
Quoted 5 lines · Rusty Howell

From: Rusty Howell <[email protected]>

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

Should this patch be taken for kirkstone too?

Is this the bitbake format change you refer to in the commit description?

https://git.openembedded.org/bitbake-contrib/commit/?h=stable/2.0-nut&id=1d5ca721040c5e39aefa11219f62710de6587701

Steve

Quoted 65 lines

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

---
 scripts/oe-depends-dot | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
scripts/oe-depends-dot +20 -2
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.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12790): https://lists.yoctoproject.org/g/poky/message/12790
Mute This Topic: https://lists.yoctoproject.org/mt/91320803/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

Hi Steve,

Quoted 9 lines · Steve Sakoman
Quoted 5 lines · Rusty Howell

From: Rusty Howell <[email protected]>

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

Should this patch be taken for kirkstone too?

I believe so, without:

$ oe-depends-dot -k init-ifupdown:do_compile -w task-depends.dot
ERROR: Can't find key init-ifupdown:do_compile in task-depends.dot

with:

$ oe-depends-dot -k init-ifupdown -w task-depends.dot
Because: packagegroup-core-boot theobroma-demo-image
theobroma-demo-image -> packagegroup-core-boot -> init-ifupdown

Tested on Kirkstone 4.0.6.

Cheers,
Quentin