diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-03-01 17:28:57 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-03-01 17:28:57 +0000 |
commit | 1b16bb71e792228302cd7bb9dabef9220c7ca5b1 (patch) | |
tree | 9d4db18286514af997433cff5a6d55ac4259d5d1 | |
parent | c909f89474fbdb3a57e647f2edb81f45ef6a55f3 (diff) | |
parent | 5b28c2a885a2e77578f3c37e3dd534055ba3a3e9 (diff) | |
download | morph-1b16bb71e792228302cd7bb9dabef9220c7ca5b1.tar.gz |
Merge branch 'liw/hardlinking-symlinks' of git://git.baserock.org/baserock/baserock/morph
-rw-r--r-- | morphlib/stagingarea.py | 8 |
1 files changed, 4 insertions, 4 deletions
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) |