[PATCH] D129263: Windows packaging script. Check administrator permissions and/or 7-Zip version.

Carlos Alberto Enciso via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 22:39:44 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdf7c5772a2db: Update the Windows packaging script. (authored by CarlosAlbertoEnciso).

Changed prior to commit:
  https://reviews.llvm.org/D129263?vs=443213&id=443836#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129263/new/

https://reviews.llvm.org/D129263

Files:
  llvm/utils/release/build_llvm_release.bat


Index: llvm/utils/release/build_llvm_release.bat
===================================================================
--- llvm/utils/release/build_llvm_release.bat
+++ 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 @@
 
 :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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129263.443836.patch
Type: text/x-patch
Size: 1378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220712/f862e859/attachment.bin>


More information about the llvm-commits mailing list