Răsfoiți Sursa

buildman: Support in-tree builds

At present buildman always builds out-of-tree, that is it uses a separate
output directory from the source directory. Normally this is what you want,
but it is important that in-tree builds work also. Some Makefile changes may
break this.

Add a -i option to tell buildman to use in-tree builds, so that it is easy
to test this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 11 ani în urmă
părinte
comite
189a496825
3 a modificat fișierele cu 16 adăugiri și 2 ștergeri
  1. 12 2
      tools/buildman/builder.py
  2. 3 0
      tools/buildman/buildman.py
  3. 1 0
      tools/buildman/control.py

+ 12 - 2
tools/buildman/builder.py

@@ -213,7 +213,10 @@ class BuilderThread(threading.Thread):
         # self.Make() below, in the event that we do a build.
         # self.Make() below, in the event that we do a build.
         result = command.CommandResult()
         result = command.CommandResult()
         result.return_code = 0
         result.return_code = 0
-        out_dir = os.path.join(work_dir, 'build')
+        if self.builder.in_tree:
+            out_dir = work_dir
+        else:
+            out_dir = os.path.join(work_dir, 'build')
 
 
         # Check if the job was already completed last time
         # Check if the job was already completed last time
         done_file = self.builder.GetDoneFile(commit_upto, brd.target)
         done_file = self.builder.GetDoneFile(commit_upto, brd.target)
@@ -257,7 +260,10 @@ class BuilderThread(threading.Thread):
                 # Set up the environment and command line
                 # Set up the environment and command line
                 env = self.toolchain.MakeEnvironment()
                 env = self.toolchain.MakeEnvironment()
                 Mkdir(out_dir)
                 Mkdir(out_dir)
-                args = ['O=build', '-s']
+                args = []
+                if not self.builder.in_tree:
+                    args.append('O=build')
+                args.append('-s')
                 if self.builder.num_jobs is not None:
                 if self.builder.num_jobs is not None:
                     args.extend(['-j', str(self.builder.num_jobs)])
                     args.extend(['-j', str(self.builder.num_jobs)])
                 config_args = ['%s_config' % brd.target]
                 config_args = ['%s_config' % brd.target]
@@ -531,6 +537,9 @@ class Builder:
             the following commits. In fact buildman will reconfigure and
             the following commits. In fact buildman will reconfigure and
             retry for any failing commits, so generally the only effect of
             retry for any failing commits, so generally the only effect of
             this option is to slow things down.
             this option is to slow things down.
+        in_tree: Build U-Boot in-tree instead of specifying an output
+            directory separate from the source code. This option is really
+            only useful for testing in-tree builds.
 
 
     Private members:
     Private members:
         _base_board_dict: Last-summarised Dict of boards
         _base_board_dict: Last-summarised Dict of boards
@@ -602,6 +611,7 @@ class Builder:
         self.force_build_failures = False
         self.force_build_failures = False
         self.force_reconfig = False
         self.force_reconfig = False
         self._step = step
         self._step = step
+        self.in_tree = False
 
 
         self.col = terminal.Color()
         self.col = terminal.Color()
 
 

+ 3 - 0
tools/buildman/buildman.py

@@ -85,6 +85,9 @@ parser.add_option('-g', '--git', type='string',
        help='Git repo containing branch to build', default='.')
        help='Git repo containing branch to build', default='.')
 parser.add_option('-H', '--full-help', action='store_true', dest='full_help',
 parser.add_option('-H', '--full-help', action='store_true', dest='full_help',
        default=False, help='Display the README file')
        default=False, help='Display the README file')
+parser.add_option('-i', '--in-tree', dest='in_tree',
+       action='store_true', default=False,
+       help='Build in the source tree instead of a separate directory')
 parser.add_option('-j', '--jobs', dest='jobs', type='int',
 parser.add_option('-j', '--jobs', dest='jobs', type='int',
        default=None, help='Number of jobs to run at once (passed to make)')
        default=None, help='Number of jobs to run at once (passed to make)')
 parser.add_option('-k', '--keep-outputs', action='store_true',
 parser.add_option('-k', '--keep-outputs', action='store_true',

+ 1 - 0
tools/buildman/control.py

@@ -158,6 +158,7 @@ def DoBuildman(options, args):
         builder.force_build = options.force_build
         builder.force_build = options.force_build
         builder.force_build_failures = options.force_build_failures
         builder.force_build_failures = options.force_build_failures
         builder.force_reconfig = options.force_reconfig
         builder.force_reconfig = options.force_reconfig
+        builder.in_tree = options.in_tree
 
 
         # Work out which boards to build
         # Work out which boards to build
         board_selected = boards.GetSelectedDict()
         board_selected = boards.GetSelectedDict()