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.

+11 -30
+1 -1
pkgs/applications/virtualization/crosvm/default.nix
··· 55 56 meta = with lib; { 57 description = "A secure virtual machine monitor for KVM"; 58 - homepage = "https://chromium.googlesource.com/chromiumos/platform/crosvm/"; 59 maintainers = with maintainers; [ qyliss ]; 60 license = licenses.bsd3; 61 platforms = [ "aarch64-linux" "x86_64-linux" ];
··· 55 56 meta = with lib; { 57 description = "A secure virtual machine monitor for KVM"; 58 + homepage = "https://chromium.googlesource.com/crosvm/crosvm/"; 59 maintainers = with maintainers; [ qyliss ]; 60 license = licenses.bsd3; 61 platforms = [ "aarch64-linux" "x86_64-linux" ];
+10 -29
pkgs/applications/virtualization/crosvm/update.py
··· 1 #! /usr/bin/env nix-shell 2 - #! nix-shell -p nix-prefetch-git "python3.withPackages (ps: with ps; [ lxml ])" 3 #! nix-shell -i python 4 5 - import base64 6 import csv 7 import json 8 import re ··· 13 14 git_path = 'chromiumos/platform/crosvm' 15 git_root = 'https://chromium.googlesource.com/' 16 - manifest_versions = f'{git_root}chromiumos/manifest-versions' 17 - buildspecs_url = f'{manifest_versions}/+/refs/heads/master/full/buildspecs/' 18 19 # CrOS version numbers look like this: 20 # [<chrome-major-version>.]<tip-build>.<branch-build>.<branch-branch-build> ··· 39 platform_version = max(platform_version, this_platform_version) 40 41 chrome_major_version = chrome_version[0] 42 - chromeos_tip_build = str(platform_version[0]) 43 44 - # Find the most recent buildspec for the stable Chrome version and 45 - # Chromium OS build number. Its branch build and branch branch build 46 - # numbers will (almost?) certainly be 0. It will then end with an rc 47 - # number -- presumably these are release candidates, one of which 48 - # becomes the final release. Presumably the one with the highest rc 49 - # number. 50 - with urlopen(f'{buildspecs_url}{chrome_major_version}/?format=TEXT') as resp: 51 - listing = base64.decodebytes(resp.read()).decode('utf-8') 52 - buildspecs = [(line.split('\t', 1)[1]) for line in listing.splitlines()] 53 - buildspecs = [s for s in buildspecs if s.startswith(f"{chromeos_tip_build}.")] 54 - buildspecs.sort(reverse=True) 55 - buildspec = splitext(buildspecs[0])[0] 56 - 57 - # Read the buildspec, and extract the git revision. 58 - with urlopen(f'{buildspecs_url}{chrome_major_version}/{buildspec}.xml?format=TEXT') as resp: 59 - xml = base64.decodebytes(resp.read()) 60 - root = etree.fromstring(xml) 61 - revision = root.find(f'./project[@name="{git_path}"]').get('revision') 62 - 63 - # Initialize the data that will be output from this script. Leave the 64 - # rc number in buildspec so nobody else is subject to the same level 65 - # of confusion I have been. 66 - data = {'version': f'{chrome_major_version}.{buildspec}'} 67 68 # Fill in the 'src' key with the output from nix-prefetch-git, which 69 # can be passed straight to fetchGit when imported by Nix. 70 argv = ['nix-prefetch-git', 71 '--fetch-submodules', 72 '--url', git_root + git_path, 73 - '--rev', revision] 74 output = subprocess.check_output(argv) 75 data['src'] = json.loads(output.decode('utf-8')) 76
··· 1 #! /usr/bin/env nix-shell 2 + #! nix-shell -p nix-prefetch-git python3 3 #! nix-shell -i python 4 5 import csv 6 import json 7 import re ··· 12 13 git_path = 'chromiumos/platform/crosvm' 14 git_root = 'https://chromium.googlesource.com/' 15 16 # CrOS version numbers look like this: 17 # [<chrome-major-version>.]<tip-build>.<branch-build>.<branch-branch-build> ··· 36 platform_version = max(platform_version, this_platform_version) 37 38 chrome_major_version = chrome_version[0] 39 + chromeos_tip_build = platform_version[0] 40 + release_branch = f'release-R{chrome_major_version}-{chromeos_tip_build}.B-chromeos' 41 42 + # Determine the patch version by counting the commits that have been 43 + # added to the release branch since it forked off the chromeos branch. 44 + with urlopen(f'https://chromium.googlesource.com/chromiumos/platform/crosvm/+log/refs/heads/chromeos..refs/heads/{release_branch}?format=JSON') as resp: 45 + resp.readline() # Remove )]}' header 46 + branch_commits = json.load(resp)['log'] 47 + data = {'version': f'{chrome_major_version}.{len(branch_commits)}'} 48 49 # Fill in the 'src' key with the output from nix-prefetch-git, which 50 # can be passed straight to fetchGit when imported by Nix. 51 argv = ['nix-prefetch-git', 52 '--fetch-submodules', 53 '--url', git_root + git_path, 54 + '--rev', f'refs/heads/{release_branch}'] 55 output = subprocess.check_output(argv) 56 data['src'] = json.loads(output.decode('utf-8')) 57