From 0a06c363bb5745300b1b44801a71eb2c6ae2c956 Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Tue, 13 Jun 2017 09:41:48 +0100 Subject: [PATCH] Modified the help script used for downloading dependencies so that the domain can be passed in as a parameter and authentication is not required. For this purpose the artifactory download patterns had to be expanded so as to be understood by wget. Signed-off-by: Konstantina Chremmou --- devtools/download_packages.ps1 | 41 ++++++++++++++-------------------- mk/deps-map.json | 22 +++++++++++++++++- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/devtools/download_packages.ps1 b/devtools/download_packages.ps1 index e72bd69eb..9c3242b63 100644 --- a/devtools/download_packages.ps1 +++ b/devtools/download_packages.ps1 @@ -29,42 +29,35 @@ # SUCH DAMAGE. # help script to download third party binaries to local dev environment +# NOTE: do not remove the Requires directive -if ($PSVersionTable.PSVersion.Major -lt 3) -{ - Write-Host "Failed to execute: Powershell version 3.x (or above) is required" - exit 1 -} +#Requires -Version 3.0 + +Param( + [Parameter(Mandatory=$true, HelpMessage ="Artifactory domain (e.g. artifactory.domain.com)")] + [String]$DOMAIN +) -$DOMAIN = Read-Host "Artifactory domain (e.g. artifactory.domain.com): " $DOMAIN = $DOMAIN.Trim() -$CREDENTIALS = Get-Credential $PACKAGE_DIR = Get-Item "$PSScriptRoot\..\packages" | select -ExpandProperty FullName +$MK_DIR = Get-Item "$PSScriptRoot\..\mk" | select -ExpandProperty FullName #dotnet packages -$BUILD_LOCATION = Get-Content "$PACKAGE_DIR\DOTNET_BUILD_LOCATION" -$BUILD_LOCATION = $BUILD_LOCATION.Trim() -$DOTNET = "https://$DOMAIN/api/archive/download/$BUILD_LOCATION/dotnet46?archiveType=zip" -$ZIP_PATH = "$PACKAGE_DIR\dotnetpackages.zip" +$BUILD_LOCATION = (Get-Content "$PACKAGE_DIR\DOTNET_BUILD_LOCATION").Trim() +$DEPS_MAP = Get-Content "$MK_DIR\deps-map.json" ` + | foreach {$_ -replace '@REMOTE_DOTNET@',"$BUILD_LOCATION"} ` + | ConvertFrom-Json -Invoke-WebRequest -Uri $DOTNET -Credential $CREDENTIALS -Method Get -OutFile $ZIP_PATH - -$shell = New-Object -COM 'Shell.Application' -$zip = $shell.NameSpace($ZIP_PATH) - -foreach($item in $zip.items()) -{ - $name = [System.IO.Path]::GetFileName($item.Path) - $ext = [System.IO.Path]::GetExtension($item.Path) +foreach($dep in $DEPS_MAP.files) { + $pattern = "https://$DOMAIN/" + $dep.pattern + $filename = Split-Path $pattern -leaf - if (($name -eq "putty.exe") -or ($ext -like "*.dll")) { - $shell.Namespace($PACKAGE_DIR).CopyHere($item, 4 -bor 16) + if (($filename -eq "putty.exe") -or ($filename -like "*.dll")) { + Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$filename" } } -Remove-Item $ZIP_PATH - #unit test dependencies $MOQ="Moq.dll" diff --git a/mk/deps-map.json b/mk/deps-map.json index e6d82e8fa..11ecdddb8 100644 --- a/mk/deps-map.json +++ b/mk/deps-map.json @@ -21,7 +21,27 @@ "flat": "true" }, { - "pattern": "@REMOTE_DOTNET@/dotnet46/*.dll", + "pattern": "@REMOTE_DOTNET@/dotnet46/CookComputing.XmlRpcV2.dll", + "target": "xenadmin.git/packages/", + "flat": "true" + }, + { + "pattern": "@REMOTE_DOTNET@/dotnet46/DiscUtils.dll", + "target": "xenadmin.git/packages/", + "flat": "true" + }, + { + "pattern": "@REMOTE_DOTNET@/dotnet46/ICSharpCode.SharpZipLib.dll", + "target": "xenadmin.git/packages/", + "flat": "true" + }, + { + "pattern": "@REMOTE_DOTNET@/dotnet46/Ionic.Zip.dll", + "target": "xenadmin.git/packages/", + "flat": "true" + }, + { + "pattern": "@REMOTE_DOTNET@/dotnet46/log4net.dll", "target": "xenadmin.git/packages/", "flat": "true" },