diff options
author | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-04-02 10:03:46 +0000 |
---|---|---|
committer | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-04-10 13:52:27 +0000 |
commit | ee387ef30827fc769b3bab0fed1638d02af322fe (patch) | |
tree | 72e6a33b06d1d8031587692ae088121e5fc8a852 | |
parent | 3ebe37b1db1637f351d5d4652b0b80be0403f373 (diff) | |
download | morph-ee387ef30827fc769b3bab0fed1638d02af322fe.tar.gz |
fixup: Finish removing hardlink cache
-rw-r--r-- | morphlib/buildcommand.py | 2 | ||||
-rw-r--r-- | morphlib/stagingarea_tests.py | 27 |
2 files changed, 23 insertions, 6 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 6f9457fe..cab38395 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -498,8 +498,6 @@ class BuildCommand(object): chunk_name=artifact.name, cache=artifact.source.cache_key[:7], chatty=True) - artifact_checkout = os.path.join( - chunk_cache_dir, os.path.basename(artifact.basename()) + '.d') staging_area.install_artifact(self.lac, artifact) if target_source.build_mode == 'staging': diff --git a/morphlib/stagingarea_tests.py b/morphlib/stagingarea_tests.py index ffdf5eaa..3d378573 100644 --- a/morphlib/stagingarea_tests.py +++ b/morphlib/stagingarea_tests.py @@ -46,6 +46,25 @@ class FakeArtifact(object): self.source = FakeSource() +class FakeArtifactCache(object): + + def __init__(self, tempdir): + self.tempdir = tempdir + + def create_chunk(self, chunkdir): + if not chunkdir: + chunkdir = os.path.join(self.tempdir, 'chunk') + if not os.path.exists(chunkdir): + os.mkdir(chunkdir) + with open(os.path.join(chunkdir, 'file.txt'), 'w'): + pass + + return chunkdir + + def get(self, artifact, directory=None): + return self.create_chunk(directory) + + class FakeApplication(object): def __init__(self, cachedir, tempdir): @@ -141,14 +160,14 @@ class StagingAreaTests(unittest.TestCase): def test_installs_artifact(self): artifact = FakeArtifact() - chunkdir = self.create_chunk() - self.sa.install_artifact(artifact, chunkdir) + artifact_cache = FakeArtifactCache(self.tempdir) + self.sa.install_artifact(artifact_cache, artifact) self.assertEqual(self.list_tree(self.staging), ['/', '/file.txt']) def test_removes_everything(self): artifact = FakeArtifact() - chunkdir = self.create_chunk() - self.sa.install_artifact(artifact, chunkdir) + artifact_cache = FakeArtifactCache(self.tempdir) + self.sa.install_artifact(artifact_cache, artifact) self.sa.remove() self.assertFalse(os.path.exists(self.staging)) |