properly propagate extraction error in Windows deps build script

This commit is contained in:
otavepto 2023-12-25 15:11:12 +02:00
parent 82197aefdd
commit 39a4745336

View File

@ -67,7 +67,10 @@ if %jobs_count% lss 2 (
set /a jobs_count=2 set /a jobs_count=2
) )
call :extract_all_deps call :extract_all_deps || (
set /a last_code=1
goto :end_script
)
:: ############## common CMAKE args ############## :: ############## common CMAKE args ##############
:: https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG.html#variable:CMAKE_%3CLANG%3E_FLAGS_%3CCONFIG%3E :: https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG.html#variable:CMAKE_%3CLANG%3E_FLAGS_%3CCONFIG%3E
@ -343,8 +346,7 @@ goto :end_script
) )
if "%list%"=="-1" ( if "%list%"=="-1" (
call :err_msg "Couldn't find list of tools to extract inside thif batch script" call :err_msg "Couldn't find list of tools to extract inside thif batch script"
set /a last_code=1 exit /b 1
goto :end_script
) )
rmdir /s /q "%deps_dir%" rmdir /s /q "%deps_dir%"
@ -355,18 +357,20 @@ goto :end_script
) )
echo // Extracting archive "%third_party_common_dir%\%%~A" to "%deps_dir%\%%~B" echo // Extracting archive "%third_party_common_dir%\%%~A" to "%deps_dir%\%%~B"
if not exist "%third_party_common_dir%\%%~A" (
call :err_msg "File not found"
exit /b 1
)
for /f "usebackq tokens=* delims=" %%Z in ('"%%~nA"') do ( for /f "usebackq tokens=* delims=" %%Z in ('"%%~nA"') do (
if /i "%%~xZ%%~xA"==".tar.gz" ( if /i "%%~xZ%%~xA"==".tar.gz" (
"%extractor%" x "%third_party_common_dir%\%%~A" -so | "%extractor%" x -si -ttar -y -aoa -o"%deps_dir%\%%~B" || ( "%extractor%" x "%third_party_common_dir%\%%~A" -so | "%extractor%" x -si -ttar -y -aoa -o"%deps_dir%\%%~B" || (
call :err_msg "Extraction failed" call :err_msg "Extraction failed"
set /a last_code=1 exit /b 1
goto :end_script
) )
) else ( ) else (
"%extractor%" x "%third_party_common_dir%\%%~A" -y -aoa -o"%deps_dir%\%%~B" || ( "%extractor%" x "%third_party_common_dir%\%%~A" -y -aoa -o"%deps_dir%\%%~B" || (
call :err_msg "Extraction failed" call :err_msg "Extraction failed"
set /a last_code=1 exit /b 1
goto :end_script
) )
) )
) )
@ -376,8 +380,7 @@ goto :end_script
robocopy /E /MOVE /MT4 /NS /NC /NFL /NDL /NP /NJH /NJS "%deps_dir%\%%~B\%%~C" "%deps_dir%\%%~B" robocopy /E /MOVE /MT4 /NS /NC /NFL /NDL /NP /NJH /NJS "%deps_dir%\%%~B\%%~C" "%deps_dir%\%%~B"
if ERRORLEVEL 8 ( if ERRORLEVEL 8 (
call :err_msg "Failed to flatten dir of dep" call :err_msg "Failed to flatten dir of dep"
set /a last_code=1 exit /b 1
goto :end_script
) )
if exist "%deps_dir%\%%~B\%%~C" ( if exist "%deps_dir%\%%~B\%%~C" (
@ -388,7 +391,7 @@ goto :end_script
) )
:extract_all_deps_end :extract_all_deps_end
exit /b exit /b 0
:err_msg :err_msg
1>&2 echo [X] %~1 1>&2 echo [X] %~1