Skip to content

Commit

Permalink
Add chocolatey.nuget.versioning normalization to repocheck
Browse files Browse the repository at this point in the history
This avoids version comparison when Chocolatey CLI v2.x changes the normalization upon pack.
  • Loading branch information
TheCakeIsNaOH committed Oct 1, 2023
1 parent 4431aa8 commit 8208e14
Show file tree
Hide file tree
Showing 10 changed files with 2,922 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ config.xml
repo-move.xml
internalized.xml
download.xml
*.nupkg
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NuGet's implementation of Semantic Versioning.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions choco-remixer/private/Get-RemixerConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,7 @@
} else {
$global:remixerLocale = "en-US"
}

$versioningDLLPath = [IO.Path]::Combine((Split-Path $PSScriptRoot),"private","Chocolatey.NuGet.Versioning.3.4.2","lib","netstandard2.0","Chocolatey.NuGet.Versioning.dll")
Add-Type -Path $versioningDLLPath
}
6 changes: 5 additions & 1 deletion choco-remixer/public/Invoke-RepoCheck.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
$nuspecID = $_
Write-Verbose "Comparing repo versions of $($nuspecID)"

$privateVersions = $privateInfo | Where-Object { $_.name -eq $nuspecID } | Select-Object -ExpandProperty version
# Normalize version, as Chocolatey CLI now normalizes versions on pack
$privateVersions = $privateInfo | Where-Object { $_.name -eq $nuspecID } | Select-Object -ExpandProperty version | ForEach-Object { [NuGet.Versioning.NuGetVersion]::Parse($_).ToNormalizedString(); }

$publicPageURL = $config.publicRepoURL + 'Packages()?$filter=(tolower(Id)%20eq%20%27' + $nuspecID + '%27)%20and%20IsLatestVersion'
[xml]$publicPage = Invoke-WebRequest -UseBasicParsing -TimeoutSec 25 -Uri $publicPageURL
Expand All @@ -77,6 +78,9 @@
}
}

# Normalize version, as Chocolatey CLI now normalizes versions on pack
$publicVersion = [NuGet.Versioning.NuGetVersion]::Parse($publicVersion).ToNormalizedString();

if ($privateVersions -inotcontains $publicVersion) {

Write-Information "$nuspecID out of date on private repo, found version $publicVersion, downloading" -InformationAction Continue
Expand Down

0 comments on commit 8208e14

Please sign in to comment.