[U-Boot] [PATCH v3 13/18] buildman: Provide an internal option to clean the outpur dir

Simon Glass sjg at chromium.org
Wed Sep 10 20:53:55 CEST 2014


Applied to u-boot-x86/buildman.

Fixed up to avoid removing the tree when it doesn't exist.


On 5 September 2014 19:00, Simon Glass <sjg at chromium.org> wrote:
> For testing it is useful to clean the output directory before running a
> test. This avoids a test interfering with the results of a subsequent
> test by leaving data around.
>
> Add this feature as an optional parameter to the control logic.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  tools/buildman/control.py | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/tools/buildman/control.py b/tools/buildman/control.py
> index fb15ae8..2f51249 100644
> --- a/tools/buildman/control.py
> +++ b/tools/buildman/control.py
> @@ -5,6 +5,7 @@
>
>  import multiprocessing
>  import os
> +import shutil
>  import sys
>
>  import board
> @@ -78,7 +79,8 @@ def ShowActions(series, why_selected, boards_selected, builder, options):
>      print ('Total boards to build for each commit: %d\n' %
>              why_selected['all'])
>
> -def DoBuildman(options, args, toolchains=None, make_func=None, boards=None):
> +def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
> +               clean_dir=False):
>      """The main control code for buildman
>
>      Args:
> @@ -93,6 +95,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None):
>          board: Boards() object to use, containing a list of available
>                  boards. If this is None it will be created and scanned.
>      """
> +    global builder
> +
>      if options.full_help:
>          pager = os.getenv('PAGER')
>          if not pager:
> @@ -209,6 +213,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None):
>      else:
>          dirname = 'current'
>      output_dir = os.path.join(options.output_dir, dirname)
> +    if clean_dir:
> +        shutil.rmtree(output_dir)
>      builder = Builder(toolchains, output_dir, options.git_dir,
>              options.threads, options.jobs, gnu_make=gnu_make, checkout=True,
>              show_unknown=options.show_unknown, step=options.step)
> @@ -230,6 +236,9 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None):
>
>          if series:
>              commits = series.commits
> +            # Number the commits for test purposes
> +            for commit in range(len(commits)):
> +                commits[commit].sequence = commit
>          else:
>              commits = None
>
> --
> 2.1.0.rc2.206.gedb03e5
>


More information about the U-Boot mailing list