diff mbox series

[4/4] scripts/oe-depends-dot: give the dotfile argument a sensible default

Message ID 20260904-oe-depends-dot-cleanups-v1-4-b56bf05fc5fd@bootlin.com
State Under Review
Headers show
Series Minor cleanups and improvements for script/oe-depends-dot | expand

Commit Message

Antonin Godard Sept. 4, 2026, 8:23 a.m. UTC
Running this script mostly happens after running 'bitbake -g <recipe>',
which generates the task-depends.dot file in the current working
directory with the name 'task-depends.dot'.

Make the dotfile positional argument optional with './task-depends.dot'
as default value, so we can run the command without specify it each
time. If the file doesn't exist, hint the user at what to do (run
bitbake -g).

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 scripts/oe-depends-dot | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/oe-depends-dot b/scripts/oe-depends-dot
index 560d2fd2bb..92e68e74ae 100755
--- a/scripts/oe-depends-dot
+++ b/scripts/oe-depends-dot
@@ -17,7 +17,8 @@  class Dot(object):
             description="Analyse task-depends.dot generated by bitbake -g",
             formatter_class=argparse.RawDescriptionHelpFormatter)
         parser.add_argument("dotfile",
-            help = "Specify the dotfile", action='store', default='')
+            help = "Dotfile to inspect (default: ./task-depends.dot)",
+            nargs='?', action='store', default='./task-depends.dot')
         parser.add_argument("-k", "--key",
             help = "Specify the key, e.g., recipe name",
             action="store", default='')
@@ -49,6 +50,10 @@  Reduce the .dot file packages only, no tasks:
 
         self.args = parser.parse_args()
 
+        if not os.path.exists(self.args.dotfile):
+            print(f"Dotfile {self.args.dotfile} does not exists. Did you run 'bitbake -g <recipe>'?")
+            sys.exit(1)
+
     @staticmethod
     def insert_dep_chain(chain, rdeps, alldeps):
         """