diff options
author | Oliver Breitwieser <oliver.breitwieser@kip.uni-heidelberg.de> | 2017-09-15 08:55:12 -0400 |
---|---|---|
committer | scheibelp <scheibel1@llnl.gov> | 2017-11-02 18:45:40 -0700 |
commit | 94c0740a8850c7007ed1342979392c53878fe8cf (patch) | |
tree | 25454db3f1cdb901219f5554c3e8cfed103b16ad /lib/spack/llnl | |
parent | b9e840210402c07bb9a803586985cc1a6818f3fc (diff) | |
download | spack-94c0740a8850c7007ed1342979392c53878fe8cf.tar.gz spack-94c0740a8850c7007ed1342979392c53878fe8cf.tar.bz2 spack-94c0740a8850c7007ed1342979392c53878fe8cf.tar.xz spack-94c0740a8850c7007ed1342979392c53878fe8cf.zip |
link_tree: only remove matching files when unmerging
Diffstat (limited to 'lib/spack/llnl')
-rw-r--r-- | lib/spack/llnl/util/link_tree.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/link_tree.py b/lib/spack/llnl/util/link_tree.py index 49ee03c1ca..34a119f570 100644 --- a/lib/spack/llnl/util/link_tree.py +++ b/lib/spack/llnl/util/link_tree.py @@ -26,6 +26,7 @@ import os import shutil +import filecmp from llnl.util.filesystem import traverse_tree, mkdirp, touch @@ -113,4 +114,8 @@ class LinkTree(object): elif os.path.exists(dest): if not os.path.islink(dest): raise ValueError("%s is not a link tree!" % dest) - os.remove(dest) + # remove if dest is a hardlink/symlink to src; this will only + # be false if two packages are merged into a prefix and have a + # conflicting file + if filecmp.cmp(src, dest, shallow=True): + os.remove(dest) |