summaryrefslogtreecommitdiff
path: root/morphlib/plugins
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-10-05 14:20:35 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-10-05 14:20:35 +0000
commitee1a42ecd993dbc29a5933908891159560d2e78c (patch)
treec41cdfbe899ce4bcaa8c463eda82a357d76f887d /morphlib/plugins
parent7d6094ed068f16d6fd5a51aa201865efbc364669 (diff)
downloadmorph-ee1a42ecd993dbc29a5933908891159560d2e78c.tar.gz
Actually construct a tarball for the rootfs-tarball system kind.
This adds tarball construction for rootfs-tarball. We deliberately choose compression level 1 because it gets us sufficient savings (ca. 60% smaller) while not wasting too much time (roughly 60% more time than uncompressed tar generation).
Diffstat (limited to 'morphlib/plugins')
-rw-r--r--morphlib/plugins/tarball-systembuilder_plugin.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/morphlib/plugins/tarball-systembuilder_plugin.py b/morphlib/plugins/tarball-systembuilder_plugin.py
index fd70fcd9..9f805cde 100644
--- a/morphlib/plugins/tarball-systembuilder_plugin.py
+++ b/morphlib/plugins/tarball-systembuilder_plugin.py
@@ -50,6 +50,21 @@ class RootfsTarballBuilder(SystemKindBuilder): # pragma: no cover
self.unpack_strata(fs_root)
self.create_fstab(fs_root)
self.copy_kernel_into_artifact_cache(fs_root)
+ unslashy_root = fs_root[1:]
+ def uproot_info(info):
+ if info.name == unslashy_root:
+ info.name = "."
+ elif info.name.startswith(unslashy_root):
+ info.name = "." + info.name[len(unslashy_root):]
+ return info
+ artiname = self.artifact.source.morphology['name']
+ tar = tarfile.TarFile.gzopen(fileobj=handle, mode="w",
+ compresslevel=1,
+ name=artiname)
+ self.app.status(msg='Constructing tarball of root filesystem',
+ chatty=True)
+ tar.add(fs_root, recursive=True, filter=uproot_info)
+ tar.close()
except BaseException, e:
logging.error(traceback.format_exc())
self.app.status(msg='Error while building system',