androidenv: fingerprint latest versions (#452515)

This commit is contained in:
numinit
2025-11-01 04:36:36 +00:00
committed by GitHub
3 changed files with 743 additions and 559 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,7 @@ let
in
stdenv.mkDerivation {
name = "androidenv-test-suite";
version = lib.substring 0 8 (builtins.hashFile "sha256" ./repo.json);
version = (lib.importJSON ./repo.json).latest.fingerprint or "0000000000000000";
buildInputs = lib.attrValues all-tests;
buildCommand = ''

View File

@@ -2,6 +2,7 @@
#!nix-shell -i ruby -p "ruby.withPackages (ps: with ps; [ slop curb nokogiri ])"
require 'json'
require 'digest'
require 'rubygems'
require 'shellwords'
require 'erb'
@@ -560,11 +561,15 @@ fixup_result = fixup(result)
# Regular installation of Android SDK would keep the previously installed packages even if they are not
# in the uptodate XML files, so here we try to support this logic by keeping un-available packages,
# therefore the old packages will work as long as the links are working on the Google servers.
output = merge input, fixup_result
output = sort_recursively(merge(input, fixup_result))
# Fingerprint the latest versions.
fingerprint = Digest::SHA256.hexdigest(output['latest'].tap {_1.delete 'fingerprint'}.to_json)[0...16]
output['latest']['fingerprint'] = fingerprint
# Write the repository. Append a \n to keep nixpkgs Github Actions happy.
STDERR.puts "Writing #{opts[:output]}"
File.write opts[:output], (JSON.pretty_generate(sort_recursively(output)) + "\n")
File.write opts[:output], (JSON.pretty_generate(output) + "\n")
# Output metadata for the nixpkgs update script.
if ENV['UPDATE_NIX_ATTR_PATH']
@@ -578,7 +583,7 @@ if ENV['UPDATE_NIX_ATTR_PATH']
cur_latest.each do |k, v|
prev = prev_latest[k]
if prev && prev != v
if k != 'fingerprint' && prev && prev != v
old_versions << "#{k}:#{prev}"
new_versions << "#{k}:#{v}"
changes << "#{k}: #{prev} -> #{v}"