mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 22:49:06 +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 ```
40 lines
957 B
JSON
40 lines
957 B
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "582d8581a1bfef351571e1ba8ea8910bdc8291fc",
|
|
"version-string": "1.0.2",
|
|
"port-version": 2
|
|
},
|
|
{
|
|
"git-tree": "453a5d8a428bfaf904e55a2178895e6d8a104ef9",
|
|
"version-string": "1.0.2-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "f5346a0c9640ea8f11b6fb81228e80063b67c907",
|
|
"version-string": "1.0.1-4",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "a4a9fc75abd7600a986df6a73627548f71787409",
|
|
"version-string": "1.0.1-3",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "fd02c13a234ce16401cd30647783d7aa647a4321",
|
|
"version-string": "1.0.1-2",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "98f39a54d2336eae4272c2da3ec683c1630e224b",
|
|
"version-string": "1.0.1-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "ee5d942c756ef7f339573a55fc0f40ca1efc02fb",
|
|
"version-string": "1.0.1",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|