aboutsummaryrefslogtreecommitdiff
path: root/buildtools/packman/win-bootstrap
diff options
context:
space:
mode:
authorBryan Galdrikian <[email protected]>2018-01-22 14:04:16 -0800
committerBryan Galdrikian <[email protected]>2018-01-22 14:04:16 -0800
commit1dc1a87fba520bb45c1ce8165e8ea2c83c0a308d (patch)
tree5f8ca75a6b92c60fb5cf3b14282fc4cc1c127eb2 /buildtools/packman/win-bootstrap
parentUpdating readme.md to show updated UE4 Blast integration branches (diff)
downloadblast-1dc1a87fba520bb45c1ce8165e8ea2c83c0a308d.tar.xz
blast-1dc1a87fba520bb45c1ce8165e8ea2c83c0a308d.zip
Changes for 1.1.2 release candidate
See README.md, docs/release_notes.txt
Diffstat (limited to 'buildtools/packman/win-bootstrap')
-rw-r--r--buildtools/packman/win-bootstrap/configure.bat6
-rw-r--r--buildtools/packman/win-bootstrap/fetch_file_from_s3.cmd (renamed from buildtools/packman/win-bootstrap/fetch_file.cmd)16
-rw-r--r--buildtools/packman/win-bootstrap/fetch_file_from_s3.ps175
3 files changed, 58 insertions, 39 deletions
diff --git a/buildtools/packman/win-bootstrap/configure.bat b/buildtools/packman/win-bootstrap/configure.bat
index 8f3d7b8..7963ac2 100644
--- a/buildtools/packman/win-bootstrap/configure.bat
+++ b/buildtools/packman/win-bootstrap/configure.bat
@@ -1,4 +1,4 @@
-@set PM_PACKMAN_VERSION=4.0-rc3
+@set PM_PACKMAN_VERSION=4.0.1
:: Specify where config file could exist
@set PM_CONFIG_PATH=%~dp0..\packman_config.txt
@@ -45,7 +45,7 @@
@for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do @set TEMP_FILE_NAME=%%a
@set TARGET=%TEMP_FILE_NAME%.exe
-@call "%~dp0fetch_file.cmd" s3 %PM_PYTHON_PACKAGE% UNUSED_BOGUS_GUID %TARGET%
+@call "%~dp0fetch_file_from_s3.cmd" %PM_PYTHON_PACKAGE% %TARGET%
@if errorlevel 1 goto ERROR
@echo Unpacking ...
@@ -69,7 +69,7 @@
@set PM_MODULE_PACKAGE=packman@%PM_PACKMAN_VERSION%-common.zip
@for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do @set TEMP_FILE_NAME=%%a
@set TARGET=%TEMP_FILE_NAME%
-@call "%~dp0fetch_file.cmd" s3 %PM_MODULE_PACKAGE% UNUSED_BOGUS_GUID %TARGET%
+@call "%~dp0fetch_file_from_s3.cmd" %PM_MODULE_PACKAGE% %TARGET%
@if errorlevel 1 goto ERROR
@echo Unpacking ...
diff --git a/buildtools/packman/win-bootstrap/fetch_file.cmd b/buildtools/packman/win-bootstrap/fetch_file_from_s3.cmd
index 298b6a0..974d5ec 100644
--- a/buildtools/packman/win-bootstrap/fetch_file.cmd
+++ b/buildtools/packman/win-bootstrap/fetch_file_from_s3.cmd
@@ -1,19 +1,15 @@
-:: You need to specify <package-source> <package-name> <package-guid> <target-name> as input to this command
+:: You need to specify <package-name> <target-name> as input to this command
-@set PACKAGE_NAME=%2
-@set PACKAGE_GUID=%3
-@set TARGET=%4
+@set PACKAGE_NAME=%1
+@set TARGET=%2
-@echo Fetching %PACKAGE_NAME% from %1 ...
+@echo Fetching %PACKAGE_NAME% from s3 ...
-@if ["%1"] EQU ["s3"] set SOURCE_OPT=-sourceName %PACKAGE_NAME%
-@if ["%1"] EQU ["gtl"] set SOURCE_OPT=-sourceGUID %PACKAGE_GUID%
-
-@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_%1.ps1" %SOURCE_OPT% -output %TARGET%
+@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_s3.ps1" -sourceName %PACKAGE_NAME% -output %TARGET%
:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option
:: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes:
@if not exist %TARGET% goto ERROR_DOWNLOAD_FAILED
-@if %~z4==0 goto ERROR_DOWNLOAD_FAILED
+@if %~z2==0 goto ERROR_DOWNLOAD_FAILED
@exit /b 0
diff --git a/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1 b/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1
index e424058..fc588d9 100644
--- a/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1
+++ b/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1
@@ -5,33 +5,56 @@ param(
$source = "http://packman.s3.amazonaws.com/" + $sourceName
$filename = $output
-$req = [System.Net.httpwebrequest]::Create($source)
-$req.cookiecontainer = New-Object System.net.CookieContainer
+$triesLeft = 3
-Write-Host "Connecting to S3 ..."
-$res = $req.GetResponse()
+do
+{
+ $triesLeft -= 1
+ $req = [System.Net.httpwebrequest]::Create($source)
+ $req.cookiecontainer = New-Object System.net.CookieContainer
-if($res.StatusCode -eq "OK") {
- Write-Host "Downloading ..."
- [int]$goal = $res.ContentLength
- $reader = $res.GetResponseStream()
- $writer = new-object System.IO.FileStream $fileName, "Create"
- [byte[]]$buffer = new-object byte[] 4096
- [int]$total = [int]$count = 0
- do
- {
- $count = $reader.Read($buffer, 0, $buffer.Length);
- $writer.Write($buffer, 0, $count);
- $total += $count
- if($goal -gt 0) {
- Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100)
- } else {
- Write-Progress "Downloading $url" "Saving $total bytes..." -id 0
+ try
+ {
+ Write-Host "Connecting to S3 ..."
+ $res = $req.GetResponse()
+ if($res.StatusCode -eq "OK") {
+ Write-Host "Downloading ..."
+ [int]$goal = $res.ContentLength
+ $reader = $res.GetResponseStream()
+ $writer = new-object System.IO.FileStream $fileName, "Create"
+ [byte[]]$buffer = new-object byte[] 4096
+ [int]$total = [int]$count = 0
+ do
+ {
+ $count = $reader.Read($buffer, 0, $buffer.Length);
+ $writer.Write($buffer, 0, $count);
+ $total += $count
+ if($goal -gt 0) {
+ Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100)
+ } else {
+ Write-Progress "Downloading $url" "Saving $total bytes..." -id 0
+ }
+ } while ($count -gt 0)
+
+ $triesLeft = 0
+ }
}
- } while ($count -gt 0)
-
- $reader.Close()
- $writer.Flush()
- $writer.Close()
-}
+ catch
+ {
+ Write-Host "Error connecting to S3!"
+ Write-Host $_.Exception|format-list -force
+ }
+ finally
+ {
+ if ($reader)
+ {
+ $reader.Close()
+ }
+ if ($writer)
+ {
+ $writer.Flush()
+ $writer.Close()
+ }
+ }
+} while ($triesLeft -gt 0)