mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-29 04:29:01 +08:00
b295670e4b
``` function Convert-Control { Param($full) .\vcpkg.exe format-manifest $full $root = $full.Substring(0, $full.Length - 7) # CONTROL $new = $root + 'vcpkg.json' $content = Get-Content -Raw $new $asJson = ConvertFrom-Json $content -AsHashtable -Depth 100 $oldVersion = $asJson['port-version'] if ($null -eq $oldVersion) { $oldVersionFull = $asJson['version-string'] Write-Host "Got version $oldVersionFull" $match = [System.Text.RegularExpressions.Regex]::Match($oldVersionFull, '^(.+)-(\d+)$') if ($match.Success -and -not [System.Text.RegularExpressions.Regex]::IsMatch($oldVersionFull, '^\d\d\d\d-\d\d-\d\d$')) { $newFullVersion = [string]$match.Groups[1].Value $oldVersion = [int]$match.Groups[2].Value Write-Host "newFullVersion $newFullVersion oldVersion $oldVersion" $newVersion = $oldVersion + 1 $asJson['version-string'] = $newFullVersion Write-Host "Previous version for $full extracted from version field -- setting version-string $newFullVersion and port-version $newVersion" } else { Write-Host "No previous version for $full -- setting 1" $newVersion = 1 } } else { $newVersion = [int]$oldVersion + 1 Write-Host "New version for $full : $newVersion" } $asJson['port-version'] = $newVersion $content = ConvertTo-Json $asJson -Depth 100 Set-Content -Path $new -Value $content .\vcpkg.exe format-manifest $new } Get-ChildItem ports\CONTROL -Recurse | Foreach-Object { Convert-Control $_.FullName } git commit -am "this message" .\vcpkg.exe x-add-version -all git commit -a --amend ```
35 lines
829 B
JSON
35 lines
829 B
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "e39d38661e62f2c36eaa0026eabfb21e827e8456",
|
|
"version-string": "498839d",
|
|
"port-version": 2
|
|
},
|
|
{
|
|
"git-tree": "b1c80aab0470d03d5f336f15283beec17f3a3bfc",
|
|
"version-string": "498839d-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "f92db27a90b9e9cccab9e26070636e2cd2e7a288",
|
|
"version-string": "498839d",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "93a8c61b8b35fc8509a7332f010ba0aa0fbc1849",
|
|
"version-string": "e2d3018",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "4d19aa5a142294b7d0758dded27e46a7337a3c2c",
|
|
"version-string": "1d785d9",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "db13bfd7913485c6c164215bbb3da8f9c474abc4",
|
|
"version-string": "61e184a",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|