summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmorphlib/app.py5
-rw-r--r--morphlib/stagingarea.py8
2 files changed, 9 insertions, 4 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index eaba5dd9..21e18e32 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -193,6 +193,11 @@ class Morph(cliapp.Application):
if self.settings['compiler-cache-dir'] is None:
self.settings['compiler-cache-dir'] = os.path.join(
self.settings['cachedir'], 'ccache')
+ if self.settings['tempdir'] is None:
+ if 'TMPDIR' in os.environ:
+ self.settings['tempdir'] = os.environ['TMPDIR']
+ else:
+ self.settings['tempdir'] = '/tmp'
if 'MORPH_DUMP_PROCESSED_CONFIG' in os.environ:
self.settings.dump_config(sys.stdout)
sys.exit(0)
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py
index f930f9d7..ae9e7e39 100644
--- a/morphlib/stagingarea.py
+++ b/morphlib/stagingarea.py
@@ -98,7 +98,7 @@ class StagingArea(object):
if stat.S_ISDIR(mode):
# Ensure directory exists in destination, then recurse.
- if not os.path.exists(destpath):
+ if not os.path.lexists(destpath):
os.makedirs(destpath)
dest_stat = os.stat(os.path.realpath(destpath))
if not stat.S_ISDIR(dest_stat.st_mode):
@@ -110,19 +110,19 @@ class StagingArea(object):
os.path.join(destpath, entry))
elif stat.S_ISLNK(mode):
# Copy the symlink.
- if os.path.exists(destpath):
+ if os.path.lexists(destpath):
os.remove(destpath)
os.symlink(os.readlink(srcpath), destpath)
elif stat.S_ISREG(mode):
# Hardlink the file.
- if os.path.exists(destpath):
+ if os.path.lexists(destpath):
os.remove(destpath)
os.link(srcpath, destpath)
elif stat.S_ISCHR(mode) or stat.S_ISBLK(mode):
# Block or character device. Put contents of st_dev in a mknod.
- if os.path.exists(destpath):
+ if os.path.lexists(destpath):
os.remove(destpath)
os.mknod(destpath, file_stat.st_mode, file_stat.st_rdev)
os.chmod(destpath, file_stat.st_mode)