crosvm.updateScript: stop trying manifest-versions
manifest-versions never seems to contain the release build any more, so we can't use it to find the version of crosvm being served to CrOS devices. Instead, I've changed the update script to take the latest version of the appropriate crosvm Chrome OS release branch. This is the branch that gets served. Every release, it is branched off from the "chromeos" branch (which is the one that passes Chrome OS QA), and then collects any critical fixes over the lifetime of the release. With this change, I've introduced a new, simplified versioning scheme, e.g. 100.0. The tip build is always 1:1 with the Chrome version, so having both of those is redundant. The other number is the number of commits that have been added to the release branch after branching from the chromeos branch, so that the number will go up if we update to include a new commit from the same release.
This commit is contained in:
parent
acdfec904d
commit
c01c68bf1c
2 changed files with 11 additions and 30 deletions
|
@ -55,7 +55,7 @@ in
|
|||
|
||||
meta = with lib; {
|
||||
description = "A secure virtual machine monitor for KVM";
|
||||
homepage = "https://chromium.googlesource.com/chromiumos/platform/crosvm/";
|
||||
homepage = "https://chromium.googlesource.com/crosvm/crosvm/";
|
||||
maintainers = with maintainers; [ qyliss ];
|
||||
license = licenses.bsd3;
|
||||
platforms = [ "aarch64-linux" "x86_64-linux" ];
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -p nix-prefetch-git "python3.withPackages (ps: with ps; [ lxml ])"
|
||||
#! nix-shell -p nix-prefetch-git python3
|
||||
#! nix-shell -i python
|
||||
|
||||
import base64
|
||||
import csv
|
||||
import json
|
||||
import re
|
||||
|
@ -13,8 +12,6 @@ from urllib.request import urlopen
|
|||
|
||||
git_path = 'chromiumos/platform/crosvm'
|
||||
git_root = 'https://chromium.googlesource.com/'
|
||||
manifest_versions = f'{git_root}chromiumos/manifest-versions'
|
||||
buildspecs_url = f'{manifest_versions}/+/refs/heads/master/full/buildspecs/'
|
||||
|
||||
# CrOS version numbers look like this:
|
||||
# [<chrome-major-version>.]<tip-build>.<branch-build>.<branch-branch-build>
|
||||
|
@ -39,38 +36,22 @@ with urlopen('https://chromiumdash.appspot.com/cros/download_serving_builds_csv?
|
|||
platform_version = max(platform_version, this_platform_version)
|
||||
|
||||
chrome_major_version = chrome_version[0]
|
||||
chromeos_tip_build = str(platform_version[0])
|
||||
chromeos_tip_build = platform_version[0]
|
||||
release_branch = f'release-R{chrome_major_version}-{chromeos_tip_build}.B-chromeos'
|
||||
|
||||
# Find the most recent buildspec for the stable Chrome version and
|
||||
# Chromium OS build number. Its branch build and branch branch build
|
||||
# numbers will (almost?) certainly be 0. It will then end with an rc
|
||||
# number -- presumably these are release candidates, one of which
|
||||
# becomes the final release. Presumably the one with the highest rc
|
||||
# number.
|
||||
with urlopen(f'{buildspecs_url}{chrome_major_version}/?format=TEXT') as resp:
|
||||
listing = base64.decodebytes(resp.read()).decode('utf-8')
|
||||
buildspecs = [(line.split('\t', 1)[1]) for line in listing.splitlines()]
|
||||
buildspecs = [s for s in buildspecs if s.startswith(f"{chromeos_tip_build}.")]
|
||||
buildspecs.sort(reverse=True)
|
||||
buildspec = splitext(buildspecs[0])[0]
|
||||
|
||||
# Read the buildspec, and extract the git revision.
|
||||
with urlopen(f'{buildspecs_url}{chrome_major_version}/{buildspec}.xml?format=TEXT') as resp:
|
||||
xml = base64.decodebytes(resp.read())
|
||||
root = etree.fromstring(xml)
|
||||
revision = root.find(f'./project[@name="{git_path}"]').get('revision')
|
||||
|
||||
# Initialize the data that will be output from this script. Leave the
|
||||
# rc number in buildspec so nobody else is subject to the same level
|
||||
# of confusion I have been.
|
||||
data = {'version': f'{chrome_major_version}.{buildspec}'}
|
||||
# Determine the patch version by counting the commits that have been
|
||||
# added to the release branch since it forked off the chromeos branch.
|
||||
with urlopen(f'https://chromium.googlesource.com/chromiumos/platform/crosvm/+log/refs/heads/chromeos..refs/heads/{release_branch}?format=JSON') as resp:
|
||||
resp.readline() # Remove )]}' header
|
||||
branch_commits = json.load(resp)['log']
|
||||
data = {'version': f'{chrome_major_version}.{len(branch_commits)}'}
|
||||
|
||||
# Fill in the 'src' key with the output from nix-prefetch-git, which
|
||||
# can be passed straight to fetchGit when imported by Nix.
|
||||
argv = ['nix-prefetch-git',
|
||||
'--fetch-submodules',
|
||||
'--url', git_root + git_path,
|
||||
'--rev', revision]
|
||||
'--rev', f'refs/heads/{release_branch}']
|
||||
output = subprocess.check_output(argv)
|
||||
data['src'] = json.loads(output.decode('utf-8'))
|
||||
|
||||
|
|
Loading…
Reference in a new issue