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

John Ogness john.ogness at linutronix.de
Thu Dec 7 00:32:23 CET 2017


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.

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



More information about the elbe-devel mailing list