diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/buildman/builder.py | 51 | ||||
-rwxr-xr-x | tools/buildman/buildman.py | 9 | ||||
-rw-r--r-- | tools/buildman/control.py | 3 | ||||
-rw-r--r-- | tools/patman/gitutil.py | 11 |
4 files changed, 62 insertions, 12 deletions
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 4a2d753c21..0a3900c2f2 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -188,7 +188,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): + def RunCommit(self, commit_upto, brd, work_dir, do_config, force_build, + force_build_failures): """Build a particular commit. If the build is already done, and we are not forcing a build, we skip @@ -200,6 +201,8 @@ class BuilderThread(threading.Thread): work_dir: Directory to which the source will be checked out do_config: True to run a make <board>_config on 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 Returns: tuple containing: @@ -210,19 +213,28 @@ class BuilderThread(threading.Thread): # self.Make() below, in the event that we do a build. result = command.CommandResult() 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 done_file = self.builder.GetDoneFile(commit_upto, brd.target) result.already_done = os.path.exists(done_file) - if result.already_done and not force_build: + will_build = (force_build or force_build_failures or + not result.already_done) + if result.already_done and will_build: # Get the return code from that build and use it with open(done_file, 'r') as fd: result.return_code = int(fd.readline()) err_file = self.builder.GetErrFile(commit_upto, brd.target) if os.path.exists(err_file) and os.stat(err_file).st_size: result.stderr = 'bad' - else: + elif not force_build: + # The build passed, so no need to build it again + will_build = False + + if will_build: # We are going to have to build it. First, get a toolchain if not self.toolchain: try: @@ -248,7 +260,10 @@ class BuilderThread(threading.Thread): # Set up the environment and command line env = self.toolchain.MakeEnvironment() 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: args.extend(['-j', str(self.builder.num_jobs)]) config_args = ['%s_config' % brd.target] @@ -411,15 +426,19 @@ class BuilderThread(threading.Thread): for commit_upto in range(0, len(job.commits), job.step): result, request_config = self.RunCommit(commit_upto, brd, work_dir, do_config, - force_build or self.builder.force_build) + force_build or self.builder.force_build, + self.builder.force_build_failures) failed = result.return_code or result.stderr + did_config = do_config if failed and not do_config: # If our incremental build failed, try building again # with a reconfig. if self.builder.force_config_on_failure: result, request_config = self.RunCommit(commit_upto, - brd, work_dir, True, True) - do_config = request_config + brd, work_dir, True, True, False) + did_config = True + if not self.builder.force_reconfig: + do_config = request_config # If we built that commit, then config is done. But if we got # an warning, reconfig next time to force it to build the same @@ -435,7 +454,7 @@ class BuilderThread(threading.Thread): # Of course this is substantially slower if there are build # errors/warnings (e.g. 2-3x slower even if only 10% of builds # have problems). - if (failed and not result.already_done and not do_config and + if (failed and not result.already_done and not did_config and self.builder.force_config_on_failure): # If this build failed, try the next one with a # reconfigure. @@ -498,6 +517,8 @@ class Builder: force_config_on_failure: If a commit fails for a board, disable incremental building for the next commit we build for that board, so that we will see all warnings/errors again. + force_build_failures: If a previously-built build (i.e. built on + a previous run of buildman) is marked as failed, rebuild it. git_dir: Git directory containing source repository last_line_len: Length of the last line we printed (used for erasing it with new progress information) @@ -510,6 +531,15 @@ class Builder: toolchains: Toolchains object to use for building upto: Current commit number we are building (0.count-1) warned: Number of builds that produced at least one warning + force_reconfig: Reconfigure U-Boot on each comiit. This disables + incremental building, where buildman reconfigures on the first + commit for a baord, and then just does an incremental build for + the following commits. In fact buildman will reconfigure and + retry for any failing commits, so generally the only effect of + 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: _base_board_dict: Last-summarised Dict of boards @@ -578,7 +608,10 @@ class Builder: self._complete_delay = None self._next_delay_update = datetime.now() self.force_config_on_failure = True + self.force_build_failures = False + self.force_reconfig = False self._step = step + self.in_tree = False self.col = terminal.Color() diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py index 73a5483d46..42847acb3c 100755 --- a/tools/buildman/buildman.py +++ b/tools/buildman/buildman.py @@ -67,11 +67,17 @@ parser.add_option('-B', '--bloat', dest='show_bloat', help='Show changes in function code size for each board') parser.add_option('-c', '--count', dest='count', type='int', default=-1, help='Run build on the top n commits') +parser.add_option('-C', '--force-reconfig', dest='force_reconfig', + action='store_true', default=False, + help='Reconfigure for every commit (disable incremental build)') 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', action='store_true', default=False, help='Force build of boards even if already built') +parser.add_option('-F', '--force-build-failures', dest='force_build_failures', + action='store_true', default=False, + help='Force build of previously-failed build') parser.add_option('-d', '--detail', dest='show_detail', action='store_true', default=False, help='Show detailed information for each board in summary') @@ -79,6 +85,9 @@ parser.add_option('-g', '--git', type='string', help='Git repo containing branch to build', default='.') parser.add_option('-H', '--full-help', action='store_true', dest='full_help', 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', default=None, help='Number of jobs to run at once (passed to make)') parser.add_option('-k', '--keep-outputs', action='store_true', diff --git a/tools/buildman/control.py b/tools/buildman/control.py index d2f4102ba7..2dd80434eb 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -156,6 +156,9 @@ def DoBuildman(options, args): ShowActions(series, why_selected, selected, builder, options) else: builder.force_build = options.force_build + builder.force_build_failures = options.force_build_failures + builder.force_reconfig = options.force_reconfig + builder.in_tree = options.in_tree # Work out which boards to build board_selected = boards.GetSelectedDict() diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 7b75c83a82..65754f5326 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -377,9 +377,14 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname, """ to = BuildEmailList(series.get('to'), '--to', alias, raise_on_error) if not to: - print ("No recipient, please add something like this to a commit\n" - "Series-to: Fred Bloggs <f.blogs@napier.co.nz>") - return + git_config_to = command.Output('git', 'config', 'sendemail.to') + if not git_config_to: + print ("No recipient.\n" + "Please add something like this to a commit\n" + "Series-to: Fred Bloggs <f.blogs@napier.co.nz>\n" + "Or do something like this\n" + "git config sendemail.to u-boot@lists.denx.de") + return cc = BuildEmailList(series.get('cc'), '--cc', alias, raise_on_error) if self_only: to = BuildEmailList([os.getenv('USER')], '--to', alias, raise_on_error) |