diff options
| author | Bryan Galdrikian <[email protected]> | 2017-02-24 09:32:20 -0800 |
|---|---|---|
| committer | Bryan Galdrikian <[email protected]> | 2017-02-24 09:32:20 -0800 |
| commit | e1bf674c16e3c8472b29574159c789cd3f0c64e0 (patch) | |
| tree | 9f0cfce09c71a2c27ff19589fcad6cd83504477c /buildtools | |
| parent | first commit (diff) | |
| download | blast-e1bf674c16e3c8472b29574159c789cd3f0c64e0.tar.xz blast-e1bf674c16e3c8472b29574159c789cd3f0c64e0.zip | |
Updating to [email protected] and [email protected] with a new directory structure.
NvBlast folder is gone, files have been moved to top level directory. README is changed to reflect this.
Diffstat (limited to 'buildtools')
| -rw-r--r-- | buildtools/cmake_projects_vc12win32.bat | 47 | ||||
| -rw-r--r-- | buildtools/cmake_projects_vc12win64.bat | 47 | ||||
| -rw-r--r-- | buildtools/cmake_projects_vc14win32.bat | 47 | ||||
| -rw-r--r-- | buildtools/cmake_projects_vc14win64.bat | 47 | ||||
| -rw-r--r-- | buildtools/cmake_projects_windows_tests.bat | 84 | ||||
| -rw-r--r-- | buildtools/cmake_projects_windows_tools.bat | 84 | ||||
| -rw-r--r-- | buildtools/packman/source.conf | 1 | ||||
| -rw-r--r-- | buildtools/packman/windows/configure/configure.bat | 107 | ||||
| -rw-r--r-- | buildtools/packman/windows/configure/fetch_file.cmd | 23 | ||||
| -rw-r--r-- | buildtools/packman/windows/configure/fetch_file_from_gtl.ps1 | 43 | ||||
| -rw-r--r-- | buildtools/packman/windows/configure/fetch_file_from_s3.ps1 | 37 | ||||
| -rw-r--r-- | buildtools/packman/windows/configure/fetch_file_from_s3_with_auth.ps1 | 55 | ||||
| -rw-r--r-- | buildtools/packman/windows/configure/generate_temp_file_name.ps1 | 2 | ||||
| -rw-r--r-- | buildtools/packman/windows/configure/install_package.py | 39 | ||||
| -rw-r--r-- | buildtools/packman/windows/packman.cmd | 23 |
15 files changed, 686 insertions, 0 deletions
diff --git a/buildtools/cmake_projects_vc12win32.bat b/buildtools/cmake_projects_vc12win32.bat new file mode 100644 index 0000000..8607ca8 --- /dev/null +++ b/buildtools/cmake_projects_vc12win32.bat @@ -0,0 +1,47 @@ +@echo off + +echo ############################################################################################# +echo Starting %~n0 %date% %time% +echo ############################################################################################# + +echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% + +if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 + +IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED + +REM Now set up the CMake command from PM_PACKAGES_ROOT + +SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe + +echo "Cmake: %CMAKECMD%" + + +REM Generate projects here + +echo. +echo ############################################################################################# +ECHO "Creating VS2013 Win32" + +SET CMAKE_OUTPUT_DIR=compiler\vc12win32-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR% -G "Visual Studio 12 2013" -AWin32 -DTARGET_BUILD_PLATFORM=Windows -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc12win32-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win32-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win32-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + + +GOTO :End + +:PM_PACKAGES_ROOT_UNDEFINED +ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. +PAUSE +GOTO END + +:DONT_RUN_STEP_2 +ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead +PAUSE +GOTO END + +:End diff --git a/buildtools/cmake_projects_vc12win64.bat b/buildtools/cmake_projects_vc12win64.bat new file mode 100644 index 0000000..6b910d3 --- /dev/null +++ b/buildtools/cmake_projects_vc12win64.bat @@ -0,0 +1,47 @@ +@echo off + +echo ############################################################################################# +echo Starting %~n0 %date% %time% +echo ############################################################################################# + +echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% + +if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 + +IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED + +REM Now set up the CMake command from PM_PACKAGES_ROOT + +SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe + +echo "Cmake: %CMAKECMD%" + + +REM Generate projects here + +echo. +echo ############################################################################################# +ECHO "Creating VS2013 Win64" + +SET CMAKE_OUTPUT_DIR=compiler\vc12win64-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR% -G "Visual Studio 12 2013" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc12win64-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win64-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win64-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + + +GOTO :End + +:PM_PACKAGES_ROOT_UNDEFINED +ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. +PAUSE +GOTO END + +:DONT_RUN_STEP_2 +ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead +PAUSE +GOTO END + +:End diff --git a/buildtools/cmake_projects_vc14win32.bat b/buildtools/cmake_projects_vc14win32.bat new file mode 100644 index 0000000..099292a --- /dev/null +++ b/buildtools/cmake_projects_vc14win32.bat @@ -0,0 +1,47 @@ +@echo off + +echo ############################################################################################# +echo Starting %~n0 %date% %time% +echo ############################################################################################# + +echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% + +if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 + +IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED + +REM Now set up the CMake command from PM_PACKAGES_ROOT + +SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe + +echo "Cmake: %CMAKECMD%" + + +REM Generate projects here + +echo. +echo ############################################################################################# +ECHO "Creating VS2015 Win32" + +SET CMAKE_OUTPUT_DIR=compiler\vc14win32-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR% -G "Visual Studio 14 2015" -AWin32 -DTARGET_BUILD_PLATFORM=Windows -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc14win32-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win32-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win32-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + + +GOTO :End + +:PM_PACKAGES_ROOT_UNDEFINED +ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. +PAUSE +GOTO END + +:DONT_RUN_STEP_2 +ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead +PAUSE +GOTO END + +:End diff --git a/buildtools/cmake_projects_vc14win64.bat b/buildtools/cmake_projects_vc14win64.bat new file mode 100644 index 0000000..d918f56 --- /dev/null +++ b/buildtools/cmake_projects_vc14win64.bat @@ -0,0 +1,47 @@ +@echo off + +echo ############################################################################################# +echo Starting %~n0 %date% %time% +echo ############################################################################################# + +echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% + +if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 + +IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED + +REM Now set up the CMake command from PM_PACKAGES_ROOT + +SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe + +echo "Cmake: %CMAKECMD%" + + +REM Generate projects here + +echo. +echo ############################################################################################# +ECHO "Creating VS2015 Win64" + +SET CMAKE_OUTPUT_DIR=compiler\vc14win64-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR% -G "Visual Studio 14 2015" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc14win64-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win64-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win64-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + + +GOTO :End + +:PM_PACKAGES_ROOT_UNDEFINED +ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. +PAUSE +GOTO END + +:DONT_RUN_STEP_2 +ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead +PAUSE +GOTO END + +:End diff --git a/buildtools/cmake_projects_windows_tests.bat b/buildtools/cmake_projects_windows_tests.bat new file mode 100644 index 0000000..8a96b54 --- /dev/null +++ b/buildtools/cmake_projects_windows_tests.bat @@ -0,0 +1,84 @@ +@echo off + +echo ############################################################################################# +echo Starting %~n0 %date% %time% +echo ############################################################################################# + +echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% + +if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 + +IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED + +REM Now set up the CMake command from PM_PACKAGES_ROOT + +SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe + +echo "Cmake: %CMAKECMD%" + + +REM Generate projects here + +echo. +echo ############################################################################################# +ECHO "Creating VS2015 Win64 TESTS" + +SET CMAKE_OUTPUT_DIR=test\compiler\vc14win64-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR%\test -G "Visual Studio 14 2015" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DSTATIC_WINCRT=1 -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc14win64-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win64-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win64-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + + +echo. +echo ############################################################################################# +ECHO "Creating VS2015 Win32 TESTS" + +SET CMAKE_OUTPUT_DIR=test\compiler\vc14win32-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR%\test -G "Visual Studio 14 2015" -AWin32 -DTARGET_BUILD_PLATFORM=Windows -DSTATIC_WINCRT=1 -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc14win32-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win32-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win32-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + +echo. +echo ############################################################################################# +ECHO "Creating VS2013 Win32 TESTS" + +SET CMAKE_OUTPUT_DIR=test\compiler\vc12win32-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR%\test -G "Visual Studio 12 2013" -AWin32 -DTARGET_BUILD_PLATFORM=Windows -DSTATIC_WINCRT=1 -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc12win32-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win32-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win32-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + +echo. +echo ############################################################################################# +ECHO "Creating VS2013 Win64 TESTS" + +SET CMAKE_OUTPUT_DIR=test\compiler\vc12win64-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR%\test -G "Visual Studio 12 2013" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DSTATIC_WINCRT=1 -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc12win64-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win64-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win64-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + + +GOTO :End + +:PM_PACKAGES_ROOT_UNDEFINED +ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. +PAUSE +GOTO END + +:DONT_RUN_STEP_2 +ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead +PAUSE +GOTO END + +:End diff --git a/buildtools/cmake_projects_windows_tools.bat b/buildtools/cmake_projects_windows_tools.bat new file mode 100644 index 0000000..d1699f7 --- /dev/null +++ b/buildtools/cmake_projects_windows_tools.bat @@ -0,0 +1,84 @@ +@echo off + +echo ############################################################################################# +echo Starting %~n0 %date% %time% +echo ############################################################################################# + +echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% + +if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 + +IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED + +REM Now set up the CMake command from PM_PACKAGES_ROOT + +SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe + +echo "Cmake: %CMAKECMD%" + +REM Generate projects here + + +REM Now generate tools solutions + +echo. +echo ############################################################################################# +ECHO "Creating VS2013 Win32 TOOLS" + +SET CMAKE_OUTPUT_DIR=tools\compiler\vc12win32-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR%\tools -G "Visual Studio 12 2013" -AWin32 -DTARGET_BUILD_PLATFORM=Windows -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc12win32-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win32-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win32-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + +echo. +echo ############################################################################################# +ECHO "Creating VS2013 Win64 TOOLS" + +SET CMAKE_OUTPUT_DIR=tools\compiler\vc12win64-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR%\tools -G "Visual Studio 12 2013" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc12win64-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win64-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc12win64-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + +echo. +echo ############################################################################################# +ECHO "Creating VS2015 Win32 TOOLS" + +SET CMAKE_OUTPUT_DIR=tools\compiler\vc14win32-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR%\tools -G "Visual Studio 14 2015" -AWin32 -DTARGET_BUILD_PLATFORM=Windows -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc14win32-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win32-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win32-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + +echo. +echo ############################################################################################# +ECHO "Creating VS2015 Win64 TOOLS" + +SET CMAKE_OUTPUT_DIR=tools\compiler\vc14win64-cmake\ +IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% +mkdir %CMAKE_OUTPUT_DIR% +pushd %CMAKE_OUTPUT_DIR% +%CMAKECMD% %BLAST_ROOT_DIR%\tools -G "Visual Studio 14 2015" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DBL_LIB_OUTPUT_DIR=%BLAST_ROOT_DIR%\lib\vc14win64-cmake\ -DBL_DLL_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win64-cmake\ -DBL_EXE_OUTPUT_DIR=%BLAST_ROOT_DIR%\bin\vc14win64-cmake\ +popd +if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% + +GOTO :End + +:PM_PACKAGES_ROOT_UNDEFINED +ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. +PAUSE +GOTO END + +:DONT_RUN_STEP_2 +ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead +PAUSE +GOTO END + +:End diff --git a/buildtools/packman/source.conf b/buildtools/packman/source.conf new file mode 100644 index 0000000..c4bf846 --- /dev/null +++ b/buildtools/packman/source.conf @@ -0,0 +1 @@ +s3 diff --git a/buildtools/packman/windows/configure/configure.bat b/buildtools/packman/windows/configure/configure.bat new file mode 100644 index 0000000..3ec2002 --- /dev/null +++ b/buildtools/packman/windows/configure/configure.bat @@ -0,0 +1,107 @@ +@set PM_PACKMAN_VERSION=3.7 + +:: Read PM_PACKAGE_SOURCE from file +@set /p PM_PACKAGE_SOURCE=<"%~dp0\..\..\source.conf" +@echo PM_PACKAGE_SOURCE: %PM_PACKAGE_SOURCE% + +:: The external root may already be configured and we should do minimal work in that case +@if defined PM_PACKAGES_ROOT goto ENSURE_DIR + +:: If the folder isn't set we assume that the best place for it is on the drive that we are currently +:: running from +@set PM_DRIVE=%CD:~0,2% + +@set PM_PACKAGES_ROOT=%PM_DRIVE%\NVIDIA\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% +@setx PM_PACKAGES_ROOT %PM_PACKAGES_ROOT% +@if errorlevel 1 goto ERROR + +:: The above doesn't work properly from a build step in VisualStudio because a separate process is +:: spawned for it so it will be lost for subsequent compilation steps - VisualStudio must +:: be launched from a new process. We catch this odd-ball case here: +@if defined VSLANG goto ERROR_IN_VS_WITH_NO_ROOT_DEFINED + +:: Check for the directory that we need. Note that mkdir will create any directories +:: that may be needed in the path +:ENSURE_DIR +@if not exist "%PM_PACKAGES_ROOT%" ( + @echo Creating directory %PM_PACKAGES_ROOT% + @mkdir "%PM_PACKAGES_ROOT%" + @if errorlevel 1 goto ERROR_MKDIR_PACKAGES_ROOT +) + +:: The Python interpreter may already be externally configured +@if defined PM_PYTHON_EXT ( + @set PM_PYTHON=%PM_PYTHON_EXT% + @goto PACKMAN +) + +@set PM_PYTHON_DIR=%PM_PACKAGES_ROOT%\python\2.7.6-windows-x86 +@set PM_PYTHON=%PM_PYTHON_DIR%\python.exe + +@if exist "%PM_PYTHON%" goto PACKMAN + +@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% +@if errorlevel 1 goto ERROR + +@echo Unpacking ... +@%TARGET% -o"%PM_PYTHON_DIR%" -y +@if errorlevel 1 goto ERROR + +@del %TARGET% + +:PACKMAN +:: The packman module may already be externally configured +@if defined PM_MODULE_EXT ( + @set PM_MODULE=%PM_MODULE_EXT% + @goto END +) + +@set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman\%PM_PACKMAN_VERSION%-common +@set PM_MODULE=%PM_MODULE_DIR%\packman.py + +@if exist "%PM_MODULE%" goto END + +@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% +@if errorlevel 1 goto ERROR + +@echo Unpacking ... +@"%PM_PYTHON%" "%~dp0\install_package.py" %TARGET% "%PM_MODULE_DIR%" +@if errorlevel 1 goto ERROR + +@del %TARGET% + +@goto END + +:ERROR_IN_VS_WITH_NO_ROOT_DEFINED +@echo The above is a once-per-computer operation. Unfortunately VisualStudio cannot pick up environment change +@echo unless *VisualStudio is RELAUNCHED*. +@echo NOTE: If you are launching VisualStudio from command line or command line utility make sure +@echo you have a fresh environment (relaunch the command line or utility). +@echo. +@exit /B 1 + +:ERROR_MKDIR_PACKAGES_ROOT +@echo Failed to automatically create packman packages repo at %PM_PACKAGES_ROOT%. +@echo Please set a location explicitly that packman has permission to write to, by issuing: +@echo. +@echo setx PM_PACKAGES_ROOT {path-you-choose-for-storing-packman-packages-locally} +@echo. +@echo Then launch a new command console for the changes to take effect and run packman command again. +@exit /B 1 + +:ERROR +@echo !!! Failure while configuring local machine :( !!! +@exit /B 1 + +:END diff --git a/buildtools/packman/windows/configure/fetch_file.cmd b/buildtools/packman/windows/configure/fetch_file.cmd new file mode 100644 index 0000000..298b6a0 --- /dev/null +++ b/buildtools/packman/windows/configure/fetch_file.cmd @@ -0,0 +1,23 @@ +:: You need to specify <package-source> <package-name> <package-guid> <target-name> as input to this command + +@set PACKAGE_NAME=%2 +@set PACKAGE_GUID=%3 +@set TARGET=%4 + +@echo Fetching %PACKAGE_NAME% from %1 ... + +@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% +:: 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 + +@exit /b 0 + +:ERROR_DOWNLOAD_FAILED +@echo Failed to download file from %1 +@echo Most likely because endpoint cannot be reached (VPN connection down?) +@exit /b 1
\ No newline at end of file diff --git a/buildtools/packman/windows/configure/fetch_file_from_gtl.ps1 b/buildtools/packman/windows/configure/fetch_file_from_gtl.ps1 new file mode 100644 index 0000000..d4ae86b --- /dev/null +++ b/buildtools/packman/windows/configure/fetch_file_from_gtl.ps1 @@ -0,0 +1,43 @@ +param( +[Parameter(Mandatory=$true)][string]$sourceGUID=$null, +[string]$output="out.exe" +) +$source = "http://nvgtl/download/" + $sourceGUID +$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 ..." +$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) + + $reader.Close() + $writer.Flush() + $writer.Close() +} + diff --git a/buildtools/packman/windows/configure/fetch_file_from_s3.ps1 b/buildtools/packman/windows/configure/fetch_file_from_s3.ps1 new file mode 100644 index 0000000..e424058 --- /dev/null +++ b/buildtools/packman/windows/configure/fetch_file_from_s3.ps1 @@ -0,0 +1,37 @@ +param( +[Parameter(Mandatory=$true)][string]$sourceName=$null, +[string]$output="out.exe" +) +$source = "http://packman.s3.amazonaws.com/" + $sourceName +$filename = $output + +$req = [System.Net.httpwebrequest]::Create($source) +$req.cookiecontainer = New-Object System.net.CookieContainer + +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) + + $reader.Close() + $writer.Flush() + $writer.Close() +} + 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 new file mode 100644 index 0000000..4251624 --- /dev/null +++ b/buildtools/packman/windows/configure/fetch_file_from_s3_with_auth.ps1 @@ -0,0 +1,55 @@ +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() +} + diff --git a/buildtools/packman/windows/configure/generate_temp_file_name.ps1 b/buildtools/packman/windows/configure/generate_temp_file_name.ps1 new file mode 100644 index 0000000..cefbda4 --- /dev/null +++ b/buildtools/packman/windows/configure/generate_temp_file_name.ps1 @@ -0,0 +1,2 @@ +$out = [System.IO.Path]::GetTempFileName() +Write-Host $out
\ No newline at end of file diff --git a/buildtools/packman/windows/configure/install_package.py b/buildtools/packman/windows/configure/install_package.py new file mode 100644 index 0000000..730962a --- /dev/null +++ b/buildtools/packman/windows/configure/install_package.py @@ -0,0 +1,39 @@ +import logging +import zipfile +import tempfile +import sys +import shutil + +__author__ = 'hfannar' +logging.basicConfig(level=logging.WARNING, format="%(message)s") +logger = logging.getLogger('install_package') + + +class TemporaryDirectory: + def __init__(self): + self.path = None + + def __enter__(self): + self.path = tempfile.mkdtemp() + return self.path + + def __exit__(self, type, value, traceback ): + # Remove temporary data created + shutil.rmtree(self.path) + + +def install_package(package_src_path, package_dst_path): + with zipfile.ZipFile(package_src_path, allowZip64=True) as zip_file, TemporaryDirectory() as temp_dir: + zip_file.extractall(temp_dir) + # Recursively copy (temp_dir will be automatically cleaned up on exit) + try: + # Recursive copy is needed because both package name and version folder could be missing in + # target directory: + shutil.copytree(temp_dir, package_dst_path) + except OSError, exc: + logger.warning("Directory %s already present, packaged installation aborted" % package_dst_path) + else: + logger.info("Package successfully installed to %s" % package_dst_path) + + +install_package(sys.argv[1], sys.argv[2])
\ No newline at end of file diff --git a/buildtools/packman/windows/packman.cmd b/buildtools/packman/windows/packman.cmd new file mode 100644 index 0000000..f9678aa --- /dev/null +++ b/buildtools/packman/windows/packman.cmd @@ -0,0 +1,23 @@ +:: 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" +@if errorlevel 1 exit /b 1 +:: Everything below is mandatory +@if not defined PM_PYTHON goto :PYTHON_ENV_ERROR +@if not defined PM_MODULE goto :MODULE_ENV_ERROR + +@"%PM_PYTHON%" "%PM_MODULE%" %* +@goto :eof + +:: Subroutines below +:PYTHON_ENV_ERROR +@echo User environment variable PM_PYTHON is not set! Please configure machine for packman or call configure.bat. +@exit /b 1 + +:MODULE_ENV_ERROR +@echo User environment variable PM_MODULE is not set! Please configure machine for packman or call configure.bat. +@exit /b 1 + +:RESET_ERROR +@exit /b 0
\ No newline at end of file |