[llvm] 7db64e2 - Disable relative paths in lit.site.cfg in presence of symlinks
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 4 09:35:52 PDT 2020
Author: Nico Weber
Date: 2020-04-04T12:35:40-04:00
New Revision: 7db64e202f9951b1bd94ae585ec58b2d857c2246
URL: https://github.com/llvm/llvm-project/commit/7db64e202f9951b1bd94ae585ec58b2d857c2246
DIFF: https://github.com/llvm/llvm-project/commit/7db64e202f9951b1bd94ae585ec58b2d857c2246.diff
LOG: Disable relative paths in lit.site.cfg in presence of symlinks
See https://reviews.llvm.org/D77184#1961208
Added:
Modified:
llvm/cmake/modules/AddLLVM.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index e0ceb364c3ea..40a5be432d7b 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1501,11 +1501,15 @@ function(configure_lit_site_cfg site_in site_out)
get_filename_component(OUTPUT_DIR ${site_out} DIRECTORY)
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "\n
import os, sys\n
-drive = os.path.splitdrive(sys.argv[1])[0]\n
+base = sys.argv[1]
+def haslink(p):\n
+ if not p or p == os.path.dirname(p): return False\n
+ return os.path.islink(p) or haslink(os.path.dirname(p))\n
def relpath(p):\n
if not p: return ''\n
- if os.path.splitdrive(p)[0] != drive: return p\n
- return os.path.relpath(p, sys.argv[1]).replace(os.sep, '/')\n
+ if os.path.splitdrive(p)[0] != os.path.splitdrive(base)[0]: return p\n
+ if haslink(p) or haslink(base): return p\n
+ return os.path.relpath(p, base).replace(os.sep, '/')\n
sys.stdout.write(';'.join(relpath(p) for p in sys.argv[2].split(';')))"
${OUTPUT_DIR}
${ARG_PATH_VALUES_ESCAPED}
More information about the llvm-commits
mailing list