[elbe-devel] [PATCH] dump: remove 2nd extract of archive

Manuel Traut manuel.traut at linutronix.de
Thu Dec 7 08:03:50 CET 2017


On Thu, Dec 07, 2017 at 12:32:23AM +0100, John Ogness wrote:
> Originally archive extraction occurred only after the finetuning step.
> With commit 33d0e328b74d ("extract archive before finetuning to be
> able to use the files.") extraction was added before the finetuning
> step to allow finetuning to use archive files. However, the extraction
> after finetuning was never removed. This dramatically reduces the
> benefits of finetuning being able to manipulate the archive files.
> 
> Remove archive extraction after the finetuning step.
> 
> Update the logic to determine file origins in the elbe report
> based on this new ordering.

Thanks, this is a change that was requested a few times.

However, this might brake image builds that (accidently) delete files in
finetuning that are in the archive and expect them to be in the RFS.

I'm fine if we introduce a attribute for the archive tag.

<archive extraction='after_finetuning|before_finetuning'>

If no attribute is specified, the behaviour will be as it is now.

Maybe it would be useful to have other position for doing the extraction in
the future. If we allow multiple <archive> tags it might make even more sense..

> Signed-off-by: John Ogness <john.ogness at linutronix.de>
> ---
>  It's what we've all been wanting and now it is here!
> 
>  elbepack/dump.py | 41 +++++++++++++++++++----------------------
>  1 file changed, 19 insertions(+), 22 deletions(-)
> 
> diff --git a/elbepack/dump.py b/elbepack/dump.py
> index 98ab2a5d..e1e6e1dc 100644
> --- a/elbepack/dump.py
> +++ b/elbepack/dump.py
> @@ -192,35 +192,30 @@ def elbe_report( xml, buildenv, cache, reportname, targetfs ):
>      # the second extraction is done to ensure that files from the archive
>      # can't be modified/removed in finetuning
>  
> -    outf.h2( "archive extract before finetuning" )
> +    index = cache.get_fileindex()
> +    mt_index = targetfs.mtime_snap()
> +
> +    outf.h2( "archive extract" )
>  
>      if xml.has("archive"):
>          with xml.archive_tmpfile() as fp:
>              outf.do( 'tar xvfj "%s" -C "%s"' % (fp.name, targetfs.path) )
> +        mt_index_post_arch = targetfs.mtime_snap()
> +    else:
> +        mt_index_post_arch = mt_index
>  
>      outf.h2( "finetuning log" )
>      outf.verbatim_start()
>  
> -    index = cache.get_fileindex()
> -    mt_index = targetfs.mtime_snap()
>      if xml.has("target/finetuning"):
>          do_finetuning(xml, outf, buildenv, targetfs)
>          #outf.print_raw( do_command( opt.finetuning ) )
>          mt_index_post_fine = targetfs.mtime_snap()
>      else:
> -        mt_index_post_fine = mt_index
> +        mt_index_post_fine = mt_index_post_arch
>  
>      outf.verbatim_end()
>  
> -    outf.h2( "archive extract after finetuning" )
> -
> -    if xml.has("archive"):
> -        with xml.archive_tmpfile() as fp:
> -            outf.do( 'tar xvfj "%s" -C "%s"' % (fp.name, targetfs.path) )
> -        mt_index_post_arch = targetfs.mtime_snap()
> -    else:
> -        mt_index_post_arch = mt_index_post_fine
> -
>      outf.h2( "fileslist" )
>      outf.table()
>  
> @@ -233,16 +228,18 @@ def elbe_report( xml, buildenv, cache, reportname, targetfs ):
>          else:
>              pkg = "postinst generated"
>  
> -        if mt_index_post_fine.has_key(fpath) and mt_index.has_key(fpath):
> -            if mt_index_post_fine[fpath] > mt_index[fpath]:
> -                pkg = "modified finetuning"
>          if mt_index_post_fine.has_key(fpath):
> -            if mt_index_post_arch[fpath] > mt_index_post_fine[fpath]:
> -                pkg = "from archive"
> -            elif not mt_index.has_key(fpath):
> +            if mt_index_post_arch.has_key(fpath):
> +                if mt_index_post_fine[fpath] > mt_index_post_arch[fpath]:
> +                    pkg = "modified finetuning"
> +                elif mt_index.has_key(fpath):
> +                    if mt_index_post_arch[fpath] > mt_index[fpath]:
> +                        pkg = "from archive"
> +                    # else leave pkg as is
> +                else:
> +                    pkg = "added in archive"
> +            else:
>                  pkg = "added in finetuning"
> -        else:
> -            pkg = "added in archive"
>  
>          outf.printo( "|+%s+|%s" % (fpath,pkg) )
>  
> @@ -251,7 +248,7 @@ def elbe_report( xml, buildenv, cache, reportname, targetfs ):
>      outf.h2( "Deleted Files" )
>      outf.table()
>      for fpath in mt_index.keys():
> -        if not mt_index_post_arch.has_key(fpath):
> +        if not mt_index_post_fine.has_key(fpath):
>              if index.has_key(fpath):
>                  pkg = index[fpath]
>              else:
> -- 
> 2.11.0
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel



More information about the elbe-devel mailing list