aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/minstall.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-08-23 21:55:52 +0300
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-08-23 21:53:38 -0700
commitf34f0717e00756ea786ac62b3126d3425fcd6649 (patch)
tree1745a34300516ad9c02aaec66b3a6afddf4a19d9 /mesonbuild/minstall.py
parent23e6200c1470c33426e3f99eba32ebed4e76ca3a (diff)
downloadmeson-f34f0717e00756ea786ac62b3126d3425fcd6649.zip
meson-f34f0717e00756ea786ac62b3126d3425fcd6649.tar.gz
meson-f34f0717e00756ea786ac62b3126d3425fcd6649.tar.bz2
Revert symlink copy behaviour. Closes #4069.
Diffstat (limited to 'mesonbuild/minstall.py')
-rw-r--r--mesonbuild/minstall.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 748f06b..1d72179 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)