-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(GH-95) Allow for upgrading of packages #134
base: development
Are you sure you want to change the base?
(GH-95) Allow for upgrading of packages #134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why there is a UpgradeLowerVersions
parameter as I would imagine upgrading, rather than uninstalling / installing is not the desired behaviour?
I went with a |
@alphakilo45 I'm not clear again as to why we are using the parameter Thoughts? |
@pauby Only reason I can think of is when the build/pre-release tag is the only difference in the version number and that'll still be supported. I'll get the code updated. |
Those tests failed quite spectacularly! Can you rebase and re-push? |
1865f7e
to
91e9890
Compare
…installing/reinstalling
…ity to be to upgrade a package
91e9890
to
dd0c3ff
Compare
Agreed - rebase didn't help so I need to find some time on keyboard to figure out what is causing that. |
@pauby Looks like Pester released v5 recently and that is causing issues with the tests. I fixed the maxed version in AppVeyor at 4.10.1 (the last pre-5.0.0 version) and tests are now running green. |
function Get-VersionCore { | ||
[CmdletBinding()] | ||
param ( | ||
[string]$Version | ||
) | ||
|
||
[Version] $versionCore = $null | ||
if ($Version -match '(?<Major>[1-9]\d*)(\.(?<Minor>[0-9]*))?(\.(?<Patch>[0-9]*))?(\.(?<Segment>[0-9]*))?([-+].*)?') { | ||
$versionCore = New-Object System.Version($Matches.Major, $Matches.Minor, $Matches.Patch, $Matches.Segment) | ||
} | ||
|
||
$versionCore | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't compare prerelease versions so 3.0.0-beta1 and 3.0.0-beta2 are the same. So in this instance the code calling it would actually uninstall 3.0.0-beta1 and install 3.0.0-beta2 rather than upgrade.
[Parameter(Position=4)] | ||
[string]$pVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at line 146 above you've got:
$chocoParams += " --version='$versionToInstall'"
Upgrade-Package -pName $Name -pParams $Params -pSource $Source -cParams $chocoParams
The version parameter is added in the calling code by adding it to -cParams
parameter. So I'm unsure why we need a specific parameter here that does nothing more than add it into the Choco parameters?
if ($pVersion) { | ||
$chocoParams += " --version=`"$pVersion`"" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the code I was talking about above.
This is related to #95 and adds a new resource parameter called
UpgradeLowerVersions
that causes the cChocoPackageInstall resource to callchoco update
instead of executing an uninstall/install when the package is already installed and on a lower version.