[elbe-devel] [PATCH v3 3/4] Changes to the preprocessor

Akash Satamkar akash at linutronix.de
Tue Sep 17 15:29:35 CEST 2019


Add a parameter to ElbeXML.archive_tmpfile(), to allow to specify
the archive to unpack.

Signed-off-by: Akash Satamkar <akash at linutronix.de>
---
 elbepack/dump.py    | 5 +++--
 elbepack/elbexml.py | 9 ---------
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/elbepack/dump.py b/elbepack/dump.py
index 4642ae92..6b1bfa6f 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -11,6 +11,7 @@ from datetime import datetime
 
 from apt import Cache
 
+from elbepack.archivedir import archive_tmpfile
 from elbepack.finetuning import do_finetuning
 from elbepack.filesystem import hostfs
 from elbepack.version import elbe_version
@@ -194,8 +195,8 @@ def elbe_report(xml, buildenv, cache, targetfs):
 
     report.info("Archive extract")
 
-    if xml.has("archive") and not xml.text("archive") is None:
-        with xml.archive_tmpfile() as fp:
+    if xml.has("archive") and xml.text("archive"):
+        with archive_tmpfile(xml.text("archive")) as fp:
             do('tar xvfj "%s" -h -C "%s"' % (fp.name, targetfs.path))
         mt_index_postarch = targetfs.mtime_snap()
     else:
diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index 5972600c..2dd5c0f4 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -12,9 +12,6 @@ import os
 import re
 import urllib2
 
-from base64 import standard_b64decode
-from tempfile import NamedTemporaryFile
-
 from elbepack.treeutils import etree
 from elbepack.validate import validate_xml
 from elbepack.xmldefaults import ElbeDefaults
@@ -364,12 +361,6 @@ class ElbeXML(object):
     def append_initvm_pkg(self, aptpkg):
         self.append_pkg(aptpkg, 'initvmpkgs')
 
-    def archive_tmpfile(self):
-        fp = NamedTemporaryFile()
-        fp.write(standard_b64decode(self.text("archive")))
-        fp.file.flush()
-        return fp
-
     def get_debootstrappkgs_from(self, other):
         tree = self.xml.ensure_child('debootstrappkgs')
         tree.clear()
-- 
2.20.1




More information about the elbe-devel mailing list