Compare prerelease versions correctly for updates
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
This commit is contained in:
+37
-2
@@ -100,8 +100,43 @@ function Release-LatestTagDownloadUrl {
|
||||
return $null
|
||||
}
|
||||
|
||||
function Version-Core($Value) {
|
||||
$base = $Value.TrimStart("v").Split("+")[0]
|
||||
$base.Split("-")[0]
|
||||
}
|
||||
|
||||
function Version-Prerelease($Value) {
|
||||
$base = $Value.TrimStart("v").Split("+")[0]
|
||||
$dash = $base.IndexOf("-")
|
||||
if ($dash -lt 0) {
|
||||
return ""
|
||||
}
|
||||
$base.Substring($dash + 1).ToLowerInvariant()
|
||||
}
|
||||
|
||||
function Version-Parts($Value) {
|
||||
[regex]::Matches($Value, "\d+") | ForEach-Object { [int64]$_.Value }
|
||||
[regex]::Matches((Version-Core $Value), "\d+") | ForEach-Object { [int64]$_.Value }
|
||||
}
|
||||
|
||||
function Compare-Prerelease($Left, $Right) {
|
||||
if (-not $Left -and -not $Right) {
|
||||
return 0
|
||||
}
|
||||
if (-not $Left) {
|
||||
return 1
|
||||
}
|
||||
if (-not $Right) {
|
||||
return -1
|
||||
}
|
||||
if ($Left -eq $Right) {
|
||||
return 0
|
||||
}
|
||||
if ($Left -match "(?i)^rc(\d+)$" -and $Right -match "(?i)^rc(\d+)$") {
|
||||
$leftRc = [int64]([regex]::Match($Left, "(?i)^rc(\d+)$").Groups[1].Value)
|
||||
$rightRc = [int64]([regex]::Match($Right, "(?i)^rc(\d+)$").Groups[1].Value)
|
||||
return $leftRc.CompareTo($rightRc)
|
||||
}
|
||||
return [string]::CompareOrdinal($Left, $Right)
|
||||
}
|
||||
|
||||
function Compare-DoshVersion($Left, $Right) {
|
||||
@@ -114,7 +149,7 @@ function Compare-DoshVersion($Left, $Right) {
|
||||
if ($l -lt $r) { return -1 }
|
||||
if ($l -gt $r) { return 1 }
|
||||
}
|
||||
return 0
|
||||
return Compare-Prerelease (Version-Prerelease $Left) (Version-Prerelease $Right)
|
||||
}
|
||||
|
||||
function Current-SourceVersion {
|
||||
|
||||
Reference in New Issue
Block a user