crosvm.updateScript: update for new serving dash

The old dashboard no longer exists.  Currently, the platform version
being served doesn't exist in manifest versions, but that was also a
problem we had before sometimes.
This commit is contained in:
Alyssa Ross 2022-05-16 11:45:59 +00:00
parent 931ae3ee7b
commit acdfec904d

View file

@ -3,13 +3,12 @@
#! nix-shell -i python #! nix-shell -i python
import base64 import base64
import csv
import json import json
import re import re
import shlex import shlex
import subprocess import subprocess
from os.path import abspath, dirname, splitext from os.path import abspath, dirname, splitext
from lxml import etree
from lxml.etree import HTMLParser
from urllib.request import urlopen from urllib.request import urlopen
git_path = 'chromiumos/platform/crosvm' git_path = 'chromiumos/platform/crosvm'
@ -25,19 +24,22 @@ buildspecs_url = f'{manifest_versions}/+/refs/heads/master/full/buildspecs/'
# branch branches are used for fixes for specific devices. So for # branch branches are used for fixes for specific devices. So for
# Chromium OS they will always be 0. This is a best guess, and is not # Chromium OS they will always be 0. This is a best guess, and is not
# documented. # documented.
with urlopen('https://cros-updates-serving.appspot.com/') as resp: with urlopen('https://chromiumdash.appspot.com/cros/download_serving_builds_csv?deviceCategory=ChromeOS') as resp:
document = etree.parse(resp, HTMLParser()) reader = csv.reader(map(bytes.decode, resp))
# bgcolor="lightgreen" is set on the most up-to-date version for header = reader.__next__()
# each channel, so find a lightgreen cell in the "Stable" column. cr_stable_index = header.index('cr_stable')
(platform_version, chrome_version) = document.xpath(""" cros_stable_index = header.index('cros_stable')
(//table[@id="cros-updates"]/tr/td[1 + count( chrome_version = []
//table[@id="cros-updates"]/thead/tr[1]/th[text() = "Stable"] platform_version = []
/preceding-sibling::*)
][@bgcolor="lightgreen"])[1]/text()
""")
chrome_major_version = re.match(r'\d+', chrome_version)[0] for line in reader:
chromeos_tip_build = re.match(r'\d+', platform_version)[0] this_chrome_version = list(map(int, line[cr_stable_index].split('.')))
this_platform_version = list(map(int, line[cros_stable_index].split('.')))
chrome_version = max(chrome_version, this_chrome_version)
platform_version = max(platform_version, this_platform_version)
chrome_major_version = chrome_version[0]
chromeos_tip_build = str(platform_version[0])
# Find the most recent buildspec for the stable Chrome version and # Find the most recent buildspec for the stable Chrome version and
# Chromium OS build number. Its branch build and branch branch build # Chromium OS build number. Its branch build and branch branch build