Update dnvm to build 10345

This commit is contained in:
Troy Dai 2015-03-11 11:00:40 -07:00
parent 1407c09c30
commit 30e4b1c167
2 changed files with 53 additions and 29 deletions

View File

@ -59,7 +59,7 @@ function _WriteOut {
### Constants ### Constants
$ProductVersion="1.0.0" $ProductVersion="1.0.0"
$BuildVersion="beta4-10338" $BuildVersion="beta4-10345"
$Authors="Microsoft Open Technologies, Inc." $Authors="Microsoft Open Technologies, Inc."
# If the Version hasn't been replaced... # If the Version hasn't been replaced...
@ -100,6 +100,9 @@ $ExitCodes = @{
"AliasDoesNotExist" = 1001 "AliasDoesNotExist" = 1001
"UnknownCommand" = 1002 "UnknownCommand" = 1002
"InvalidArguments" = 1003 "InvalidArguments" = 1003
"OtherError" = 1004
"NoSuchPackage" = 1005
"NoRuntimesOnFeed" = 1006
} }
$ColorScheme = $DnvmColors $ColorScheme = $DnvmColors
@ -401,7 +404,12 @@ function Find-Latest {
$wc = New-Object System.Net.WebClient $wc = New-Object System.Net.WebClient
Apply-Proxy $wc -Proxy:$Proxy Apply-Proxy $wc -Proxy:$Proxy
_WriteDebug "Downloading $url ..." _WriteDebug "Downloading $url ..."
[xml]$xml = $wc.DownloadString($url) try {
[xml]$xml = $wc.DownloadString($url)
} catch {
$Script:ExitCode = $ExitCodes.NoRuntimesOnFeed
throw "Unable to find any runtime packages on the feed!"
}
$version = Select-Xml "//d:Version" -Namespace @{d='http://schemas.microsoft.com/ado/2007/08/dataservices'} $xml $version = Select-Xml "//d:Version" -Namespace @{d='http://schemas.microsoft.com/ado/2007/08/dataservices'} $xml
@ -449,7 +457,12 @@ function Download-Package(
$wc = New-Object System.Net.WebClient $wc = New-Object System.Net.WebClient
Apply-Proxy $wc -Proxy:$Proxy Apply-Proxy $wc -Proxy:$Proxy
_WriteDebug "Downloading $url ..." _WriteDebug "Downloading $url ..."
$wc.DownloadFile($url, $DestinationFile) try {
$wc.DownloadFile($url, $DestinationFile)
} catch {
$Script:ExitCode = $ExitCodes.NoSuchPackage
throw "Could not find $runtimeFullName.$Version on feed: $Feed"
}
} }
function Unpack-Package([string]$DownloadFile, [string]$UnpackFolder) { function Unpack-Package([string]$DownloadFile, [string]$UnpackFolder) {
@ -852,9 +865,10 @@ function dnvm-upgrade {
<# <#
.SYNOPSIS .SYNOPSIS
Installs a version of the runtime Installs a version of the runtime
.PARAMETER VersionOrNuPkg .PARAMETER VersionNuPkgOrAlias
The version to install from the current channel, the path to a '.nupkg' file to install, or 'latest' to The version to install from the current channel, the path to a '.nupkg' file to install, 'latest' to
install the latest available version from the current channel. install the latest available version from the current channel, or an alias value to install an alternate
runtime or architecture flavor of the specified alias.
.PARAMETER Architecture .PARAMETER Architecture
The processor architecture of the runtime to install (default: x86) The processor architecture of the runtime to install (default: x86)
.PARAMETER Runtime .PARAMETER Runtime
@ -876,7 +890,7 @@ function dnvm-upgrade {
function dnvm-install { function dnvm-install {
param( param(
[Parameter(Mandatory=$false, Position=0)] [Parameter(Mandatory=$false, Position=0)]
[string]$VersionOrNuPkg, [string]$VersionNuPkgOrAlias,
[Alias("arch")] [Alias("arch")]
[ValidateSet("", "x86","x64")] [ValidateSet("", "x86","x64")]
@ -905,28 +919,28 @@ function dnvm-install {
[Parameter(Mandatory=$false)] [Parameter(Mandatory=$false)]
[switch]$Ngen) [switch]$Ngen)
if(!$VersionOrNuPkg) { if(!$VersionNuPkgOrAlias) {
_WriteOut "A version, nupkg path, or the string 'latest' must be provided." _WriteOut "A version, nupkg path, or the string 'latest' must be provided."
dnvm-help install dnvm-help install
$Script:ExitCode = $ExitCodes.InvalidArguments $Script:ExitCode = $ExitCodes.InvalidArguments
return return
} }
if ($VersionOrNuPkg -eq "latest") { if ($VersionNuPkgOrAlias -eq "latest") {
$VersionOrNuPkg = Find-Latest $Runtime $Architecture $VersionNuPkgOrAlias = Find-Latest $Runtime $Architecture
} }
$IsNuPkg = $VersionOrNuPkg.EndsWith(".nupkg") $IsNuPkg = $VersionNuPkgOrAlias.EndsWith(".nupkg")
if ($IsNuPkg) { if ($IsNuPkg) {
if(!(Test-Path $VersionOrNuPkg)) { if(!(Test-Path $VersionNuPkgOrAlias)) {
throw "Unable to locate package file: '$VersionOrNuPkg'" throw "Unable to locate package file: '$VersionNuPkgOrAlias'"
} }
$runtimeFullName = [System.IO.Path]::GetFileNameWithoutExtension($VersionOrNuPkg) $runtimeFullName = [System.IO.Path]::GetFileNameWithoutExtension($VersionNuPkgOrAlias)
$Architecture = Get-PackageArch $runtimeFullName $Architecture = Get-PackageArch $runtimeFullName
$Runtime = Get-PackageRuntime $runtimeFullName $Runtime = Get-PackageRuntime $runtimeFullName
} else { } else {
$runtimeFullName = Get-RuntimeName $VersionOrNuPkg -Architecture:$Architecture -Runtime:$Runtime $runtimeFullName = Get-RuntimeName $VersionNuPkgOrAlias -Architecture:$Architecture -Runtime:$Runtime
} }
$PackageVersion = Get-PackageVersion $runtimeFullName $PackageVersion = Get-PackageVersion $runtimeFullName
@ -960,12 +974,12 @@ function dnvm-install {
New-Item -Type Directory $UnpackFolder | Out-Null New-Item -Type Directory $UnpackFolder | Out-Null
if($IsNuPkg) { if($IsNuPkg) {
_WriteDebug "Copying local nupkg $VersionOrNuPkg to $DownloadFile" _WriteDebug "Copying local nupkg $VersionNuPkgOrAlias to $DownloadFile"
Copy-Item $VersionOrNuPkg $DownloadFile Copy-Item $VersionNuPkgOrAlias $DownloadFile
} else { } else {
# Download the package # Download the package
_WriteDebug "Downloading version $VersionOrNuPkg to $DownloadFile" _WriteDebug "Downloading version $VersionNuPkgOrAlias to $DownloadFile"
Download-Package $VersionOrNuPkg $Architecture $Runtime $DownloadFile -Proxy:$Proxy Download-Package $PackageVersion $Architecture $Runtime $DownloadFile -Proxy:$Proxy
} }
Unpack-Package $DownloadFile $UnpackFolder Unpack-Package $DownloadFile $UnpackFolder
@ -1193,6 +1207,11 @@ if($UnencodedHomes -contains $OldUserHome) {
} }
} }
# Check for old KRE_HOME variable
if(Test-Path env:\KRE_HOME) {
_WriteOut -ForegroundColor Yellow "WARNING: Found a KRE_HOME environment variable. This variable has been deprecated and should be removed, or it may interfere with DNVM and the .NET Execution environment"
}
# Read arguments # Read arguments
$cmd = $args[0] $cmd = $args[0]
@ -1223,15 +1242,20 @@ if(!$cmd) {
$Script:ExitCode = $ExitCodes.InvalidArguments $Script:ExitCode = $ExitCodes.InvalidArguments
} }
# Check for the command # Check for the command and run it
if(Get-Command -Name "$CommandPrefix$cmd" -ErrorAction SilentlyContinue) { try {
_WriteDebug "& dnvm-$cmd $cmdargs" if(Get-Command -Name "$CommandPrefix$cmd" -ErrorAction SilentlyContinue) {
& "dnvm-$cmd" @cmdargs _WriteDebug "& dnvm-$cmd $cmdargs"
} & "dnvm-$cmd" @cmdargs
else { }
_WriteOut "Unknown command: '$cmd'" else {
dnvm-help _WriteOut "Unknown command: '$cmd'"
$Script:ExitCode = $ExitCodes.UnknownCommand dnvm-help
$Script:ExitCode = $ExitCodes.UnknownCommand
}
} catch {
Write-Error $_
if(!$Script:ExitCode) { $Script:ExitCode = $ExitCodes.OtherError }
} }
_WriteDebug "=== End $CommandName (Exit Code $Script:ExitCode) ===" _WriteDebug "=== End $CommandName (Exit Code $Script:ExitCode) ==="

View File

@ -2,7 +2,7 @@
# Source this file from your .bash-profile or script to use # Source this file from your .bash-profile or script to use
# "Constants" # "Constants"
_DNVM_BUILDNUMBER="beta4-10338" _DNVM_BUILDNUMBER="beta4-10345"
_DNVM_AUTHORS="Microsoft Open Technologies, Inc." _DNVM_AUTHORS="Microsoft Open Technologies, Inc."
_DNVM_RUNTIME_PACKAGE_NAME="dnx" _DNVM_RUNTIME_PACKAGE_NAME="dnx"
_DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment" _DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment"