[elbe-devel] [PATCH v4 3/5] elbexml: move archive_tmpfile to archivedir

Akash Satamkar akash at linutronix.de
Wed Sep 18 12:17:20 CEST 2019


Move the archive_tmpfile function from elbexml to archivedir.
No use of self parameter in archive_tmpfile.

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

diff --git a/elbepack/dump.py b/elbepack/dump.py
index 4642ae92..a7eb4011 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
@@ -195,7 +196,7 @@ 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:
+        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