about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/virtualization/crosvm/default.nix2
-rwxr-xr-xpkgs/applications/virtualization/crosvm/update.py39
2 files changed, 11 insertions, 30 deletions
diff --git a/pkgs/applications/virtualization/crosvm/default.nix b/pkgs/applications/virtualization/crosvm/default.nix
index 68ba3b56e2ca..d71443c9b384 100644
--- a/pkgs/applications/virtualization/crosvm/default.nix
+++ b/pkgs/applications/virtualization/crosvm/default.nix
@@ -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" ];
diff --git a/pkgs/applications/virtualization/crosvm/update.py b/pkgs/applications/virtualization/crosvm/update.py
index 24185b327812..be9de54031b2 100755
--- a/pkgs/applications/virtualization/crosvm/update.py
+++ b/pkgs/applications/virtualization/crosvm/update.py
@@ -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'))