Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad6ddd8

Browse files
authored
[3.9] bpo-47032: Ensure Windows install builds fail correctly with a non-zero exit code when part of the build fails (GH-31921) (GH-31927)
Automerge-Triggered-By: GH:zooba
1 parent 70eb9db commit ad6ddd8

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Ensure Windows install builds fail correctly with a non-zero exit code when
2+
part of the build fails.

Tools/msi/build.bat

+11-10
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,26 @@ call "%PCBUILD%find_msbuild.bat" %MSBUILD%
2727
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
2828

2929
if defined BUILDX86 (
30-
call "%PCBUILD%build.bat" -d -e %REBUILD% %BUILDTEST%
31-
if errorlevel 1 goto :eof
32-
call "%PCBUILD%build.bat" -e %REBUILD% %BUILDTEST%
33-
if errorlevel 1 goto :eof
30+
call "%PCBUILD%build.bat" -p Win32 -d -e %REBUILD% %BUILDTEST%
31+
if errorlevel 1 exit /B %ERRORLEVEL%
32+
call "%PCBUILD%build.bat" -p Win32 -e %REBUILD% %BUILDTEST%
33+
if errorlevel 1 exit /B %ERRORLEVEL%
3434
)
3535
if defined BUILDX64 (
3636
call "%PCBUILD%build.bat" -p x64 -d -e %REBUILD% %BUILDTEST%
37-
if errorlevel 1 goto :eof
37+
if errorlevel 1 exit /B %ERRORLEVEL%
3838
call "%PCBUILD%build.bat" -p x64 -e %REBUILD% %BUILDTEST%
39-
if errorlevel 1 goto :eof
39+
if errorlevel 1 exit /B %ERRORLEVEL%
4040
)
4141

4242
if defined BUILDDOC (
4343
call "%PCBUILD%..\Doc\make.bat" htmlhelp
44-
if errorlevel 1 goto :eof
44+
if errorlevel 1 exit /B %ERRORLEVEL%
4545
)
4646

4747
rem Build the launcher MSI separately
4848
%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86
49+
if errorlevel 1 exit /B %ERRORLEVEL%
4950

