Skip to content

Commit

Permalink
Update vcpkg-tool to 2023-08-02 and add update script. (microsoft#32885)
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal authored Aug 4, 2023
1 parent 500c6f2 commit 1e9cf69
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 5 deletions.
75 changes: 75 additions & 0 deletions scripts/update-vcpkg-tool-metadata.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Date
)

function Get-Sha256 {
Param([string]$File)
$content = [System.IO.File]::ReadAllBytes($File)
$shaHasher = $null
[string]$shaHash = ''
try {
$shaHasher = [System.Security.Cryptography.SHA256]::Create()
$hashBytes = $shaHasher.ComputeHash($content)
$shaHash = [System.BitConverter]::ToString($hashBytes).Replace('-', '').ToLowerInvariant()
} finally {
if ($shaHasher -ne $null) {
$shaHasher.Dispose();
}
}

return $shaHash
}

[string]$metadata = "VCPKG_TOOL_RELEASE_TAG=$Date`n"
$vsCodeHashes = [ordered]@{}
Set-Content -LiteralPath "$PSScriptRoot\vcpkg-tool-metadata.txt" -Value $metadata -NoNewline -Encoding utf8NoBOM
& "$PSScriptRoot\bootstrap.ps1"
[string]$vcpkg = "$PSScriptRoot\..\vcpkg.exe"

# Windows arm64 (VS Code only)
& $vcpkg x-download "$PSScriptRoot\vcpkg-arm64.exe" `
"--url=https://github.com/microsoft/vcpkg-tool/releases/download/$Date/vcpkg-arm64.exe" --skip-sha512
$vsCodeHashes["vcpkg-arm64.exe"] = Get-Sha256 "$PSScriptRoot\vcpkg-arm64.exe"

# Linux Binaries
foreach ($binary in @('macos', 'muslc', 'glibc')) {
$caps = $binary.ToUpperInvariant()
& $vcpkg x-download "$PSScriptRoot\vcpkg-$binary" `
"--url=https://github.com/microsoft/vcpkg-tool/releases/download/$Date/vcpkg-$binary" --skip-sha512
$sha512 = & $vcpkg hash "$PSScriptRoot\vcpkg-$binary"
$metadata += "VCPKG_$($caps)_SHA=$sha512`n"
$vsCodeHashes["vcpkg-$binary"] = Get-Sha256 "$PSScriptRoot\vcpkg-$binary"
}

# Windows x64 (assumed to be host)
$vsCodeHashes["vcpkg.exe"] = Get-Sha256 "$vcpkg"

# Source
$sourceName = "$Date.tar.gz"
& $vcpkg x-download "$PSScriptRoot\$sourceName" `
"--url=https://github.com/microsoft/vcpkg-tool/archive/refs/tags/$Date.tar.gz" --skip-sha512
$sha512 = & $vcpkg hash "$PSScriptRoot\$sourceName"
$metadata += "VCPKG_TOOL_SOURCE_SHA=$sha512`n"

# Cleanup
Remove-Item @(
"$PSScriptRoot\vcpkg-arm64.exe",
"$PSScriptRoot\vcpkg-macos",
"$PSScriptRoot\vcpkg-muslc",
"$PSScriptRoot\vcpkg-glibc",
"$PSScriptRoot\$sourceName"
)

Set-Content -LiteralPath "$PSScriptRoot\vcpkg-tool-metadata.txt" -Value $metadata -NoNewline -Encoding utf8NoBOM

Write-Host "Metadata Written"
Write-Host "VS Code Block"
$vsCodeOverall = [ordered]@{
version = $Date;
hashes = $vsCodeHashes;
}

Write-Host (ConvertTo-Json $vsCodeOverall)
10 changes: 5 additions & 5 deletions scripts/vcpkg-tool-metadata.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VCPKG_TOOL_RELEASE_TAG=2023-07-19
VCPKG_MACOS_SHA=57a39cf5ba4cea55847995fe748f569c9908c84e9edeab0a8c7a8e80d5bed6e981149172aabbdb1cf458deef74e883fc5b8c9781f6a59b723f8618c6045c2391
VCPKG_MUSLC_SHA=a24c2f06bf4129892e5ae1dafbec692cbdd5483aae101b2a98632a5cc63ac95458943714b1a22072962fcbcb83d08ef37efa65f4b4cf2311b9e7d541c98276ea
VCPKG_GLIBC_SHA=2338c759b14257f0167202886080bc872a6ea2578b27b034d2432b209e99d81e8d37f4a1ce215e5d4875648a89ff5bc9bfb560b824c87163572233262d5581c5
VCPKG_TOOL_SOURCE_SHA=9381e91e457c2efc69cbaad1354b06bb540689e95f86f5c883cfbd6f5f05b5511a92c349b4d0d090a09b4a31197327c559737fb84375a4c23d4cb92049ecf73c
VCPKG_TOOL_RELEASE_TAG=2023-08-02
VCPKG_MACOS_SHA=3698a1bbd3c3d5228d5536c2f6c6a8b98ce99deb0fe55c79b5fc9d1af506350494bea326caa3018afeb7bd794a47d612c949cceb836e4f2c39c2e2bbe7a48dcf
VCPKG_MUSLC_SHA=5b7c2c9e691706c12b0c183b9245f44eb26e3b2b1fb30702b634c86832fdf9afef4bba2f50327b1b95873a8d519fcd0b0a9184d79c3c5f5ba9c2f0b510821313
VCPKG_GLIBC_SHA=d8719c9edc79dd31cf362c6f9bda6b342c42df640cb76d4473eb913af56f8eff9ca5a9753e878e004a0673f588dc76eb3b32e7888f1583a019ed4973e9767379
VCPKG_TOOL_SOURCE_SHA=afb17e1a369450738095ebdddc4618ae5588731b7204132f0f5353793ccd5068d6d39c2a80fb1d3c56119ab4e788e69d80b47dbbacbcd299c5029739d562dbaa

0 comments on commit 1e9cf69

Please sign in to comment.