[tools] Fix update-vscode.sh

Apparently the server-provided information changed, so we need to
work a little harder to find the latest release.

No-Try: true
Change-Id: Idc030fb648e39039175133dc0cb052c296193b94
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4023861
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84263}
This commit is contained in:
Jakob Kummerow 2022-11-14 17:14:36 +01:00 committed by V8 LUCI CQ
parent 2c5faac922
commit 51b1c9f76f

View File

@ -7,7 +7,7 @@
# Visual Studio Code on Linux distributions where for whatever reason there
# is no good way to do so via the package manager.
# Version of this script: 2020.07.04
# Version of this script: 2022.11.12
# Basic checking of arguments: want at least one, and it's not --help.
VERSION="$1"
@ -27,11 +27,14 @@ die() {
if [ "$VERSION" == "--auto" -o "$VERSION" == "auto" ]; then
echo "Searching online for latest available version..."
# Where to find the latest available version (we assume that it's mentioned
# in the first 1000 characters, which is true as of 2020-07).
AVAILABLE_PACKAGES_URL="https://packages.microsoft.com/repos/vscode/dists/stable/main/binary-amd64/Packages"
VERSION=$(curl "$AVAILABLE_PACKAGES_URL" --range 0-1000 --silent \
# Where to find the latest available version.
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: " \
| sort -rV \
| head -1 \
| sed 's/[^0-9]*\([0-9.]*\).*/\1/')
if [ -z "$VERSION" ]; then
die "Detecting latest version failed, please specify it manually."