[Buildroot] [PATCH v2 2/3] autobuild-run: initial implementation of do_reproducible_build()

Arnout Vandecappelle arnout at mind.be
Sat Jun 8 11:40:28 UTC 2019



On 07/06/2019 08:46, Atharva Lele wrote:
> This new function will call do_build() twice to produce two builds
> and then check their reproducibility

 This commit message is much more complete :-). Just a missing period at the end.

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>

 Regards,
 Arnout

> 
> Signed-off-by: Atharva Lele <itsatharva at gmail.com>
> 
> ---
> Changes v1 -> v2:
>   - make clean outputs to devnull (suggested by arnout)
>   - remove unnecessary arguments to make clean (suggested by arnout)
> 
> Signed-off-by: Atharva Lele <itsatharva at gmail.com>
> ---
>  scripts/autobuild-run | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/scripts/autobuild-run b/scripts/autobuild-run
> index 5d76583..a4ddb5b 100755
> --- a/scripts/autobuild-run
> +++ b/scripts/autobuild-run
> @@ -494,6 +494,46 @@ def do_build(**kwargs):
>      log_write(log, "INFO: build successful")
>      return 0
>  
> +def do_reproducible_build(**kwargs):
> +    """Run the builds for reproducibility testing
> +
> +    Build twice with the same configuration. Calls do_build() to
> +    perform the actual build.
> +    """
> +
> +    idir = "instance-%d" % kwargs['instance']
> +    outputdir = os.path.join(idir, "output")
> +    log = kwargs['log']
> +    
> +    # Start the first build
> +    log_write(log, "INFO: Reproducible Build Test, starting build 1")
> +    ret = do_build(**kwargs)
> +    if ret != 0:
> +        log_write(log, "INFO: build 1 failed, skipping build 2")
> +        return ret
> +    
> +    # First build has been built, move files and start build 2
> +    os.rename(os.path.join(outputdir, "images"), os.path.join(outputdir, "images-1"))
> +
> +    # Clean up build 1
> +    if kwargs['debug']:
> +        devnull = log
> +    else:
> +        devnull = open(os.devnull, "w")
> +    cmd = ["make", "O=%s" % outputdir, "clean"]
> +    subprocess.call(cmd, stdout=devnull, stderr=devnull)
> +
> +    # Start the second build
> +    log_write(log, "INFO: Reproducible Build Test, starting build 2")
> +    ret = do_build(**kwargs)
> +    if ret != 0:
> +        log_write(log, "INFO: build 2 failed")
> +        return ret
> +
> +    # Assuming both have built successfully
> +    ret = check_reproducibility(**kwargs)
> +    return ret
> +
>  def send_results(result, **kwargs):
>      """Prepare and store/send tarball with results
>  
> 



More information about the buildroot mailing list