[tools] Fix update-vscode.sh again

It looks like the server-provided information changed back to what
it was before crrev.com/c/4023861, but rather than just revert that,
this patch makes the logic in our script even more robust.

No-Try: true
Change-Id: I9d60b1c61f85d9bde1275695dbd18c62fa4569bf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4080387
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84656}
This commit is contained in:
Jakob Kummerow 2022-12-05 15:50:07 +01:00 committed by V8 LUCI CQ
parent 7136ea89d2
commit 7545b49288

View File

@ -31,11 +31,20 @@ if [ "$VERSION" == "--auto" -o "$VERSION" == "auto" ]; then
AVAILABLE_PACKAGES_URL="https://packages.microsoft.com/repos/vscode/dists/stable/main/binary-amd64/Packages.gz"
VERSION=$(curl "$AVAILABLE_PACKAGES_URL" --silent \
| gunzip \
| grep -A1 "Package: code$" \
| grep "^Version: " \
| gawk '
BEGIN { engaged = 0 }
# Look at blocks starting with "Package: code".
/^Package: code$/ { engaged = 1 }
# Stop looking at the empty line indicating the end of a block.
/^$/ { engaged = 0 }
# In interesting blocks, print the relevant part of the
# "Version: " line.
match($0, /^Version: ([0-9.]*)/, groups) {
if (engaged == 1) print groups[1]
}
' - \
| sort -rV \
| head -1 \
| sed 's/[^0-9]*\([0-9.]*\).*/\1/')
| head -1)
if [ -z "$VERSION" ]; then
die "Detecting latest version failed, please specify it manually."
else