diff --git a/ci/docker/chocolatey_package/Dockerfile b/ci/docker/chocolatey_package/Dockerfile deleted file mode 100644 index 0f335715e..000000000 --- a/ci/docker/chocolatey_package/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -# escape=` -FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 -#FROM mcr.microsoft.com/windows/servercore:ltsc2019 as choco_builder -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] - -ADD ci/docker/shared/chocolatey/install_choco.ps1 choco/install_choco.ps1 -ARG CHOCOLATEY_SOURCE=https://chocolatey.org/api/v2 -ARG ChocolateyEnvironmentDebug=false -RUN Set-ExecutionPolicy Bypass -Scope Process -Force; ` - ./choco/install_choco.ps1 ; ` - if( -not ([string]::IsNullOrEmpty($Env:CHOCOLATEY_SOURCE ))) ` - { ` - Write-Host "Adding $env:CHOCOLATEY_SOURCE to chocolatey sources" ; ` - choco source add -n=CHOCOLATEY_SOURCE --priority=1 -s=\"$env:CHOCOLATEY_SOURCE\" ; ` - } - -COPY ci/docker/chocolatey_package/choco_package_template/pythonscript/ C:/ProgramData/chocolatey/templates/pythonscript/ -#=============================== diff --git a/ci/docker/chocolatey_package/choco_package_template/pythonscript/pythonscript.nuspec b/ci/docker/chocolatey_package/choco_package_template/pythonscript/pythonscript.nuspec deleted file mode 100644 index 90da94a4d..000000000 --- a/ci/docker/chocolatey_package/choco_package_template/pythonscript/pythonscript.nuspec +++ /dev/null @@ -1,30 +0,0 @@ - - - - [[PackageNameLower]] - [[PackageName]] - [[PackageVersion]] - University Library at The University of Illinois at Urbana Champaign: Preservation Services, [[MaintainerName]] - [[MaintainerName]] - [[PythonSummary]] - https://github.com/UIUCLibrary/Speedwagon/tree/master/ci/docker/chocolatey_package/choco_package_template/pythonscript - https://raw.githubusercontent.com/UIUCLibrary/Speedwagon/master/LICENSE - https://raw.githubusercontent.com/UIUCLibrary/Speedwagon/master/speedwagon/logo.png - https://github.com/UIUCLibrary/Speedwagon - https://github.com/UIUCLibrary/Speedwagon - https://www.library.illinois.edu/dccdocs/speedwagon/ - false - [[PackageNameLower]] UIUC - - - - - - - - - - - - - diff --git a/ci/docker/chocolatey_package/choco_package_template/pythonscript/tools/chocolateyInstall.ps1 b/ci/docker/chocolatey_package/choco_package_template/pythonscript/tools/chocolateyInstall.ps1 deleted file mode 100644 index 99991955d..000000000 --- a/ci/docker/chocolatey_package/choco_package_template/pythonscript/tools/chocolateyInstall.ps1 +++ /dev/null @@ -1,53 +0,0 @@ - - -# Custom value: [[CustomValue]] -$ErrorActionPreference = 'Stop'; # stop on all errors - -[[AutomaticPackageNotesInstaller]] -$packageName = '[[PackageName]]' -$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" -$installDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" -$venvDir = "$installDir\venv" -$requirements = "$toolsDir\dist\requirements.txt" - -$fileLocation = Join-Path $toolsDir '[[InstallerFile]]' -$dependenciesLocation = Join-Path $toolsDir dist\deps -$requirementsLocation = Join-Path $toolsDir dist\requirements -$packageSourceUrl = '[[PackageSourceUrl]]' -#$PYTHON = "C:\Windows\py.exe -3.11" -$requirementSpecifier = "$($fileLocation)`[QT`]" -If(test-path -PathType container $venvDir){ - Write-Host "Removing existing Python virtual environment" - Remove-Tree $venvDir -} - -Write-Host "Creating Python virtualenv at $venvDir" -& "C:\Windows\py.exe" -3.11 -m venv $venvDir --upgrade-deps - -Write-Host "Installing Speedwagon" -If(test-path -PathType container $dependenciesLocation){ -& "$venvDir\Scripts\python.exe" -m pip install --no-deps --no-cache-dir --find-link $dependenciesLocation $requirementSpecifier -r $requirements -} Else { -& "$venvDir\Scripts\python.exe" -m pip install --no-deps --no-cache-dir $requirementSpecifier -r $requirements - -} - -$files = get-childitem $installDir -include *.exe -recurse -foreach ($file in $files) { - #generate an ignore file - New-Item "$file.ignore" -type file -force | Out-Null -} -Install-ChocolateyShortcut ` - -ShortcutFilePath "$Env:ProgramData\Microsoft\Windows\Start Menu\Programs\$packageName\$packageName.lnk" ` - -TargetPath "$installDir\venv\Scripts\$packageName.exe" ` - -WorkingDirectory "C:\" ` - -IconLocation "$installDir\venv\Lib\site-packages\speedwagon\favicon.ico" ` - -Description "Collection of tools and workflows for DS" - -Install-ChocolateyShortcut ` - -ShortcutFilePath "$Env:ProgramData\Microsoft\Windows\Start Menu\Programs\$packageName\Manual.lnk" ` - -TargetPath "$installDir\documentation\$packageName.pdf" ` - -WorkingDirectory "C:\" ` - -Description "Speedwagon Manual" - -Install-BinFile -Name $packageName -Path "$installDir\venv\Scripts\$packageName.exe" diff --git a/ci/docker/chocolatey_package/choco_package_template/pythonscript/tools/chocolateyuninstall.ps1 b/ci/docker/chocolatey_package/choco_package_template/pythonscript/tools/chocolateyuninstall.ps1 deleted file mode 100644 index 97e23e510..000000000 --- a/ci/docker/chocolatey_package/choco_package_template/pythonscript/tools/chocolateyuninstall.ps1 +++ /dev/null @@ -1,86 +0,0 @@ -# IMPORTANT: Before releasing this package, copy/paste the next 2 lines into PowerShell to remove all comments from this file: -# $f='c:\path\to\thisFile.ps1' -# gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f - -## NOTE: In 80-90% of the cases (95% with licensed versions due to Package Synchronizer and other enhancements), -## AutoUninstaller should be able to detect and handle registry uninstalls without a chocolateyUninstall.ps1. -## See https://chocolatey.org/docs/commands-uninstall -## and https://chocolatey.org/docs/helpers-uninstall-chocolatey-package - -## If this is an MSI, ensure 'softwareName' is appropriate, then clean up comments and you are done. -## If this is an exe, change fileType, silentArgs, and validExitCodes - -$ErrorActionPreference = 'Stop'; # stop on all errors -$packageArgs = @{ - packageName = $env:ChocolateyPackageName - softwareName = 'speedwagon*' #part or all of the Display Name as you see it in Programs and Features. It should be enough to be unique - fileType = 'msi' #only one of these: MSI or EXE (ignore MSU for now) - # MSI - silentArgs = "/qn /norestart" - validExitCodes= @(0, 3010, 1605, 1614, 1641) # https://msdn.microsoft.com/en-us/library/aa376931(v=vs.85).aspx - # OTHERS - # Uncomment matching EXE type (sorted by most to least common) - #silentArgs = '/S' # NSIS - #silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' # Inno Setup - #silentArgs = '/s' # InstallShield - #silentArgs = '/s /v"/qn"' # InstallShield with MSI - #silentArgs = '/s' # Wise InstallMaster - #silentArgs = '-s' # Squirrel - #silentArgs = '-q' # Install4j - #silentArgs = '-s -u' # Ghost - # Note that some installers, in addition to the silentArgs above, may also need assistance of AHK to achieve silence. - #silentArgs = '' # none; make silent with input macro script like AutoHotKey (AHK) - # https://chocolatey.org/packages/autohotkey.portable - #validExitCodes= @(0) #please insert other valid exit codes here -} - -$uninstalled = $false -# Get-UninstallRegistryKey is new to 0.9.10, if supporting 0.9.9.x and below, -# take a dependency on "chocolatey-core.extension" in your nuspec file. -# This is only a fuzzy search if $softwareName includes '*'. Otherwise it is -# exact. In the case of versions in key names, we recommend removing the version -# and using '*'. -[array]$key = Get-UninstallRegistryKey -SoftwareName $packageArgs['softwareName'] - -if ($key.Count -eq 1) { - $key | % { - $packageArgs['file'] = "$($_.UninstallString)" #NOTE: You may need to split this if it contains spaces, see below - - if ($packageArgs['fileType'] -eq 'MSI') { - # The Product Code GUID is all that should be passed for MSI, and very - # FIRST, because it comes directly after /x, which is already set in the - # Uninstall-ChocolateyPackage msiargs (facepalm). - $packageArgs['silentArgs'] = "$($_.PSChildName) $($packageArgs['silentArgs'])" - - # Don't pass anything for file, it is ignored for msi (facepalm number 2) - # Alternatively if you need to pass a path to an msi, determine that and - # use it instead of the above in silentArgs, still very first - $packageArgs['file'] = '' - } else { - # NOTES: - # - You probably will need to sanitize $packageArgs['file'] as it comes from the registry and could be in a variety of fun but unusable formats - # - Split args from exe in $packageArgs['file'] and pass those args through $packageArgs['silentArgs'] or ignore them - # - Ensure you don't pass double quotes in $file (aka $packageArgs['file']) - otherwise you will get "Illegal characters in path when you attempt to run this" - # - Review the code for auto-uninstaller for all of the fun things it does in sanitizing - https://github.com/chocolatey/choco/blob/bfe351b7d10c798014efe4bfbb100b171db25099/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs#L142-L192 - } - - Uninstall-ChocolateyPackage @packageArgs - - } -} elseif ($key.Count -eq 0) { - Write-Warning "$packageName has already been uninstalled by other means." -} elseif ($key.Count -gt 1) { - Write-Warning "$($key.Count) matches found!" - Write-Warning "To prevent accidental data loss, no programs will be uninstalled." - Write-Warning "Please alert package maintainer the following keys were matched:" - $key | % {Write-Warning "- $($_.DisplayName)"} -} - -## OTHER POWERSHELL FUNCTIONS -## https://chocolatey.org/docs/helpers-reference -#Uninstall-ChocolateyZipPackage $packageName # Only necessary if you did not unpack to package directory - see https://chocolatey.org/docs/helpers-uninstall-chocolatey-zip-package -#Uninstall-ChocolateyEnvironmentVariable # 0.9.10+ - https://chocolatey.org/docs/helpers-uninstall-chocolatey-environment-variable -#Uninstall-BinFile # Only needed if you used Install-BinFile - see https://chocolatey.org/docs/helpers-uninstall-bin-file -## Remove any shortcuts you added in the chocolateyInstall.ps1 script. -Uninstall-BinFile -Name speedwagon -Remove-Item "$Env:ProgramData\Microsoft\Windows\Start Menu\Programs\Speedwagon\speedwagon.lnk" \ No newline at end of file diff --git a/ci/docker/windows_standalone/Dockerfile b/ci/docker/windows_standalone/Dockerfile deleted file mode 100644 index 40886df9b..000000000 --- a/ci/docker/windows_standalone/Dockerfile +++ /dev/null @@ -1,120 +0,0 @@ -# escape=` -ARG FROM_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 -FROM ${FROM_IMAGE} -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] -# First install Visual Studio Build Tools -RUN Invoke-WebRequest https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile vs_buildtools.exe ;` - $VS_INSTALL_PATH = \"${Env:ProgramFiles(x86)}\" + '\Microsoft Visual Studio\2022\BuildTools' ; ` - Write-Host \"Installing Visual Studio Build Tools to ${VS_INSTALL_PATH}\" ; ` - $ARGS_LIST = @(` - '--quiet', ` - '--wait', ` - '--norestart', ` - '--nocache', ` - \"--installPath ${VS_INSTALL_PATH}\",` - '--add Microsoft.VisualStudio.Component.Windows10SDK.18362', ` - '--remove Microsoft.VisualStudio.Component.Windows10SDK.10240',` - '--remove Microsoft.VisualStudio.Component.Windows10SDK.10586', ` - '--remove Microsoft.VisualStudio.Component.Windows10SDK.14393', ` - '--remove Microsoft.VisualStudio.Component.Windows81SDK'` - ) ;` - $process = Start-Process -NoNewWindow -PassThru -FilePath vs_buildtools.exe ` - -ArgumentList $ARGS_LIST -Wait ; ` - if ( $process.ExitCode -eq 0) ` - { ` - Write-Host 'Installing Visual Studio Build Tools - Done' ; ` - } ` - else ` - { ` - Get-ChildItem c:\\ ; ` - Get-ChildItem ${Env:ProgramFiles(x86)} ; ` - Get-ChildItem ${VS_INSTALL_PATH} ; ` - Get-ChildItem ${VS_INSTALL_PATH}\\Common7\\Tools ; ` - $message = \"Installing Visual Studio Build Tools exited with code $($process.ExitCode) \"; ` - Write-Host $message ; ` - throw 'unable to continue' ; ` - } ; ` - Write-Host 'Testing for VsDevCmd.bat' ; ` - if (! (Test-Path 'c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat')) ` - { ` - Write-Host 'Testing for VsDevCmd.bat - Failed' ; ` - Start-Process -NoNewWindow -FilePath $Env:TEMP\\collect.exe -ArgumentList '-nologo -zip:${Env:TEMP}\\vslogs.zip' -Wait; ` - if (! (Test-Path '${Env:TEMP}\\vslogs.zip')) ` - { ` - throw 'VsDevCmd.bat not found and ${Env:TEMP}\\vslogs.zip never generated' ; ` - } ; ` - Expand-Archive -Path vslogs.zip -DestinationPath $Env:TEMP\\logs\\ ; ` - Get-Content -LiteralPath '$Env:TEMP\\logs\\[Content_Types].xml' ; ` - throw 'VsDevCmd.bat not found' ; ` - } ; ` - Write-Host "Testing for VsDevCmd.bat - Found" ; ` - Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Command Processor' -Name 'AutoRun' -Value "c:\startup\startup.bat" -ADD ci/docker/windows_standalone/startup.bat c:/startup/startup.bat -ARG CHOCOLATEY_SOURCE=https://chocolatey.org/api/v2 -ARG ChocolateyEnvironmentDebug=false -ADD ci/docker/windows_standalone/install_choco.ps1 choco/install_choco.ps1 -RUN Set-ExecutionPolicy Bypass -Scope Process -Force; ` - ./choco/install_choco.ps1 -packageRepo $env:CHOCOLATEY_SOURCE ; ` - choco feature enable --name="useEnhancedExitCodes" ; ` - choco feature disable --name="showDownloadProgress" ; ` - if( -not ([string]::IsNullOrEmpty($Env:CHOCOLATEY_SOURCE ))) ` - { ` - Write-Host "Adding $env:CHOCOLATEY_SOURCE to chocolatey sources" ; ` - choco source add -n=CHOCOLATEY_SOURCE --priority=1 -s=\"$env:CHOCOLATEY_SOURCE\"; ` - choco source disable -n=chocolatey ;` - }; ` - choco feature disable -n=showDownloadProgress ; ` - Remove-Item -Force -Recurse ${Env:TEMP}\* - -ADD ci/docker/windows_standalone/chocolatey/python.xml choco/python.config -RUN C:\ProgramData\chocolatey\bin\choco.exe install -y --stoponfirstfailure --no-progress --verbose choco/python.config ;` - Remove-Item C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey -Recurse ; ` - refreshenv ; ` - Remove-Item -Force -Recurse ${Env:TEMP}\* ; ` - py --list ;` - py -3.11 --version ; ` - Write-Host "Installing Python with Chocolatey - Done" - -# Install packages that can be installed by chocolatey -ADD ci/docker/windows_standalone/chocolatey/packages.config choco/packages.config - -RUN C:\ProgramData\chocolatey\bin\choco.exe sources ; ` - Write-Host "Installing packages with Chocolatey" ; ` - $process = start-process -NoNewWindow -PassThru -FilePath C:\ProgramData\chocolatey\bin\choco.exe -ArgumentList 'install -y --stoponfirstfailure --no-progress choco/packages.config' -Wait ;` - if ( $process.ExitCode -eq 0) ` - { ` - Write-Host "Installing packages with Chocolatey - Done" ; ` - } else { ` - throw 'Installing packages with Chocolatey - Failed with none zero exit code' ; ` - };` - Remove-Item C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey -Recurse ; ` - Remove-Item -Force -Recurse ${Env:TEMP}\* ; ` - if (!(Test-Path 'C:\Program Files\Git\cmd\git.exe')) ` - { ` - throw 'git.exe not found' ; ` - }; ` - Write-Host "Finished install packages with Chocolatey" - - # Install WiX toolset for making .msi installers and put the tools on the path -ARG NUGET_PACKAGE_PATH=c:/nuget_packages/ -COPY ci/docker/windows_standalone/nuget/packages.config c:\temp\packages.config -COPY ci/docker/windows_standalone/nuget/verify_installed_correctly.ps1 c:\temp\verify_installed_correctly.ps1 -RUN Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.208 -Force ;` - Register-PackageSource -Name MyNuGet -Location https://www.nuget.org/api/v2 -ProviderName NuGet ;` - nuget.exe install c:\temp\packages.config -OutputDirectory ${Env:NUGET_PACKAGE_PATH}; ` - $WIX_PATH ="$((Get-Childitem -Path ${Env:NUGET_PACKAGE_PATH} -Include wix.dll -File -Recurse)[0].DirectoryName)" ; ` - $env:Path += $WIX_PATH ; ` - [Environment]::SetEnvironmentVariable('Path', $env:Path, [EnvironmentVariableTarget]::Machine ) ;` - Write-Host "Updated path to = $env:Path";` - c:\temp\verify_installed_correctly.ps1 -ARG PIP_EXTRA_INDEX_URL -ARG PIP_INDEX_URL -ADD requirements.txt requirements-dev.txt c:\temp\ -RUN python -m pip install --no-cache-dir --upgrade pip ; ` - pip install --no-cache-dir wheel ; ` - pip install --no-cache-dir --upgrade setuptools ;` - pip install --no-cache-dir -r c:\temp\requirements-dev.txt - -ENV PIP_FIND_LINKS=c:\wheels\ -COPY ci/docker/windows_standalone/build_standalone.ps1 c:/scripts/build_standalone.ps1 -CMD c:\scripts\build_standalone.ps1 diff --git a/ci/docker/windows_standalone/build_standalone.ps1 b/ci/docker/windows_standalone/build_standalone.ps1 deleted file mode 100644 index 69f566579..000000000 --- a/ci/docker/windows_standalone/build_standalone.ps1 +++ /dev/null @@ -1,36 +0,0 @@ -$SOURCE_PATH = "c:\source" -#$PYTHON = $($(Get-Command python).source) -$WHEELS_PATH = "c:\wheels" -$PYTHON_VENV = "c:\standalone_venv" -$BUILD_PATH = "c:\build\" -$OUTPUT_PATH = "c:\dist" -Write-Host "Source: $SOURCE_PATH" -Write-Host "Cache Path: $WHEELS_PATH" -Write-Host "Build Path: $BUILD_PATH" -Write-Host "Output Path: $OUTPUT_PATH" - -if (! (Test-Path $SOURCE_PATH)){ - throw "Invalid source path. Exepcting to locate source at $SOURCE_PATH" -} - -$process = Start-Process -NoNewWindow -PassThru -Wait -FilePath cmake -ArgumentList "$SOURCE_PATH -G Ninja -B $BUILD_PATH -DSPEEDWAGON_PYTHON_DEPENDENCY_CACHE=$WHEELS_PATH -DSPEEDWAGON_VENV_PATH=$PYTHON_VENV " -if (! $process.ExitCode -eq 0) -{ - throw "CMake failed to run configure. Exit code $($process.ExitCode)" -} - -$process = Start-Process -NoNewWindow -PassThru -Wait -FilePath cmake -ArgumentList "--build $BUILD_PATH" -if (! $process.ExitCode -eq 0) -{ - throw "CMake failed to Build. Exit code $($process.ExitCode)" -} - -$process = Start-Process -WorkingDirectory "$BUILD_PATH" -NoNewWindow -PassThru -Wait -FilePath ctest -ArgumentList "-T test -C Release" -if (! $process.ExitCode -eq 0) -{ - throw "CTest failed to Build. Exit code $($process.ExitCode)" -} - -$CPACK_CONFIG = "$BUILD_PATH\CPackConfig.cmake" -Write-Host "Using $CPACK_CONFIG config to create standalone installers" -& cpack -C Release -G WIX`;NSIS`;ZIP --config $CPACK_CONFIG -B c:\dist -V diff --git a/ci/docker/windows_standalone/chocolatey/packages.config b/ci/docker/windows_standalone/chocolatey/packages.config deleted file mode 100644 index 28f2b7b7c..000000000 --- a/ci/docker/windows_standalone/chocolatey/packages.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/ci/docker/windows_standalone/chocolatey/python.xml b/ci/docker/windows_standalone/chocolatey/python.xml deleted file mode 100644 index 9f85f6040..000000000 --- a/ci/docker/windows_standalone/chocolatey/python.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ci/docker/windows_standalone/install_choco.ps1 b/ci/docker/windows_standalone/install_choco.ps1 deleted file mode 100644 index 0a50f8e2d..000000000 --- a/ci/docker/windows_standalone/install_choco.ps1 +++ /dev/null @@ -1,284 +0,0 @@ -# Download and install Chocolatey nupkg from an OData (HTTP/HTTPS) url such as Artifactory, Nexus, ProGet (all of these are recommended for organizational use), or Chocolatey.Server (great for smaller organizations and POCs) -# This is where you see the top level API - with xml to Packages - should look nearly the same as https://chocolatey.org/api/v2/ -# If you are using Nexus, always add the trailing slash or it won't work -# === EDIT HERE === -param ( - $packageRepo = "https://chocolatey.org/api/v2" - ) - -# If the above $packageRepo repository requires authentication, add the username and password here. Otherwise these leave these as empty strings. -$repoUsername = '' # this must be empty is NOT using authentication -$repoPassword = '' # this must be empty if NOT using authentication - -# Determine unzipping method -# 7zip is the most compatible, but you need an internally hosted 7za.exe. -# Make sure the version matches for the arguments as well. -# Built-in does not work with Server Core, but if you have PowerShell 5 -# it uses Expand-Archive instead of COM -$unzipMethod = 'builtin' -#$unzipMethod = '7zip' -#$7zipUrl = 'https://chocolatey.org/7za.exe' - -# === ENVIRONMENT VARIABLES YOU CAN SET === -# Prior to running this script, in a PowerShell session, you can set the -# following environment variables and it will affect the output - -#$env:ChocolateyEnvironmentDebug = 'true' # see output -# - $env:chocolateyIgnoreProxy = 'true' # ignore proxy -# - $env:chocolateyProxyLocation = '' # explicit proxy -# - $env:chocolateyProxyUser = '' # explicit proxy user name (optional) -# - $env:chocolateyProxyPassword = '' # explicit proxy password (optional) - -# === NO NEED TO EDIT ANYTHING BELOW THIS LINE === -# Ensure we can run everything -Set-ExecutionPolicy Bypass -Scope Process -Force; - -# If the repository requires authentication, create the Credential object -if ((-not [string]::IsNullOrEmpty($repoUsername)) -and (-not [string]::IsNullOrEmpty($repoPassword))) { - $securePassword = ConvertTo-SecureString $repoPassword -AsPlainText -Force - $repoCreds = New-Object System.Management.Automation.PSCredential ($repoUsername, $securePassword) -} - -$searchUrl = ($packageRepo.Trim('/'), 'Packages()?$filter=(Id%20eq%20%27chocolatey%27)%20and%20IsLatestVersion') -join '/' - -# Reroute TEMP to a local location -New-Item $env:ALLUSERSPROFILE\choco-cache -ItemType Directory -Force -$env:TEMP = "$env:ALLUSERSPROFILE\choco-cache" - -$localChocolateyPackageFilePath = Join-Path $env:TEMP 'chocolatey.nupkg' -$ChocoInstallPath = "$($env:SystemDrive)\ProgramData\Chocolatey\bin" -$env:ChocolateyInstall = "$($env:SystemDrive)\ProgramData\Chocolatey" -$env:Path += ";$ChocoInstallPath" -$DebugPreference = 'Continue'; - -# PowerShell v2/3 caches the output stream. Then it throws errors due -# to the FileStream not being what is expected. Fixes "The OS handle's -# position is not what FileStream expected. Do not use a handle -# simultaneously in one FileStream and in Win32 code or another -# FileStream." -function Fix-PowerShellOutputRedirectionBug { - $poshMajorVerion = $PSVersionTable.PSVersion.Major - - if ($poshMajorVerion -lt 4) { - try{ - # http://www.leeholmes.com/blog/2008/07/30/workaround-the-os-handles-position-is-not-what-filestream-expected/ plus comments - $bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetField" - $objectRef = $host.GetType().GetField("externalHostRef", $bindingFlags).GetValue($host) - $bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetProperty" - $consoleHost = $objectRef.GetType().GetProperty("Value", $bindingFlags).GetValue($objectRef, @()) - [void] $consoleHost.GetType().GetProperty("IsStandardOutputRedirected", $bindingFlags).GetValue($consoleHost, @()) - $bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetField" - $field = $consoleHost.GetType().GetField("standardOutputWriter", $bindingFlags) - $field.SetValue($consoleHost, [Console]::Out) - [void] $consoleHost.GetType().GetProperty("IsStandardErrorRedirected", $bindingFlags).GetValue($consoleHost, @()) - $field2 = $consoleHost.GetType().GetField("standardErrorWriter", $bindingFlags) - $field2.SetValue($consoleHost, [Console]::Error) - } catch { - Write-Output 'Unable to apply redirection fix.' - } - } -} - -Fix-PowerShellOutputRedirectionBug - -# Attempt to set highest encryption available for SecurityProtocol. -# PowerShell will not set this by default (until maybe .NET 4.6.x). This -# will typically produce a message for PowerShell v2 (just an info -# message though) -try { - # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) - # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't - # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is - # installed (.NET 4.5 is an in-place upgrade). - [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 -} catch { - Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3+.' -} - -function Get-Downloader { -param ( - [string]$url - ) - $downloader = new-object System.Net.WebClient - - $defaultCreds = [System.Net.CredentialCache]::DefaultCredentials - if (Test-Path -Path variable:repoCreds) { - Write-Debug "Using provided repository authentication credentials." - $downloader.Credentials = $repoCreds - } elseif ($defaultCreds -ne $null) { - Write-Debug "Using default repository authentication credentials." - $downloader.Credentials = $defaultCreds - } - - $ignoreProxy = $env:chocolateyIgnoreProxy - if ($ignoreProxy -ne $null -and $ignoreProxy -eq 'true') { - Write-Debug 'Explicitly bypassing proxy due to user environment variable.' - $downloader.Proxy = [System.Net.GlobalProxySelection]::GetEmptyWebProxy() - } else { - # check if a proxy is required - $explicitProxy = $env:chocolateyProxyLocation - $explicitProxyUser = $env:chocolateyProxyUser - $explicitProxyPassword = $env:chocolateyProxyPassword - if ($explicitProxy -ne $null -and $explicitProxy -ne '') { - # explicit proxy - $proxy = New-Object System.Net.WebProxy($explicitProxy, $true) - if ($explicitProxyPassword -ne $null -and $explicitProxyPassword -ne '') { - $passwd = ConvertTo-SecureString $explicitProxyPassword -AsPlainText -Force - $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($explicitProxyUser, $passwd) - } - - Write-Debug "Using explicit proxy server '$explicitProxy'." - $downloader.Proxy = $proxy - - } elseif (!$downloader.Proxy.IsBypassed($url)) { - # system proxy (pass through) - $creds = $defaultCreds - if ($creds -eq $null) { - Write-Debug 'Default credentials were null. Attempting backup method' - $cred = get-credential - $creds = $cred.GetNetworkCredential(); - } - - $proxyaddress = $downloader.Proxy.GetProxy($url).Authority - Write-Debug "Using system proxy server '$proxyaddress'." - $proxy = New-Object System.Net.WebProxy($proxyaddress) - $proxy.Credentials = $creds - $downloader.Proxy = $proxy - } - } - - return $downloader -} - -function Download-File { -param ( - [string]$url, - [string]$file - ) - $downloader = Get-Downloader $url - $downloader.DownloadFile($url, $file) -} - -function Download-Package { -param ( - [string]$packageODataSearchUrl, - [string]$file - ) - $downloader = Get-Downloader $packageODataSearchUrl - - Write-Output "Querying latest package from $packageODataSearchUrl" - [xml]$pkg = $downloader.DownloadString($packageODataSearchUrl) - $packageDownloadUrl = $pkg.feed.entry.content.src - - Write-Output "Downloading $packageDownloadUrl to $file" - $downloader.DownloadFile($packageDownloadUrl, $file) -} - -function Install-ChocolateyFromPackage { -param ( - [string]$chocolateyPackageFilePath = '' -) - - if ($chocolateyPackageFilePath -eq $null -or $chocolateyPackageFilePath -eq '') { - throw "You must specify a local package to run the local install." - } - - if (!(Test-Path($chocolateyPackageFilePath))) { - throw "No file exists at $chocolateyPackageFilePath" - } - - $chocTempDir = Join-Path $env:TEMP "chocolatey" - $tempDir = Join-Path $chocTempDir "chocInstall" - if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)} - $file = Join-Path $tempDir "chocolatey.zip" - Copy-Item $chocolateyPackageFilePath $file -Force - - # unzip the package - Write-Output "Extracting $file to $tempDir..." - if ($unzipMethod -eq '7zip') { - $7zaExe = Join-Path $tempDir '7za.exe' - if (-Not (Test-Path ($7zaExe))) { - Write-Output 'Downloading 7-Zip commandline tool prior to extraction.' - # download 7zip - Download-File $7zipUrl "$7zaExe" - } - - $params = "x -o`"$tempDir`" -bd -y `"$file`"" - # use more robust Process as compared to Start-Process -Wait (which doesn't - # wait for the process to finish in PowerShell v3) - $process = New-Object System.Diagnostics.Process - $process.StartInfo = New-Object System.Diagnostics.ProcessStartInfo($7zaExe, $params) - $process.StartInfo.RedirectStandardOutput = $true - $process.StartInfo.UseShellExecute = $false - $process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden - $process.Start() | Out-Null - $process.BeginOutputReadLine() - $process.WaitForExit() - $exitCode = $process.ExitCode - $process.Dispose() - - $errorMessage = "Unable to unzip package using 7zip. Perhaps try setting `$env:chocolateyUseWindowsCompression = 'true' and call install again. Error:" - switch ($exitCode) { - 0 { break } - 1 { throw "$errorMessage Some files could not be extracted" } - 2 { throw "$errorMessage 7-Zip encountered a fatal error while extracting the files" } - 7 { throw "$errorMessage 7-Zip command line error" } - 8 { throw "$errorMessage 7-Zip out of memory" } - 255 { throw "$errorMessage Extraction cancelled by the user" } - default { throw "$errorMessage 7-Zip signalled an unknown error (code $exitCode)" } - } - } else { - if ($PSVersionTable.PSVersion.Major -lt 5) { - try { - $shellApplication = new-object -com shell.application - $zipPackage = $shellApplication.NameSpace($file) - $destinationFolder = $shellApplication.NameSpace($tempDir) - $destinationFolder.CopyHere($zipPackage.Items(),0x10) - } catch { - throw "Unable to unzip package using built-in compression. Set `$env:chocolateyUseWindowsCompression = 'false' and call install again to use 7zip to unzip. Error: `n $_" - } - } else { - Expand-Archive -Path "$file" -DestinationPath "$tempDir" -Force - } - } - - # Call Chocolatey install - Write-Output 'Installing chocolatey on this machine' - $toolsFolder = Join-Path $tempDir "tools" - $chocInstallPS1 = Join-Path $toolsFolder "chocolateyInstall.ps1" - - & $chocInstallPS1 - - Write-Output 'Ensuring chocolatey commands are on the path' - $chocInstallVariableName = 'ChocolateyInstall' - $chocoPath = [Environment]::GetEnvironmentVariable($chocInstallVariableName) - if ($chocoPath -eq $null -or $chocoPath -eq '') { - $chocoPath = 'C:\ProgramData\Chocolatey' - } - - $chocoExePath = Join-Path $chocoPath 'bin' - - if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower()) -eq $false) { - $env:Path = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine); - } - - Write-Output 'Ensuring chocolatey.nupkg is in the lib folder' - $chocoPkgDir = Join-Path $chocoPath 'lib\chocolatey' - $nupkg = Join-Path $chocoPkgDir 'chocolatey.nupkg' - if (!(Test-Path $nupkg)) { - Write-Output 'Copying chocolatey.nupkg is in the lib folder' - if (![System.IO.Directory]::Exists($chocoPkgDir)) { [System.IO.Directory]::CreateDirectory($chocoPkgDir); } - Copy-Item "$file" "$nupkg" -Force -ErrorAction SilentlyContinue - } -} - -# Idempotence - do not install Chocolatey if it is already installed -if (!(Test-Path $ChocoInstallPath)) { - # download the package to the local path - if (!(Test-Path $localChocolateyPackageFilePath)) { - Download-Package $searchUrl $localChocolateyPackageFilePath - } - - # Install Chocolatey - Install-ChocolateyFromPackage $localChocolateyPackageFilePath -} \ No newline at end of file diff --git a/ci/docker/windows_standalone/nuget/packages.config b/ci/docker/windows_standalone/nuget/packages.config deleted file mode 100644 index 73093b323..000000000 --- a/ci/docker/windows_standalone/nuget/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ci/docker/windows_standalone/nuget/verify_installed_correctly.ps1 b/ci/docker/windows_standalone/nuget/verify_installed_correctly.ps1 deleted file mode 100644 index e56ef8e8f..000000000 --- a/ci/docker/windows_standalone/nuget/verify_installed_correctly.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -function Verify-Installed { - param ( - $FileName - ) - - if ((Get-Command $FileName -ErrorAction SilentlyContinue) -eq $null) - { - Write-Error "Unable to find $FileName in your PATH" - } - else { - Write-Host "Found $FileName" - } -} -Write-Host 'Locating expected commands on path' -Verify-Installed candle.exe -Verify-Installed light.exe -Verify-Installed lit.exe -Verify-Installed dark.exe -Verify-Installed heat.exe -Verify-Installed insignia.exe -Verify-Installed melt.exe -Verify-Installed torch.exe -Verify-Installed smoke.exe -Verify-Installed pyro.exe -Verify-Installed WixCop.exe -Verify-Installed retina.exe -Verify-Installed lux.exe -Verify-Installed nit.exe -Write-Host 'All Done' \ No newline at end of file diff --git a/ci/docker/windows_standalone/startup.bat b/ci/docker/windows_standalone/startup.bat deleted file mode 100644 index 58213097e..000000000 --- a/ci/docker/windows_standalone/startup.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off - -if defined DevEnvDir (EXIT /B 0) -CALL "c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64