diff options
| author | Anton Novoselov <[email protected]> | 2017-08-01 12:53:38 +0300 |
|---|---|---|
| committer | Anton Novoselov <[email protected]> | 2017-08-01 12:53:38 +0300 |
| commit | 236f03c0b9a4982328ed1201978f7f69d192d9b2 (patch) | |
| tree | e486f2fa39dba203563895541e92c60ed3e25759 /buildtools/packman | |
| parent | Added screens to welcome page (diff) | |
| download | blast-236f03c0b9a4982328ed1201978f7f69d192d9b2.tar.xz blast-236f03c0b9a4982328ed1201978f7f69d192d9b2.zip | |
Blast 1.1 release (windows / linux)
see docs/release_notes.txt for details
Diffstat (limited to 'buildtools/packman')
| -rwxr-xr-x | buildtools/packman/linux/packman | 47 | ||||
| -rw-r--r-- | buildtools/packman/packman | 57 | ||||
| -rw-r--r-- | buildtools/packman/packman.cmd (renamed from buildtools/packman/windows/packman.cmd) | 2 | ||||
| -rw-r--r-- | buildtools/packman/packman_config.txt | 5 | ||||
| -rw-r--r-- | buildtools/packman/packmanapi.py | 16 | ||||
| -rw-r--r-- | buildtools/packman/source.conf | 1 | ||||
| -rw-r--r-- | buildtools/packman/win-bootstrap/configure.bat (renamed from buildtools/packman/windows/configure/configure.bat) | 17 | ||||
| -rw-r--r-- | buildtools/packman/win-bootstrap/fetch_file.cmd (renamed from buildtools/packman/windows/configure/fetch_file.cmd) | 0 | ||||
| -rw-r--r-- | buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1 (renamed from buildtools/packman/windows/configure/fetch_file_from_s3.ps1) | 0 | ||||
| -rw-r--r-- | buildtools/packman/win-bootstrap/fetch_file_from_url.ps1 (renamed from buildtools/packman/windows/configure/fetch_file_from_gtl.ps1) | 16 | ||||
| -rw-r--r-- | buildtools/packman/win-bootstrap/generate_temp_file_name.ps1 (renamed from buildtools/packman/windows/configure/generate_temp_file_name.ps1) | 0 | ||||
| -rw-r--r-- | buildtools/packman/win-bootstrap/install_package.py (renamed from buildtools/packman/windows/configure/install_package.py) | 0 | ||||
| -rw-r--r-- | buildtools/packman/windows/configure/fetch_file_from_s3_with_auth.ps1 | 55 |
13 files changed, 91 insertions, 125 deletions
diff --git a/buildtools/packman/linux/packman b/buildtools/packman/linux/packman deleted file mode 100755 index 65ad2fc..0000000 --- a/buildtools/packman/linux/packman +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -PM_PACKMAN_VERSION=3.7 - -# read source config to set PM_PACKAGE_SOURCE -PM_PACKAGE_SOURCE=`cat $(dirname "$0")/../source.conf` -export PM_PACKAGE_SOURCE -echo "PM_PACKAGE_SOURCE: '$PM_PACKAGE_SOURCE'" - -# The pagackes root may already be configured by the user -if [ -z "$PM_PACKAGES_ROOT" ]; then - export PM_PACKAGES_ROOT="${HOME}/packman-repo" -fi - -# Ensure the packages root path exists: -if [ ! -d "$PM_PACKAGES_ROOT" ]; then - echo "Creating packman packages repository at $PM_PACKAGES_ROOT" - mkdir "$PM_PACKAGES_ROOT" -fi - -# The packman module may be externally configured -if [ -z "$PM_MODULE_EXT" ]; then - PM_MODULE_DIR="$PM_PACKAGES_ROOT/packman/$PM_PACKMAN_VERSION-common" - export PM_MODULE="$PM_MODULE_DIR/packman.py" -else - export PM_MODULE="$PM_MODULE_EXT" -fi - -# Ensure the packman package exists: -if [ ! -f "$PM_MODULE" ]; then - PM_MODULE_PACKAGE="packman@$PM_PACKMAN_VERSION-common" - TARGET="/tmp/$PM_MODULE_PACKAGE.zip" - if [ "$PM_PACKAGE_SOURCE" = "gtl" ]; then - PM_COMMON_GUID=24ED6205-CFE6-4A64-A4B3-4BD87B64279F - echo "Fetching $PM_MODULE_PACKAGE from NVGTL using GUID $PM_COMMON_GUID..." - wget --quiet --user=svcgtlautomate --password='@ut0M@t3GTL$cr1pt$' -O$TARGET http://nvgtl.nvidia.com/download/$PM_COMMON_GUID - else - echo "Fetching $PM_MODULE_PACKAGE.zip from S3..." - wget --quiet -O$TARGET "http://packman.s3.amazonaws.com/$PM_MODULE_PACKAGE.zip" - fi - echo "Unpacking ..." - mkdir -p "$PM_MODULE_DIR" - unzip -q $TARGET -d "$PM_MODULE_DIR" - rm $TARGET -fi - -python $PM_MODULE $* diff --git a/buildtools/packman/packman b/buildtools/packman/packman new file mode 100644 index 0000000..6ab322c --- /dev/null +++ b/buildtools/packman/packman @@ -0,0 +1,57 @@ +#!/bin/sh + +PM_PACKMAN_VERSION=4.0-rc3 + +# Specify where configuration file could exist +export PM_CONFIG_PATH=$(dirname "$0")/packman_config.txt + +# The packages root may already be configured by the user +if [ -z "$PM_PACKAGES_ROOT" ]; then + export PM_PACKAGES_ROOT="${HOME}/packman-repo" +fi + +# Ensure the packages root path exists: +if [ ! -d "$PM_PACKAGES_ROOT" ]; then + echo "Creating packman packages repository at $PM_PACKAGES_ROOT" + mkdir -p "$PM_PACKAGES_ROOT" +fi + +# The packman module may be externally configured +if [ -z "$PM_MODULE_EXT" ]; then + PM_MODULE_DIR="$PM_PACKAGES_ROOT/packman/$PM_PACKMAN_VERSION-common" + export PM_MODULE="$PM_MODULE_DIR/packman.py" +else + export PM_MODULE="$PM_MODULE_EXT" +fi + +fetch_file_from_s3() +{ + SOURCE=$1 + SOURCE_URL=http://packman.s3.amazonaws.com/$SOURCE + TARGET=$2 + echo "Fetching $SOURCE from S3 ..." + if command -v wget >/dev/null 2>&1; then + wget --quiet -O$TARGET $SOURCE_URL + else + curl -o $TARGET $SOURCE_URL -s -S + fi +} + +# Ensure the packman package exists: +if [ ! -f "$PM_MODULE" ]; then + PM_MODULE_PACKAGE="packman@$PM_PACKMAN_VERSION-common.zip" + TARGET="/tmp/$PM_MODULE_PACKAGE" + # We always fetch packman from S3: + fetch_file_from_s3 $PM_MODULE_PACKAGE $TARGET + if [ "$?" -eq "0" ]; then + echo "Unpacking ..." + mkdir -p "$PM_MODULE_DIR" + unzip -q $TARGET -d "$PM_MODULE_DIR" + rm $TARGET + else + echo "Failure while fetching packman module from S3!" + exit 1 + fi +fi + +python "$PM_MODULE" $* diff --git a/buildtools/packman/windows/packman.cmd b/buildtools/packman/packman.cmd index f9678aa..a17027e 100644 --- a/buildtools/packman/windows/packman.cmd +++ b/buildtools/packman/packman.cmd @@ -1,7 +1,7 @@ :: Reset errorlevel status so we are not inheriting this state from the calling process: @call :RESET_ERROR :: You can remove the call below if you do your own manual configuration of the dev machines -@call "%~dp0\configure\configure.bat" +@call "%~dp0\win-bootstrap\configure.bat" @if errorlevel 1 exit /b 1 :: Everything below is mandatory @if not defined PM_PYTHON goto :PYTHON_ENV_ERROR diff --git a/buildtools/packman/packman_config.txt b/buildtools/packman/packman_config.txt new file mode 100644 index 0000000..da7a142 --- /dev/null +++ b/buildtools/packman/packman_config.txt @@ -0,0 +1,5 @@ +PM_PACKAGES_SOURCE=s3 +PM_GTL_USER=svcgtlautomate +PM_GTL_KEY=QHV0ME1AdDNHVEwkY3IxcHQk +PM_S3_READ_KEY_ID=AKIAJHPSPBMWMTZS6TJA +PM_S3_READ_SECRET_KEY=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 diff --git a/buildtools/packman/packmanapi.py b/buildtools/packman/packmanapi.py new file mode 100644 index 0000000..45ea711 --- /dev/null +++ b/buildtools/packman/packmanapi.py @@ -0,0 +1,16 @@ +import os +import sys + + +def get_packman_module_dir(): + root_dir = os.environ['PM_PACKAGES_ROOT'] + common_dir = '4.0-rc3-common' + module_dir = os.path.join(root_dir, 'packman', common_dir) + return module_dir + + +sys.path.insert(0, get_packman_module_dir()) +from packman import pack +from packman import push +from packager import get_package_filename +from packager import create_package_from_file_list diff --git a/buildtools/packman/source.conf b/buildtools/packman/source.conf deleted file mode 100644 index c4bf846..0000000 --- a/buildtools/packman/source.conf +++ /dev/null @@ -1 +0,0 @@ -s3 diff --git a/buildtools/packman/windows/configure/configure.bat b/buildtools/packman/win-bootstrap/configure.bat index 3ec2002..8f3d7b8 100644 --- a/buildtools/packman/windows/configure/configure.bat +++ b/buildtools/packman/win-bootstrap/configure.bat @@ -1,8 +1,7 @@ -@set PM_PACKMAN_VERSION=3.7 +@set PM_PACKMAN_VERSION=4.0-rc3 -:: Read PM_PACKAGE_SOURCE from file -@set /p PM_PACKAGE_SOURCE=<"%~dp0\..\..\source.conf" -@echo PM_PACKAGE_SOURCE: %PM_PACKAGE_SOURCE% +:: Specify where config file could exist +@set PM_CONFIG_PATH=%~dp0..\packman_config.txt :: The external root may already be configured and we should do minimal work in that case @if defined PM_PACKAGES_ROOT goto ENSURE_DIR @@ -11,7 +10,7 @@ :: running from @set PM_DRIVE=%CD:~0,2% -@set PM_PACKAGES_ROOT=%PM_DRIVE%\NVIDIA\packman-repo +@set PM_PACKAGES_ROOT=%PM_DRIVE%\packman-repo :: We use *setx* here so that the variable is persisted in the user environment @echo Setting user environment variable PM_PACKAGES_ROOT to %PM_PACKAGES_ROOT% @@ -46,12 +45,11 @@ @set [email protected] @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 -@set PM_PYTHON_GUID=4AB33777-0B8F-418A-ACEC-E673D09F164C -@call "%~dp0fetch_file.cmd" %PM_PACKAGE_SOURCE% %PM_PYTHON_PACKAGE% %PM_PYTHON_GUID% %TARGET% +@call "%~dp0fetch_file.cmd" s3 %PM_PYTHON_PACKAGE% UNUSED_BOGUS_GUID %TARGET% @if errorlevel 1 goto ERROR @echo Unpacking ... -@%TARGET% -o"%PM_PYTHON_DIR%" -y +@%TARGET% -o"%PM_PYTHON_DIR%" -y 1> nul @if errorlevel 1 goto ERROR @del %TARGET% @@ -71,8 +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% -@set PM_COMMON_GUID=24ED6205-CFE6-4A64-A4B3-4BD87B64279F -@call "%~dp0fetch_file.cmd" %PM_PACKAGE_SOURCE% %PM_MODULE_PACKAGE% %PM_COMMON_GUID% %TARGET% +@call "%~dp0fetch_file.cmd" s3 %PM_MODULE_PACKAGE% UNUSED_BOGUS_GUID %TARGET% @if errorlevel 1 goto ERROR @echo Unpacking ... diff --git a/buildtools/packman/windows/configure/fetch_file.cmd b/buildtools/packman/win-bootstrap/fetch_file.cmd index 298b6a0..298b6a0 100644 --- a/buildtools/packman/windows/configure/fetch_file.cmd +++ b/buildtools/packman/win-bootstrap/fetch_file.cmd diff --git a/buildtools/packman/windows/configure/fetch_file_from_s3.ps1 b/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1 index e424058..e424058 100644 --- a/buildtools/packman/windows/configure/fetch_file_from_s3.ps1 +++ b/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1 diff --git a/buildtools/packman/windows/configure/fetch_file_from_gtl.ps1 b/buildtools/packman/win-bootstrap/fetch_file_from_url.ps1 index d4ae86b..5b566f1 100644 --- a/buildtools/packman/windows/configure/fetch_file_from_gtl.ps1 +++ b/buildtools/packman/win-bootstrap/fetch_file_from_url.ps1 @@ -1,20 +1,14 @@ param( -[Parameter(Mandatory=$true)][string]$sourceGUID=$null, -[string]$output="out.exe" +[Parameter(Mandatory=$true)][string]$sourceUrl=$null, +[Parameter(Mandatory=$true)][string]$output=$null ) -$source = "http://nvgtl/download/" + $sourceGUID +$source = $sourceUrl $filename = $output -$key64 = 'QHV0ME1AdDNHVEwkY3IxcHQk' -$key = [System.Text.Encoding]::GetEncoding(1252).GetString([Convert]::FromBase64String($key64)) -$key = $key | ConvertTo-SecureString -asPlainText -Force -$credential = New-Object System.Management.Automation.PSCredential('svcgtlautomate', $key) -$cache = New-Object System.Net.CredentialCache -$cache.Add( "http://sso.nvidia.com", "NTLM", $credential) $req = [System.Net.httpwebrequest]::Create($source) $req.cookiecontainer = New-Object System.net.CookieContainer -$req.Credentials = $cache -Write-Host "Connecting to NVGTL ..." + +Write-Host "Connecting to $source ..." $res = $req.GetResponse() if($res.StatusCode -eq "OK") { diff --git a/buildtools/packman/windows/configure/generate_temp_file_name.ps1 b/buildtools/packman/win-bootstrap/generate_temp_file_name.ps1 index cefbda4..cefbda4 100644 --- a/buildtools/packman/windows/configure/generate_temp_file_name.ps1 +++ b/buildtools/packman/win-bootstrap/generate_temp_file_name.ps1 diff --git a/buildtools/packman/windows/configure/install_package.py b/buildtools/packman/win-bootstrap/install_package.py index 730962a..730962a 100644 --- a/buildtools/packman/windows/configure/install_package.py +++ b/buildtools/packman/win-bootstrap/install_package.py diff --git a/buildtools/packman/windows/configure/fetch_file_from_s3_with_auth.ps1 b/buildtools/packman/windows/configure/fetch_file_from_s3_with_auth.ps1 deleted file mode 100644 index 4251624..0000000 --- a/buildtools/packman/windows/configure/fetch_file_from_s3_with_auth.ps1 +++ /dev/null @@ -1,55 +0,0 @@ -param( -[Parameter(Mandatory=$true)][string]$sourceName=$null, -[string]$output=$sourceName -) -$bucket = "packman" -# use packman-ro user (can only read known files, cannot discover) -$aws_key_id = "AKIAJHPSPBMWMTZS6TJA" -$aws_secret_key = "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" - -$verb = "GET" -$date = (Get-Date).ToUniversalTime() -$httpDate = $date.ToString("r") -$bucket_and_file = "/" + $bucket + "/" + $sourceName -$stringToSign = $verb + "`n`n`n" + $httpDate + "`n" + $bucket_and_file - -$hmac = New-Object System.Security.Cryptography.HMACSHA1 -$hmac.Key = [Text.Encoding]::ASCII.GetBytes($aws_secret_key) -$signatureHMACSHA1 = $hmac.ComputeHash([Text.Encoding]::ASCII.GetBytes($stringToSign)) -$signatureHMACSHA1Base64 = [Convert]::ToBase64String($signatureHMACSHA1) - -$authorizationValue = "AWS " + $aws_key_id + ":" + $signatureHMACSHA1Base64 -$source = "http://" + $bucket + ".s3.amazonaws.com/" + $sourceName -$filename = $output - -$req = [System.Net.httpwebrequest]::Create($source) -$req.cookiecontainer = New-Object System.net.CookieContainer -#$req.date = $date -$req.Headers.Add("Authorization", $authorizationValue) -Write-Host "Connecting to S3 ..." -$res = $req.GetResponse() - -if($res.StatusCode -eq "OK") { - Write-Host "Initiating download ..." - [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) - - $reader.Close() - $writer.Flush() - $writer.Close() -} - |