diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/buildman/builder.py | 27 | ||||
-rwxr-xr-x | tools/buildman/buildman.py | 3 | ||||
-rw-r--r-- | tools/buildman/control.py | 1 | ||||
-rw-r--r-- | tools/mksunxiboot.c | 10 |
4 files changed, 29 insertions, 12 deletions
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 4a2d753c21..39a6e8ad5c 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: @@ -215,14 +218,20 @@ class BuilderThread(threading.Thread): # 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: @@ -411,14 +420,17 @@ 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) + brd, work_dir, True, True, False) + did_config = True do_config = request_config # If we built that commit, then config is done. But if we got @@ -435,7 +447,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 +510,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) @@ -578,6 +592,7 @@ class Builder: self._complete_delay = None self._next_delay_update = datetime.now() self.force_config_on_failure = True + self.force_build_failures = False self._step = step self.col = terminal.Color() diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py index 73a5483d46..0da6797e7f 100755 --- a/tools/buildman/buildman.py +++ b/tools/buildman/buildman.py @@ -72,6 +72,9 @@ parser.add_option('-e', '--show_errors', action='store_true', 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') diff --git a/tools/buildman/control.py b/tools/buildman/control.py index d2f4102ba7..cfad535fcb 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -156,6 +156,7 @@ 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 # Work out which boards to build board_selected = boards.GetSelectedDict() diff --git a/tools/mksunxiboot.c b/tools/mksunxiboot.c index da7c9f0ddc..1f0fbae8e1 100644 --- a/tools/mksunxiboot.c +++ b/tools/mksunxiboot.c @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) { int fd_in, fd_out; struct boot_img img; - unsigned file_size, load_size; + unsigned file_size; int count; if (argc < 2) { @@ -101,8 +101,6 @@ int main(int argc, char *argv[]) if (file_size > SRAM_LOAD_MAX_SIZE) { fprintf(stderr, "ERROR: File too large!\n"); return EXIT_FAILURE; - } else { - load_size = ALIGN(file_size, sizeof(int)); } fd_out = open(argv[2], O_WRONLY | O_CREAT, 0666); @@ -113,8 +111,8 @@ int main(int argc, char *argv[]) /* read file to buffer to calculate checksum */ lseek(fd_in, 0, SEEK_SET); - count = read(fd_in, img.code, load_size); - if (count != load_size) { + count = read(fd_in, img.code, file_size); + if (count != file_size) { perror("Reading input image"); return EXIT_FAILURE; } @@ -126,7 +124,7 @@ int main(int argc, char *argv[]) & 0x00FFFFFF); memcpy(img.header.magic, BOOT0_MAGIC, 8); /* no '0' termination */ img.header.length = - ALIGN(load_size + sizeof(struct boot_file_head), BLOCK_SIZE); + ALIGN(file_size + sizeof(struct boot_file_head), BLOCK_SIZE); gen_check_sum(&img.header); count = write(fd_out, &img, img.header.length); |