mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-18 18:57:49 +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 ```
25 lines
565 B
JSON
25 lines
565 B
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "beca539b781c4a50d092a4b02e9b2af455f14b40",
|
|
"version-string": "2.7.2.14",
|
|
"port-version": 3
|
|
},
|
|
{
|
|
"git-tree": "b5a0f89ae5e856ba0a4f3289230f2df88c4a028c",
|
|
"version-string": "2.7.2.14",
|
|
"port-version": 2
|
|
},
|
|
{
|
|
"git-tree": "c7f1674a923779970b8e0ba8da0e73f776e0f8e7",
|
|
"version-string": "2.7.2.14-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "848a7a4fbf7283399af7eec484ec30ce41c0603c",
|
|
"version-string": "2.7.2.14",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|