aboutsummaryrefslogtreecommitdiff
path: root/etc/bootstrap/bbot-bootstrap-msvc-14.bat
diff options
context:
space:
mode:
Diffstat (limited to 'etc/bootstrap/bbot-bootstrap-msvc-14.bat')
-rw-r--r--etc/bootstrap/bbot-bootstrap-msvc-14.bat57
1 files changed, 46 insertions, 11 deletions
diff --git a/etc/bootstrap/bbot-bootstrap-msvc-14.bat b/etc/bootstrap/bbot-bootstrap-msvc-14.bat
index 8d8bb89..efa1ecd 100644
--- a/etc/bootstrap/bbot-bootstrap-msvc-14.bat
+++ b/etc/bootstrap/bbot-bootstrap-msvc-14.bat
@@ -5,6 +5,45 @@ rem license : TBC; see accompanying LICENSE file
setlocal EnableExtensions EnableDelayedExpansion
+goto start
+
+@rem Remove a directory recursively. Noop for non-existent directory.
+@rem
+@rem Note that the underlying rmdir call periodically fails with the
+@rem 'directory not empty' diagnostics, in which case we make up to 100
+@rem removal attempts.
+@rem
+:rmdir_S
+
+ @if not exist %1\ goto :eof
+
+ @setlocal EnableDelayedExpansion
+
+ @set /A "i=0"
+
+ :rmdir_S_try
+
+ @rem Note that rmdir doesn't properly set errorlevel, so we check for the
+ @rem directory existence to detect the failure.
+ @rem
+ rmdir /S /Q %1\
+
+ @if exist %1\ (
+ if %i% neq 99 (
+ set /A "i=%i%+1"
+ goto rmdir_S_try
+ )
+
+ echo error: unable to remove %1\
+ endlocal
+ exit /b 1
+ )
+
+ @endlocal
+@goto :eof
+
+:start
+
set "MSVC=C:\Program Files (x86)\Microsoft Visual Studio 14.0"
set "VCVARS=%MSVC%\VC\vcvarsall.bat"
set "VCARCH=amd64"
@@ -45,18 +84,14 @@ rem
@rem
@rem Bootstrap the toolchain and then build bbot.
@rem
-@if exist %BUILD%\bootstrap\ (
- rmdir /S /Q %BUILD%\bootstrap
- @if errorlevel 1 goto error
-)
+@call :rmdir_S %BUILD%\bootstrap
+@if errorlevel 1 goto error
mkdir %BUILD%\bootstrap
@if errorlevel 1 goto error
-@if exist %INSTALL% (
- rmdir /S /Q %INSTALL%
- @if errorlevel 1 goto error
-)
+@call :rmdir_S %INSTALL%
+@if errorlevel 1 goto error
cd %BUILD%\bootstrap
@@ -124,7 +159,7 @@ cmd /C build-msvc.bat --timeout %TIMEOUT% --install-dir %INSTALL%^
@if errorlevel 1 goto error
cd ..
-rmdir /S /Q %bstrap%
+@call :rmdir_S %bstrap%
@if errorlevel 1 goto error
@@ -137,7 +172,7 @@ rmdir /S /Q %bstrap%
@rem
@rem Build and install the bbot worker.
@rem
-@for /D %%d in (build2-toolchain-*) do set "config=%%d"
+@for /D %%d in (build2-toolchain-*) do @set "config=%%d"
cd %config%
bpkg --fetch-timeout %TIMEOUT% build --yes bbot
@@ -147,7 +182,7 @@ bpkg install bbot
@if errorlevel 1 goto error
cd ..
-rmdir /S /Q %config%
+@call :rmdir_S %config%
@if errorlevel 1 goto error
@rem