[elbe-devel] [PATCH 2/5] packers: use Packers in efilesystem and finetuning
Torben Hohn
torben.hohn at linutronix.de
Mon Jan 28 10:01:13 CET 2019
the tuple-based approach to packers can not model tar.
Use the new Packers class
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
elbepack/efilesystem.py | 14 ++++++--------
elbepack/finetuning.py | 3 ++-
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index dd75cdd1..1f6428e0 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -19,6 +19,7 @@ from elbepack.version import elbe_version
from elbepack.hdimg import do_hdimg
from elbepack.fstab import fstabentry
from elbepack.licencexml import copyright_xml
+from elbepack.packers import default_packer
def copy_filelist(src, filelist, dst):
@@ -315,7 +316,7 @@ class TargetFs(ChRootFilesystem):
grub_fw_type)
for i in self.images:
- self.image_packers[i] = ('gzip -f', '.gz')
+ self.image_packers[i] = default_packer
if self.xml.has("target/package/tar"):
targz_name = self.xml.text("target/package/tar/name")
@@ -367,14 +368,11 @@ class TargetFs(ChRootFilesystem):
pass
def pack_images(self, builddir):
- for img, (packer, ending) in self.image_packers.items():
+ for img, packer in self.image_packers.items():
self.images.remove(img)
- try:
- self.log.do('%s "%s"' % (packer, os.path.join(builddir, img)))
- # only add packed image when no exception is thrown
- self.images.append(img + ending)
- except CommandError:
- pass
+ packed = packer.pack_file(self.log, builddir, img)
+ if packed:
+ self.images.append(packed)
class BuildImgFs(ChRootFilesystem):
diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index 6f987ccb..896713fa 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -21,6 +21,7 @@ from elbepack.repomanager import UpdateRepo
from elbepack.rpcaptcache import get_rpcaptcache
from elbepack.shellhelper import CommandError
from elbepack.filesystem import ImgMountFilesystem
+from elbepack.packers import default_packer
class FinetuningException(Exception):
@@ -596,7 +597,7 @@ class ImgConvertAction(FinetuningAction):
log.do(cmd)
target.images.append(dst)
- target.image_packers[dst] = ('gzip -f', '.gz')
+ target.image_packers[dst] = default_packer
if not self.node.bool_attr('keep_src'):
target.images.remove(src)
--
2.11.0
More information about the elbe-devel
mailing list