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

Skip to content

Commit f2beceb

Browse files
authored
bpo-29624: Adds purge step and layout test after uploading files. (#258) (#264)
1 parent 2197eac commit f2beceb

File tree

2 files changed

+53
-10
lines changed

2 files changed

+53
-10
lines changed

Tools/msi/uploadrelease.bat

+22-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ set USER=
99
set TARGET=
1010
set DRYRUN=false
1111
set NOGPG=
12+
set PURGE_OPTION=/p:Purge=true
13+
set NOTEST=
1214

1315
:CheckOpts
1416
if "%1" EQU "-h" goto Help
@@ -19,7 +21,11 @@ if "%1" EQU "--user" (set USER=%~2) && shift && shift && goto CheckOpts
1921
if "%1" EQU "-t" (set TARGET=%~2) && shift && shift && goto CheckOpts
2022
if "%1" EQU "--target" (set TARGET=%~2) && shift && shift && goto CheckOpts
2123
if "%1" EQU "--dry-run" (set DRYRUN=true) && shift && goto CheckOpts
22-
if "%1" EQU "--no-gpg" (set NOGPG=true) && shift && goto CheckOpts
24+
if "%1" EQU "--skip-gpg" (set NOGPG=true) && shift && goto CheckOpts
25+
if "%1" EQU "--skip-purge" (set PURGE_OPTION=) && shift && godo CheckOpts
26+
if "%1" EQU "--skip-test" (set NOTEST=true) && shift && godo CheckOpts
27+
if "%1" EQU "-T" (set NOTEST=true) && shift && godo CheckOpts
28+
if "%1" NEQ "" echo Unexpected argument "%1" & exit /B 1
2329

2430
if not defined PLINK where plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc"
2531
if not defined PLINK where /R "%ProgramFiles(x86)%\PuTTY" plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc"
@@ -35,7 +41,7 @@ echo Found pscp.exe at %PSCP%
3541

3642
if defined NOGPG (
3743
set GPG=
38-
echo Skipping GPG signature generation because of --no-gpg
44+
echo Skipping GPG signature generation because of --skip-gpg
3945
) else (
4046
if not defined GPG where gpg2 > "%TEMP%\gpg.loc" 2> nul && set /P GPG= < "%TEMP%\gpg.loc" & del "%TEMP%\gpg.loc"
4147
if not defined GPG where /R "%PCBUILD%..\externals\windows-installer" gpg2 > "%TEMP%\gpg.loc" 2> nul && set /P GPG= < "%TEMP%\gpg.loc" & del "%TEMP%\gpg.loc"
@@ -45,8 +51,12 @@ if defined NOGPG (
4551

4652
call "%PCBUILD%env.bat" > nul 2> nul
4753
pushd "%D%"
48-
msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86
49-
msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false
54+
msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86 %PURGE_OPTION%
55+
msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false %PURGE_OPTION%
56+
if not defined NOTEST (
57+
msbuild /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x86
58+
msbuild /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x64
59+
)
5060
msbuild /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x86
5161
msbuild /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x64 /p:IncludeDoc=false
5262
popd
@@ -55,9 +65,12 @@ exit /B 0
5565
:Help
5666
echo uploadrelease.bat --host HOST --user USERNAME [--target TARGET] [--dry-run] [-h]
5767
echo.
58-
echo --host (-o) Specify the upload host (required)
59-
echo --user (-u) Specify the user on the host (required)
60-
echo --target (-t) Specify the target directory on the host
61-
echo --dry-run Display commands and filenames without executing them
62-
echo -h Display this help information
68+
echo --host (-o) Specify the upload host (required)
69+
echo --user (-u) Specify the user on the host (required)
70+
echo --target (-t) Specify the target directory on the host
71+
echo --dry-run Display commands and filenames without executing them
72+
echo --skip-gpg Does not generate GPG signatures before uploading
73+
echo --skip-purge Does not perform CDN purge after uploading
74+
echo --skip-test (-T) Does not perform post-upload tests
75+
echo -h Display this help information
6376
echo.

Tools/msi/uploadrelease.proj

+31-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<DownloadUrlBase Condition="'$(DownloadUrlBase)' == ''">/srv/www.python.org/ftp/python</DownloadUrlBase>
1010
<IncludeDoc Condition="'$(IncludeDoc)' == ''">true</IncludeDoc>
1111
<DryRun Condition="'$(DryRun)' == ''">false</DryRun>
12+
<Purge Condition="'$(Purge)' == ''">false</Purge>
1213
</PropertyGroup>
1314

1415
<Import Project="msi.props" />
@@ -64,7 +65,36 @@ echo.
6465
echo." />
6566
</Target>
6667

67-
<Target Name="Upload" DependsOnTargets="_ValidateProperties;_RunGpg;_PrintNames;_Upload" />
68+
<Target Name="_Purge" Condition="$(Purge) and !$(DryRun)">
69+
<Error Condition="!Exists('$(PythonExe)')" Text="No Python executable available at $(PythonExe)" />
70+
<Exec Command="&quot;$(PythonExe)&quot; purge.py $(PythonVersion)" />
71+
</Target>
72+
73+
<Target Name="_TestLayout">
74+
<ItemGroup>
75+
<WebInstaller Include="$(OutputPath)\*-webinstall.exe" />
76+
<WebInstaller>
77+
<SourceDir>$(TEMP)\%(Filename)_source</SourceDir>
78+
<SourceExe>$(TEMP)\%(Filename)_source\%(Filename)%(Extension)</SourceExe>
79+
<LayoutDir>$(TEMP)\%(Filename)_layout</LayoutDir>
80+
<LogDir>$(OutputPath)\%(Filename)_layoutlog</LogDir>
81+
<LogFile>$(OutputPath)\%(Filename)_layoutlog\%(Filename).log</LogFile>
82+
</WebInstaller>
83+
</ItemGroup>
84+
<RemoveDir Directories="%(WebInstaller.SourceDir)" Condition="Exists('%(WebInstaller.SourceDir)')" />
85+
<RemoveDir Directories="%(WebInstaller.LayoutDir)" Condition="Exists('%(WebInstaller.LayoutDir)')" />
86+
<RemoveDir Directories="%(WebInstaller.LogDir)" Condition="Exists('%(WebInstaller.LogDir)')" />
87+
<MakeDir Directories="%(WebInstaller.SourceDir)" />
88+
<Copy SourceFiles="@(WebInstaller)" DestinationFiles="%(WebInstaller.SourceExe)" />
89+
<Exec Command="start &quot;Install test&quot; /wait &quot;%(WebInstaller.SourceExe)&quot; /layout &quot;%(WebInstaller.LayoutDir)&quot; /passive /log &quot;%(WebInstaller.LogFile)&quot;"
90+
IgnoreExitCode="false" />
91+
<RemoveDir Directories="%(WebInstaller.LayoutDir)" />
92+
<RemoveDir Directories="%(WebInstaller.SourceDir)" />
93+
<RemoveDir Directories="%(WebInstaller.LogDir)" />
94+
</Target>
95+
96+
<Target Name="Upload" DependsOnTargets="_ValidateProperties;_RunGpg;_PrintNames;_Upload;_Purge" />
97+
<Target Name="Test" DependsOnTargets="_TestLayout" />
6898

6999
<Target Name="ShowHashes">
70100
<ItemGroup>

0 commit comments

Comments
 (0)