5051
set BUILD_CMD="%D%bundle\snapshot.wixproj"
5152
if defined BUILDTEST (
@@ -59,12 +60,12 @@ if defined REBUILD (
5960
)
6061

6162
if defined BUILDX86 (
62-
%MSBUILD% %BUILD_CMD%
63-
if errorlevel 1 goto :eof
63+
%MSBUILD% /p:Platform=x86 %BUILD_CMD%
64+
if errorlevel 1 exit /B %ERRORLEVEL%
6465
)
6566
if defined BUILDX64 (
6667
%MSBUILD% /p:Platform=x64 %BUILD_CMD%
67-
if errorlevel 1 goto :eof
68+
if errorlevel 1 exit /B %ERRORLEVEL%
6869
)
6970

7071
exit /B 0

Tools/msi/buildrelease.bat

+15-14
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ if "%SKIPBUILD%" EQU "1" goto skipdoc
8080
if "%SKIPDOC%" EQU "1" goto skipdoc
8181

8282
call "%D%..\..\doc\make.bat" htmlhelp
83-
if errorlevel 1 goto :eof
83+
if errorlevel 1 exit /B %ERRORLEVEL%
8484
:skipdoc
8585

8686
where dlltool /q && goto skipdlltoolsearch
@@ -93,16 +93,17 @@ set _DLLTOOL_PATH=
9393

9494
if defined BUILDX86 (
9595
call :build x86
96-
if errorlevel 1 exit /B
96+
if errorlevel 1 exit /B %ERRORLEVEL%
9797
)
9898

9999
if defined BUILDX64 (
100100
call :build x64 "%PGO%"
101-
if errorlevel 1 exit /B
101+
if errorlevel 1 exit /B %ERRORLEVEL%
102102
)
103103

104104
if defined TESTTARGETDIR (
105105
call "%D%testrelease.bat" -t "%TESTTARGETDIR%"
106+
if errorlevel 1 exit /B %ERRORLEVEL%
106107
)
107108

108109
exit /B 0
@@ -128,19 +129,19 @@ if "%1" EQU "x86" (
128129
if exist "%BUILD%en-us" (
129130
echo Deleting %BUILD%en-us
130131
rmdir /q/s "%BUILD%en-us"
131-
if errorlevel 1 exit /B
132+
if errorlevel 1 exit /B %ERRORLEVEL%
132133
)
133134

134135
if exist "%D%obj\Debug_%OBJDIR_PLAT%" (
135136
echo Deleting "%D%obj\Debug_%OBJDIR_PLAT%"
136137
rmdir /q/s "%D%obj\Debug_%OBJDIR_PLAT%"
137-
if errorlevel 1 exit /B
138+
if errorlevel 1 exit /B %ERRORLEVEL%
138139
)
139140

140141
if exist "%D%obj\Release_%OBJDIR_PLAT%" (
141142
echo Deleting "%D%obj\Release_%OBJDIR_PLAT%"
142143
rmdir /q/s "%D%obj\Release_%OBJDIR_PLAT%"
143-
if errorlevel 1 exit /B
144+
if errorlevel 1 exit /B %ERRORLEVEL%
144145
)
145146

146147
if not "%CERTNAME%" EQU "" (
@@ -156,41 +157,41 @@ if not "%PGO%" EQU "" (
156157
if not "%SKIPBUILD%" EQU "1" (
157158
@echo call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %PGOOPTS% %CERTOPTS%
158159
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %PGOOPTS% %CERTOPTS%
159-
@if errorlevel 1 exit /B
160+
@if errorlevel 1 exit /B %ERRORLEVEL%
160161
@rem build.bat turns echo back on, so we disable it again
161162
@echo off
162163

163164
@echo call "%PCBUILD%build.bat" -d -e -p %BUILD_PLAT% -t %TARGET%
164165
@call "%PCBUILD%build.bat" -d -e -p %BUILD_PLAT% -t %TARGET%
165-
@if errorlevel 1 exit /B
166+
@if errorlevel 1 exit /B %ERRORLEVEL%
166167
@rem build.bat turns echo back on, so we disable it again
167168
@echo off
168169
)
169170

170171
if "%OUTDIR_PLAT%" EQU "win32" (
171172
%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI%
172-
if errorlevel 1 exit /B
173+
if errorlevel 1 exit /B %ERRORLEVEL%
173174
) else if not exist "%Py_OutDir%win32\en-us\launcher.msi" (
174175
%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI%
175-
if errorlevel 1 exit /B
176+
if errorlevel 1 exit /B %ERRORLEVEL%
176177
)
177178

178179
set BUILDOPTS=/p:Platform=%1 /p:BuildForRelease=true /p:DownloadUrl=%DOWNLOAD_URL% /p:DownloadUrlBase=%DOWNLOAD_URL_BASE% /p:ReleaseUri=%RELEASE_URI%
179180
if defined BUILDMSI (
180181
%MSBUILD% "%D%bundle\releaselocal.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=true
181-
if errorlevel 1 exit /B
182+
if errorlevel 1 exit /B %ERRORLEVEL%
182183
%MSBUILD% "%D%bundle\releaseweb.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=false
183-
if errorlevel 1 exit /B
184+
if errorlevel 1 exit /B %ERRORLEVEL%
184185
)
185186

186187
if defined BUILDZIP (
187188
%MSBUILD% "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% /p:OutputPath="%BUILD%en-us"
188-
if errorlevel 1 exit /B
189+
if errorlevel 1 exit /B %ERRORLEVEL%
189190
)
190191

191192
if defined BUILDNUGET (
192193
%MSBUILD% "%D%..\nuget\make_pkg.proj" /t:Build /p:Configuration=Release /p:Platform=%1 /p:OutputPath="%BUILD%en-us"
193-
if errorlevel 1 exit /B
194+
if errorlevel 1 exit /B %ERRORLEVEL%
194195
)
195196

196197
if not "%OUTDIR%" EQU "" (

0 commit comments

Comments
 (0)