summaryrefslogtreecommitdiff
path: root/morphlib/builder2.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2013-01-28 15:48:36 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2013-02-06 11:10:36 +0000
commit47fe251de2a0c0b538e24181dcf7caed1a76fb0a (patch)
tree178402d0fa079266c7fa076d528fa3e5145bbcd6 /morphlib/builder2.py
parent5c114ea31f38fc6505f4217c06a35520c677acbb (diff)
downloadmorph-47fe251de2a0c0b538e24181dcf7caed1a76fb0a.tar.gz
Avoid confusing error when staging area is empty
For Morph to work it's necessary for the staging area to contain a full FHS heirarchy. However, if the staging area is empty we want to give the user an obvious error. Previously we would say something like: OSError: [Errno 2] No such file or directory: '/tmp/ccache' This makes it seem like the problem is with ccache. With this patch, we will instead get as far as: /bin/sh: No such file or directory This should make the real problem clearer. Also, aborting while trying to mount the ccache directory causes the /proc and /dev/shm mounts to persist which is fixed by this patch.
Diffstat (limited to 'morphlib/builder2.py')
-rw-r--r--morphlib/builder2.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index ac40bf22..9ed75397 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -321,9 +321,10 @@ class ChunkBuilder(BuilderBase):
# Get the destination path
ccache_destdir= os.path.join(self.staging_area.tempdir,
'tmp', 'ccache')
- # Make sure that the destination exists
+ # Make sure that the destination exists. We'll create /tmp if necessary
+ # to avoid breaking when faced with an empty staging area.
if not os.path.isdir(ccache_destdir):
- os.mkdir(ccache_destdir)
+ os.makedirs(ccache_destdir)
# Mount it into the staging-area
self.app.runcmd(['mount', '--bind', ccache_repodir,
ccache_destdir])