]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
buildman: Make sure that -o is given with -w
authorSimon Glass <sjg@chromium.org>
Fri, 17 Apr 2020 23:51:32 +0000 (17:51 -0600)
committerSimon Glass <sjg@chromium.org>
Sun, 26 Apr 2020 20:24:08 +0000 (14:24 -0600)
It is a bad idea to use the default output directory ('..') with -w since
it does a build in that directory and writes various files these.

Require that -o is given to avoid this problem.

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

index f3a0dc7288dbdcbe17941d2e3bd8355929c6670f..b2f983c715d7428965b7b329f0413728889d24dd 100644 (file)
@@ -1091,7 +1091,8 @@ the -w option, for example:
 
    buildman -o /tmp/build --board sandbox -w
 
-This will write the full build into /tmp/build including object files.
+This will write the full build into /tmp/build including object files. You must
+specify the output directory with -o when using -w.
 
 
 Other options
index 1377b9d2bec8a1db6ff7690e6d3a217dfae8bbdc..680c072d6628f6bedaccf1775b4889d89595ef40 100644 (file)
@@ -76,8 +76,7 @@ def ParseArgs():
           default=False, help="Do a dry run (describe actions, but do nothing)")
     parser.add_option('-N', '--no-subdirs', action='store_true', dest='no_subdirs',
           default=False, help="Don't create subdirectories when building current source for a single board")
-    parser.add_option('-o', '--output-dir', type='string',
-          dest='output_dir', default='..',
+    parser.add_option('-o', '--output-dir', type='string', dest='output_dir',
           help='Directory where all builds happen and buildman has its workspace (default is ../)')
     parser.add_option('-O', '--override-toolchain', type='string',
           help="Override host toochain to use for sandbox (e.g. 'clang-7')")
index 7ee036824f63affe09be807ba35b5172fd63773f..7c8d7520fbde8ddadb11d6c6f4f9d8ddc068b6ea 100644 (file)
@@ -175,6 +175,10 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
     if options.incremental:
         print(col.Color(col.RED,
                         'Warning: -I has been removed. See documentation'))
+    if not options.output_dir:
+        if options.work_in_output:
+            sys.exit(col.Color(col.RED, '-w requires that you specify -o'))
+        options.output_dir = '..'
 
     # Work out what subset of the boards we are building
     if not boards:
index 1fbc6f6b0034cfd3e69245b9ff812c299fb2ff4e..8d3325d66fa717a2124eacd2518a5dda599fb2cd 100644 (file)
@@ -569,3 +569,9 @@ class TestFunctional(unittest.TestCase):
             self._RunControl('-b', self._test_branch, '-o', self._output_dir,
                              '-w', clean_dir=False, boards=board_list)
         self.assertIn("single commit", str(e.exception))
+
+        board_list = board.Boards()
+        board_list.AddBoard(board.Board(*boards[0]))
+        with self.assertRaises(SystemExit) as e:
+            self._RunControl('-w', clean_dir=False)
+        self.assertIn("specify -o", str(e.exception))