[llvm] df7c577 - Update the Windows packaging script.
Carlos Alberto Enciso via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 11 22:39:37 PDT 2022
Author: Carlos Alberto Enciso
Date: 2022-07-12T06:37:29+01:00
New Revision: df7c5772a2db6dd7bcf4a89bae4543a8f8984916
URL: https://github.com/llvm/llvm-project/commit/df7c5772a2db6dd7bcf4a89bae4543a8f8984916
DIFF: https://github.com/llvm/llvm-project/commit/df7c5772a2db6dd7bcf4a89bae4543a8f8984916.diff
LOG: Update the Windows packaging script.
As discussed on:
https://discourse.llvm.org/t/build-llvm-release-bat-script-options/63146/6
Latest 7-zip versions (21.x) require administrator permissions
to create symbolic links.
Check if any of the following conditions is true:
- Version of 7-zip is 20.x or older
- Script is running with administrator permissions
Reviewed By: hans, thieta
Differential Revision: https://reviews.llvm.org/D129263
Added:
Modified:
llvm/utils/release/build_llvm_release.bat
Removed:
################################################################################
diff --git a/llvm/utils/release/build_llvm_release.bat b/llvm/utils/release/build_llvm_release.bat
index e44fc141f92c3..5fa140940e30b 100755
--- a/llvm/utils/release/build_llvm_release.bat
+++ b/llvm/utils/release/build_llvm_release.bat
@@ -1,5 +1,5 @@
@echo off
-setlocal
+setlocal enabledelayedexpansion
if "%1"=="" goto usage
goto begin
@@ -16,6 +16,30 @@ exit /b
:begin
+REM Note:
+REM 7zip versions 21.x and higher will try to extract the symlinks in
+REM llvm's git archive, which requires running as administrator.
+
+REM Check 7-zip version and/or administrator permissions.
+for /f "delims=" %%i in ('7z.exe ^| findstr /r "2[1-9].[0-9][0-9]"') do set version=%%i
+if not "%version%"=="" (
+ REM Unique temporary filename to use by the 'mklink' command.
+ set "link_name=%temp%\%username%_%random%_%random%.tmp"
+
+ REM As the 'mklink' requires elevated permissions, the symbolic link
+ REM creation will fail if the script is not running as administrator.
+ mklink /d "!link_name!" . 1>nul 2>nul
+ if errorlevel 1 (
+ echo.
+ echo Script requires administrator permissions, or a 7-zip version 20.x or older.
+ echo Current version is "%version%"
+ exit /b
+ ) else (
+ REM Remove the temporary symbolic link.
+ rd "!link_name!"
+ )
+)
+
REM Prerequisites:
REM
REM Visual Studio 2019, CMake, Ninja, GNUWin32, SWIG, Python 3,
More information about the llvm-commits
mailing list