mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 13:01:47 +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
1018 B
JSON
40 lines
1018 B
JSON
{
|
|
"versions": [
|
|
{
|
|
"git-tree": "2adfb6dcd5eab92b258f45aaf4a494bed18eb687",
|
|
"version-string": "2020-09-14",
|
|
"port-version": 1
|
|
},
|
|
{
|
|
"git-tree": "6a8b09c3639cf50beb79315f87382cbbcf377e66",
|
|
"version-string": "2020-09-14",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "7c618d0a1c68a72706865de96833a01f00a6eb93",
|
|
"version-string": "2018-07-30-2",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "4c7d148764b13c7cc56815d773febe64c33b09f8",
|
|
"version-string": "2018-07-30-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "4efb1bf652deb1a8c66a01cf646b9e3e060021c6",
|
|
"version-string": "2018-07-30",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "31e7c14e150fbfc8e9a05d07dd96e14cf496eae1",
|
|
"version-string": "2017-09-02-cb5e4a86f69628-1",
|
|
"port-version": 0
|
|
},
|
|
{
|
|
"git-tree": "c072038c84e8177d36fde2a7ab3bef2bdc79ce1f",
|
|
"version-string": "2017-09-02-cb5e4a86f69628",
|
|
"port-version": 0
|
|
}
|
|
]
|
|
}
|