chromedriver: Switch to Chromium's upstream-info.json (#105054)

This enables automatic updates and fixes #85629.
This commit is contained in:
Michael Weiss 2020-11-27 12:38:07 +01:00 committed by GitHub
parent 33b99efb96
commit 6aea53c3ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 9 deletions

View File

@ -38,6 +38,20 @@ def get_file_revision(revision, file_path):
with urlopen(url) as http_response:
return http_response.read()
def get_matching_chromedriver(version):
# See https://chromedriver.chromium.org/downloads/version-selection
build = re.sub('.[0-9]+$', '', version)
chromedriver_version_url = f'https://chromedriver.storage.googleapis.com/LATEST_RELEASE_{build}'
with urlopen(chromedriver_version_url) as http_response:
chromedriver_version = http_response.read().decode()
def get_chromedriver_url(system):
return f'https://chromedriver.storage.googleapis.com/{chromedriver_version}/chromedriver_{system}.zip'
return {
'version': chromedriver_version,
'sha256_linux': nix_prefetch_url(get_chromedriver_url('linux64')),
'sha256_darwin': nix_prefetch_url(get_chromedriver_url('mac64'))
}
def get_channel_dependencies(channel):
deps = get_file_revision(channel['version'], 'DEPS')
gn_pattern = b"'gn_version': 'git_revision:([0-9a-f]{40})'"
@ -85,6 +99,8 @@ with urlopen(HISTORY_URL) as resp:
continue
channel['deps'] = get_channel_dependencies(channel)
if channel_name == 'stable':
channel['chromedriver'] = get_matching_chromedriver(channel['version'])
channels[channel_name] = channel

View File

@ -10,6 +10,11 @@
"rev": "e002e68a48d1c82648eadde2f6aafa20d08c36f2",
"sha256": "0x4c7amxwzxs39grqs3dnnz0531mpf1p75niq7zhinyfqm86i4dk"
}
},
"chromedriver": {
"version": "87.0.4280.20",
"sha256_linux": "1cpk7mb32z3a7c7cbaaxskpv91il3i8kgsdp2q8zw9w762kql953",
"sha256_darwin": "06mx2yk6xy46azvkbyvhqm11prxbh67pfi50fcwxb0zqllbq7scr"
}
},
"beta": {

View File

@ -1,17 +1,20 @@
{ stdenv, fetchurl, cairo, fontconfig, freetype, gdk-pixbuf, glib
, glibc, gtk2, libX11, makeWrapper, nspr, nss, pango, unzip, gconf
{ stdenv, fetchurl, unzip, makeWrapper
, cairo, fontconfig, freetype, gdk-pixbuf, glib
, glibc, gtk2, libX11, nspr, nss, pango, gconf
, libxcb, libXi, libXrender, libXext
}:
let
upstream-info = (stdenv.lib.importJSON ../../../../applications/networking/browsers/chromium/upstream-info.json).stable.chromedriver;
allSpecs = {
x86_64-linux = {
system = "linux64";
sha256 = "1cpk7mb32z3a7c7cbaaxskpv91il3i8kgsdp2q8zw9w762kql953";
sha256 = upstream-info.sha256_linux;
};
x86_64-darwin = {
system = "mac64";
sha256 = "06mx2yk6xy46azvkbyvhqm11prxbh67pfi50fcwxb0zqllbq7scr";
sha256 = upstream-info.sha256_darwin;
};
};
@ -25,10 +28,10 @@ let
libX11 nspr nss pango libXrender
gconf libxcb libXext libXi
];
in
stdenv.mkDerivation rec {
in stdenv.mkDerivation rec {
pname = "chromedriver";
version = "87.0.4280.20";
version = upstream-info.version;
src = fetchurl {
url = "https://chromedriver.storage.googleapis.com/${version}/chromedriver_${spec.system}.zip";
@ -47,10 +50,18 @@ stdenv.mkDerivation rec {
'';
meta = with stdenv.lib; {
homepage = "https://sites.google.com/a/chromium.org/chromedriver";
homepage = "https://chromedriver.chromium.org/";
description = "A WebDriver server for running Selenium tests on Chrome";
longDescription = ''
WebDriver is an open source tool for automated testing of webapps across
many browsers. It provides capabilities for navigating to web pages, user
input, JavaScript execution, and more. ChromeDriver is a standalone
server that implements the W3C WebDriver standard.
'';
license = licenses.bsd3;
maintainers = [ maintainers.goibhniu maintainers.marsam ];
maintainers = with maintainers; [ goibhniu marsam primeos ];
# Note from primeos: By updating Chromium I also update Google Chrome and
# ChromeDriver.
platforms = attrNames allSpecs;
};
}