summaryrefslogtreecommitdiff
path: root/morphlib/plugins/syslinux-disk-systembuilder_plugin.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-07-26 11:08:55 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-07-26 12:01:58 +0100
commit05fe245d1771ec25d8675b2dd9e4aeee6b22802c (patch)
tree9c25f99b47865cc192aae94d4c4172dd92bae8ff /morphlib/plugins/syslinux-disk-systembuilder_plugin.py
parentd957103389fca85579b96b3918b68ce65ad02cb2 (diff)
downloadmorph-05fe245d1771ec25d8675b2dd9e4aeee6b22802c.tar.gz
Move strata unpacking into a base class
Diffstat (limited to 'morphlib/plugins/syslinux-disk-systembuilder_plugin.py')
-rw-r--r--morphlib/plugins/syslinux-disk-systembuilder_plugin.py54
1 files changed, 1 insertions, 53 deletions
diff --git a/morphlib/plugins/syslinux-disk-systembuilder_plugin.py b/morphlib/plugins/syslinux-disk-systembuilder_plugin.py
index 7d46d61b..41a95000 100644
--- a/morphlib/plugins/syslinux-disk-systembuilder_plugin.py
+++ b/morphlib/plugins/syslinux-disk-systembuilder_plugin.py
@@ -58,7 +58,7 @@ class SyslinuxDiskBuilder(SystemKindBuilder): # pragma: no cover
self._mount(partition, mount_point)
factory_path = os.path.join(mount_point, 'factory')
self._create_subvolume(factory_path)
- self._unpack_strata(factory_path)
+ self.unpack_strata(factory_path)
self._create_fstab(factory_path)
self._create_extlinux_config(factory_path)
self._create_subvolume_snapshot(
@@ -139,58 +139,6 @@ class SyslinuxDiskBuilder(SystemKindBuilder): # pragma: no cover
with self.build_watch('create-factory-subvolume'):
self.app.runcmd(['btrfs', 'subvolume', 'create', path])
- def _unpack_strata(self, path):
- self.app.status(msg='Unpacking strata to %(path)s',
- path=path, chatty=True)
- with self.build_watch('unpack-strata'):
- # download the stratum artifacts if necessary
- download_depends(self.artifact.dependencies,
- self.local_artifact_cache,
- self.remote_artifact_cache,
- ('meta',))
-
- # download the chunk artifacts if necessary
- for stratum_artifact in self.artifact.dependencies:
- f = self.local_artifact_cache.get(stratum_artifact)
- chunks = [ArtifactCacheReference(a) for a in json.load(f)]
- download_depends(chunks,
- self.local_artifact_cache,
- self.remote_artifact_cache)
- f.close()
-
- # check whether the strata overlap
- overlaps = get_overlaps(self.artifact, self.artifact.dependencies,
- self.local_artifact_cache)
- if len(overlaps) > 0:
- self.app.status(msg='Overlaps in system artifact '
- '%(artifact_name)s detected',
- artifact_name=self.artifact.name,
- error=True)
- log_overlaps(overlaps)
- write_overlap_metadata(self.artifact, overlaps,
- self.local_artifact_cache)
-
- # unpack it from the local artifact cache
- for stratum_artifact in self.artifact.dependencies:
- f = self.local_artifact_cache.get(stratum_artifact)
- for chunk in (ArtifactCacheReference(a) for a in json.load(f)):
- self.app.status(msg='Unpacking chunk %(basename)s',
- basename=chunk.basename(), chatty=True)
- chunk_handle = self.local_artifact_cache.get(chunk)
- morphlib.bins.unpack_binary_from_file(chunk_handle, path)
- chunk_handle.close()
- f.close()
- meta = self.local_artifact_cache.get_artifact_metadata(
- stratum_artifact, 'meta')
- dst = morphlib.savefile.SaveFile(
- os.path.join(path, 'baserock',
- '%s.meta' % stratum_artifact.name), 'w')
- shutil.copyfileobj(meta, dst)
- dst.close()
- meta.close()
-
- ldconfig(self.app.runcmd, path)
-
def _create_fstab(self, path):
self.app.status(msg='Creating fstab in %(path)s',
path=path, chatty=True)