aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-08-23 21:55:52 +0300
committerNirbheek Chauhan <nirbheek@centricular.com>2018-08-24 08:51:22 +0530
commit06645b157ea44734a0d0f9a98c7c835cf09c94d5 (patch)
tree92ab5ef8b3b5ee9f6459eb82a18202b48273922f
parent4ec063cfc4943426d590a785f073460b23a8832a (diff)
downloadmeson-06645b157ea44734a0d0f9a98c7c835cf09c94d5.zip
meson-06645b157ea44734a0d0f9a98c7c835cf09c94d5.tar.gz
meson-06645b157ea44734a0d0f9a98c7c835cf09c94d5.tar.bz2
Revert symlink copy behaviour. Closes #4069.
-rw-r--r--mesonbuild/minstall.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 1ca8492..bef814b 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -27,6 +27,10 @@ except ImportError:
# This is only used for pkexec which is not, so this is fine.
main_file = None
+symlink_warning = '''Warning: trying to copy a symlink that points to a file. This will copy the file,
+but this will be changed in a future version of Meson to copy the symlink as is. Please update your
+build definitions so that it will not break when the change happens.'''
+
selinux_updates = []
def buildparser():
@@ -242,7 +246,15 @@ class Installer:
os.remove(to_file)
print('Installing %s to %s' % (from_file, outdir))
if os.path.islink(from_file):
- shutil.copy(from_file, outdir, follow_symlinks=False)
+ if not os.path.exists(from_file):
+ # Dangling symlink. Replicate as is.
+ shutil.copy(from_file, outdir, follow_symlinks=False)
+ else:
+ # Remove this entire branch when changing the behaviour to duplicate
+ # symlinks rather than copying what they point to.
+ print(symlink_warning)
+ shutil.copyfile(from_file, to_file)
+ shutil.copystat(from_file, to_file)
else:
shutil.copyfile(from_file, to_file)
shutil.copystat(from_file, to_file)