]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
buildman: Allow using older versions of genboardscfg.py
authorSimon Glass <sjg@chromium.org>
Sun, 19 Jul 2020 15:59:49 +0000 (09:59 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 29 Jul 2020 01:30:39 +0000 (19:30 -0600)
Older versions of this script don't support the -q flag. Since buildman
runs this script from when it starts, we may get the old version.

Fix this in two ways:

1. Use the version from the same tree as buildman is run from, if
available
2. Failing that, allow the -q flag to be missing

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/buildman/control.py

index 071c2613ecf5785533ce002e427ca9aa6f96d3b9..b81ecf6a5396b74f37621e9d7529d76945cd9299 100644 (file)
@@ -185,10 +185,16 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
         if not os.path.exists(options.output_dir):
             os.makedirs(options.output_dir)
         board_file = os.path.join(options.output_dir, 'boards.cfg')
-        genboardscfg = os.path.join(options.git, 'tools/genboardscfg.py')
+        our_path = os.path.dirname(os.path.realpath(__file__))
+        genboardscfg = os.path.join(our_path, '../genboardscfg.py')
+        if not os.path.exists(genboardscfg):
+            genboardscfg = os.path.join(options.git, 'tools/genboardscfg.py')
         status = subprocess.call([genboardscfg, '-q', '-o', board_file])
         if status != 0:
-            sys.exit("Failed to generate boards.cfg")
+            # Older versions don't support -q
+            status = subprocess.call([genboardscfg, '-o', board_file])
+            if status != 0:
+                sys.exit("Failed to generate boards.cfg")
 
         boards = board.Boards()
         boards.ReadBoards(board_file)