[U-Boot] [PATCH 02/13] buildman: Add an option to just create the config

Simon Glass sjg at chromium.org
Mon Sep 19 00:48:27 CEST 2016


Normally buildman does a full build of a board. This includes creating the
u-boot.cfg file which contains all the configuration options. Buildman uses
this file with the -K option, to show differences in effective configuration
for each commit.

Doing a full build of U-Boot just to create the u-boot.cfg file is wasteful.
Add a -D option which causes buildman to only create the configuration. This
is enough to support use of -K and can be done much more quickly (typically
5-10 times faster).

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/buildman/builder.py       |  5 ++++-
 tools/buildman/builderthread.py | 17 +++++++++++------
 tools/buildman/cmdline.py       |  2 ++
 tools/buildman/control.py       |  3 ++-
 4 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 8ec3551..98f1091 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -206,7 +206,8 @@ class Builder:
     def __init__(self, toolchains, base_dir, git_dir, num_threads, num_jobs,
                  gnu_make='make', checkout=True, show_unknown=True, step=1,
                  no_subdirs=False, full_path=False, verbose_build=False,
-                 incremental=False, per_board_out_dir=False):
+                 incremental=False, per_board_out_dir=False,
+                 config_only=False):
         """Create a new Builder object
 
         Args:
@@ -229,6 +230,7 @@ class Builder:
                 mrproper when configuring
             per_board_out_dir: Build in a separate persistent directory per
                 board rather than a thread-specific directory
+            config_only: Only configure each build, don't build it
         """
         self.toolchains = toolchains
         self.base_dir = base_dir
@@ -257,6 +259,7 @@ class Builder:
         self.no_subdirs = no_subdirs
         self.full_path = full_path
         self.verbose_build = verbose_build
+        self.config_only = config_only
 
         self.col = terminal.Color()
 
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index c512d3b..a30e4fd 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -110,8 +110,8 @@ class BuilderThread(threading.Thread):
         return self.builder.do_make(commit, brd, stage, cwd, *args,
                 **kwargs)
 
-    def RunCommit(self, commit_upto, brd, work_dir, do_config, force_build,
-                  force_build_failures):
+    def RunCommit(self, commit_upto, brd, work_dir, do_config, do_build,
+                  force_build, force_build_failures):
         """Build a particular commit.
 
         If the build is already done, and we are not forcing a build, we skip
@@ -122,6 +122,7 @@ class BuilderThread(threading.Thread):
             brd: Board object to build
             work_dir: Directory to which the source will be checked out
             do_config: True to run a make <board>_defconfig on the source
+            do_build: Try to build the source
             force_build: Force a build even if one was previously done
             force_build_failures: Force a bulid if the previous result showed
                 failure
@@ -231,6 +232,8 @@ class BuilderThread(threading.Thread):
                     config_out += result.combined
                     do_config = False   # No need to configure next time
                 if result.return_code == 0:
+                    if not do_build:
+                        args.append('cfg')
                     result = self.Make(commit, brd, 'build', cwd, *args,
                             env=env)
                 result.stderr = result.stderr.replace(src_dir + '/', '')
@@ -405,7 +408,7 @@ class BuilderThread(threading.Thread):
             force_build = False
             for commit_upto in range(0, len(job.commits), job.step):
                 result, request_config = self.RunCommit(commit_upto, brd,
-                        work_dir, do_config,
+                        work_dir, do_config, not self.builder.config_only,
                         force_build or self.builder.force_build,
                         self.builder.force_build_failures)
                 failed = result.return_code or result.stderr
@@ -415,9 +418,10 @@ class BuilderThread(threading.Thread):
                     # with a reconfig.
                     if self.builder.force_config_on_failure:
                         result, request_config = self.RunCommit(commit_upto,
-                            brd, work_dir, True, True, False)
+                            brd, work_dir, True, False, True, False)
                         did_config = True
-                if not self.builder.force_reconfig:
+                if (not self.builder.force_reconfig and
+                    not self.builder.config_only):
                     do_config = request_config
 
                 # If we built that commit, then config is done. But if we got
@@ -459,7 +463,8 @@ class BuilderThread(threading.Thread):
         else:
             # Just build the currently checked-out build
             result, request_config = self.RunCommit(None, brd, work_dir, True,
-                        True, self.builder.force_build_failures)
+                        not self.builder.config_only, True,
+                        self.builder.force_build_failures)
             result.commit_upto = 0
             self._WriteResult(result, job.keep_outputs)
             self.builder.out_queue.put(result)
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 3e3bd63..bd3776a 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -28,6 +28,8 @@ def ParseArgs():
     parser.add_option('-d', '--detail', dest='show_detail',
           action='store_true', default=False,
           help='Show detailed information for each board in summary')
+    parser.add_option('-D', '--config-only', action='store_true', default=False,
+          help="Don't build, just configure each commit")
     parser.add_option('-e', '--show_errors', action='store_true',
           default=False, help='Show errors and warnings')
     parser.add_option('-f', '--force-build', dest='force_build',
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index b86d7b3..8e347d4 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -258,7 +258,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
             no_subdirs=options.no_subdirs, full_path=options.full_path,
             verbose_build=options.verbose_build,
             incremental=options.incremental,
-            per_board_out_dir=options.per_board_out_dir,)
+            per_board_out_dir=options.per_board_out_dir,
+            config_only=options.config_only)
     builder.force_config_on_failure = not options.quick
     if make_func:
         builder.do_make = make_func
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list