diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-08-05 11:42:30 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-08-12 07:55:09 +0000 |
commit | 290039f8cd769fe0daf073e8e87b9a6a75420a4a (patch) | |
tree | e3a1f395fcd3b3a8d3afd29e8ef57a471cc8bc10 /pkgs/applications/virtualization | |
parent | 7f4172608ec8e0d535dd18ef53c3ae94d8281340 (diff) |
crosvm: get rid of upstream-info.json
This was important when building crosvm required assembling our own build tree from lots of different repositories, but now that they've moved to submodules, it's overly complicated and needlessly inconsistent with the rest of Nixpkgs.
Diffstat (limited to 'pkgs/applications/virtualization')
-rw-r--r-- | pkgs/applications/virtualization/crosvm/default.nix | 13 | ||||
-rwxr-xr-x | pkgs/applications/virtualization/crosvm/update.py | 30 | ||||
-rw-r--r-- | pkgs/applications/virtualization/crosvm/upstream-info.json | 14 |
3 files changed, 19 insertions, 38 deletions
diff --git a/pkgs/applications/virtualization/crosvm/default.nix b/pkgs/applications/virtualization/crosvm/default.nix index 2611868a06302..2a5a8c0b97c28 100644 --- a/pkgs/applications/virtualization/crosvm/default.nix +++ b/pkgs/applications/virtualization/crosvm/default.nix @@ -3,15 +3,16 @@ , libcap, libdrm, libepoxy, minijail, virglrenderer, wayland, wayland-protocols }: -let - upstreamInfo = with builtins; fromJSON (readFile ./upstream-info.json); -in - rustPlatform.buildRustPackage rec { pname = "crosvm"; - inherit (upstreamInfo) version; + version = "103.3"; - src = fetchgit (builtins.removeAttrs upstreamInfo.src [ "date" "path" ]); + src = fetchgit { + url = "https://chromium.googlesource.com/crosvm/crosvm"; + rev = "e7db3a5cc78ca90ab06aadd5f08bb151090269b6"; + sha256 = "0hyz0mg5fn6hi97awfpxfykgv68m935r037sdf85v3vcwjy5n5ki"; + fetchSubmodules = true; + }; separateDebugInfo = true; diff --git a/pkgs/applications/virtualization/crosvm/update.py b/pkgs/applications/virtualization/crosvm/update.py index 825b7b0bb2398..d912c49078c68 100755 --- a/pkgs/applications/virtualization/crosvm/update.py +++ b/pkgs/applications/virtualization/crosvm/update.py @@ -1,5 +1,5 @@ #! /usr/bin/env nix-shell -#! nix-shell -p nix-prefetch-git python3 +#! nix-shell -p common-updater-scripts python3 #! nix-shell -i python import csv @@ -36,33 +36,27 @@ chrome_major_version = chrome_version[0] chromeos_tip_build = platform_version[0] release_branch = f'release-R{chrome_major_version}-{chromeos_tip_build}.B-chromeos' +# Determine the git revision. +with urlopen(f'https://chromium.googlesource.com/chromiumos/platform/crosvm/+/refs/heads/{release_branch}?format=JSON') as resp: + resp.readline() # Remove )]}' header + rev = json.load(resp)['commit'] + # 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: +with urlopen(f'https://chromium.googlesource.com/chromiumos/platform/crosvm/+log/refs/heads/chromeos..{rev}?format=JSON') as resp: resp.readline() # Remove )]}' header branch_commits = json.load(resp)['log'] - data = {'version': f'{chrome_major_version}.{len(branch_commits)}'} + 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', 'https://chromium.googlesource.com/crosvm/crosvm', - '--rev', f'refs/heads/{release_branch}'] -output = subprocess.check_output(argv) -data['src'] = json.loads(output.decode('utf-8')) +# Update the version, git revision, and hash in crosvm's default.nix. +subprocess.run(['update-source-version', 'crosvm', f'--rev={rev}', version]) -# Find the path to crosvm's default.nix, so the src data can be -# written into the same directory. +# Find the path to crosvm's default.nix, so Cargo.lock can be written +# into the same directory. argv = ['nix-instantiate', '--eval', '--json', '-A', 'crosvm.meta.position'] position = json.loads(subprocess.check_output(argv).decode('utf-8')) filename = re.match(r'[^:]*', position)[0] -# Write the output. -with open(dirname(filename) + '/upstream-info.json', 'w') as out: - json.dump(data, out, indent=2) - out.write('\n') - # Generate a Cargo.lock run = ['.', dirname(abspath(__file__)) + '/generate-cargo.sh', diff --git a/pkgs/applications/virtualization/crosvm/upstream-info.json b/pkgs/applications/virtualization/crosvm/upstream-info.json deleted file mode 100644 index 8472e854e5996..0000000000000 --- a/pkgs/applications/virtualization/crosvm/upstream-info.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "103.3", - "src": { - "url": "https://chromium.googlesource.com/crosvm/crosvm", - "rev": "e7db3a5cc78ca90ab06aadd5f08bb151090269b6", - "date": "2022-06-01T00:13:12+00:00", - "path": "/nix/store/r08jyffmjdq38f8yy57v8wgfjiil6586-crosvm", - "sha256": "0hyz0mg5fn6hi97awfpxfykgv68m935r037sdf85v3vcwjy5n5ki", - "fetchLFS": false, - "fetchSubmodules": true, - "deepClone": false, - "leaveDotGit": false - } -} |