diff options
author | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-03-03 13:00:40 +0000 |
---|---|---|
committer | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-04-10 13:52:25 +0000 |
commit | 5847e6ec39dd4f62bcbf819f9bef65316ea6933a (patch) | |
tree | ff2c9a20ea4fbde2e242e4bf0a7deed13a16910e /morphlib/stagingarea.py | |
parent | fff08941639fc02254f1ec93b675e596d3037651 (diff) | |
download | morph-5847e6ec39dd4f62bcbf819f9bef65316ea6933a.tar.gz |
Move the chunk cache logic into buildcommand
This avoids needing to pass the cache to the staging area since
lac.get returns a path to a directory tree rather than a file
handle now, so we also don't need to do any unpacking.
Diffstat (limited to 'morphlib/stagingarea.py')
-rw-r--r-- | morphlib/stagingarea.py | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py index 28b22031..768ec643 100644 --- a/morphlib/stagingarea.py +++ b/morphlib/stagingarea.py @@ -185,30 +185,11 @@ class StagingArea(object): the artifact is a tarball. ''' - - chunk_cache_dir = os.path.join(self._app.settings['tempdir'], 'chunks') - unpacked_artifact = os.path.join( - chunk_cache_dir, os.path.basename(handle.name) + '.d') - if not os.path.exists(unpacked_artifact): - self._app.status( - msg='Unpacking chunk from cache %(filename)s', - filename=os.path.basename(handle.name)) - savedir = tempfile.mkdtemp(dir=chunk_cache_dir) - try: - morphlib.bins.unpack_binary_from_file( - handle, savedir + '/') - except BaseException as e: # pragma: no cover - shutil.rmtree(savedir) - raise - # TODO: This rename is not concurrency safe if two builds are - # extracting the same chunk, one build will fail because - # the other renamed its tempdir here first. - os.rename(savedir, unpacked_artifact) - if not os.path.exists(self.dirname): self._mkdir(self.dirname) - self.hardlink_all_files(unpacked_artifact, self.dirname) + self.hardlink_all_files(artifact_checkout, self.dirname) + self.create_devices(artifact.source.morphology) def remove(self): '''Remove the entire staging area. |