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 <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2017-06-13 09:41:48 +01:00
parent cd71c4fe1c
commit 0a06c363bb
2 changed files with 38 additions and 25 deletions

View File

@ -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"

View File

@ -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"
},