diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-01-28 15:48:36 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-02-06 11:10:36 +0000 |
commit | 47fe251de2a0c0b538e24181dcf7caed1a76fb0a (patch) | |
tree | 178402d0fa079266c7fa076d528fa3e5145bbcd6 | |
parent | 5c114ea31f38fc6505f4217c06a35520c677acbb (diff) | |
download | morph-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.
-rw-r--r-- | morphlib/builder2.py | 5 |
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]) |