mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-12 16:53:21 +00:00
chromedriver: Switch to Chromium's upstream-info.json (#105054)
This enables automatic updates and fixes #85629.
This commit is contained in:
parent
33b99efb96
commit
6aea53c3ce
@ -38,6 +38,20 @@ def get_file_revision(revision, file_path):
|
|||||||
with urlopen(url) as http_response:
|
with urlopen(url) as http_response:
|
||||||
return http_response.read()
|
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):
|
def get_channel_dependencies(channel):
|
||||||
deps = get_file_revision(channel['version'], 'DEPS')
|
deps = get_file_revision(channel['version'], 'DEPS')
|
||||||
gn_pattern = b"'gn_version': 'git_revision:([0-9a-f]{40})'"
|
gn_pattern = b"'gn_version': 'git_revision:([0-9a-f]{40})'"
|
||||||
@ -85,6 +99,8 @@ with urlopen(HISTORY_URL) as resp:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
channel['deps'] = get_channel_dependencies(channel)
|
channel['deps'] = get_channel_dependencies(channel)
|
||||||
|
if channel_name == 'stable':
|
||||||
|
channel['chromedriver'] = get_matching_chromedriver(channel['version'])
|
||||||
|
|
||||||
channels[channel_name] = channel
|
channels[channel_name] = channel
|
||||||
|
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
"rev": "e002e68a48d1c82648eadde2f6aafa20d08c36f2",
|
"rev": "e002e68a48d1c82648eadde2f6aafa20d08c36f2",
|
||||||
"sha256": "0x4c7amxwzxs39grqs3dnnz0531mpf1p75niq7zhinyfqm86i4dk"
|
"sha256": "0x4c7amxwzxs39grqs3dnnz0531mpf1p75niq7zhinyfqm86i4dk"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"chromedriver": {
|
||||||
|
"version": "87.0.4280.20",
|
||||||
|
"sha256_linux": "1cpk7mb32z3a7c7cbaaxskpv91il3i8kgsdp2q8zw9w762kql953",
|
||||||
|
"sha256_darwin": "06mx2yk6xy46azvkbyvhqm11prxbh67pfi50fcwxb0zqllbq7scr"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"beta": {
|
"beta": {
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
{ stdenv, fetchurl, cairo, fontconfig, freetype, gdk-pixbuf, glib
|
{ stdenv, fetchurl, unzip, makeWrapper
|
||||||
, glibc, gtk2, libX11, makeWrapper, nspr, nss, pango, unzip, gconf
|
, cairo, fontconfig, freetype, gdk-pixbuf, glib
|
||||||
|
, glibc, gtk2, libX11, nspr, nss, pango, gconf
|
||||||
, libxcb, libXi, libXrender, libXext
|
, libxcb, libXi, libXrender, libXext
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
upstream-info = (stdenv.lib.importJSON ../../../../applications/networking/browsers/chromium/upstream-info.json).stable.chromedriver;
|
||||||
allSpecs = {
|
allSpecs = {
|
||||||
x86_64-linux = {
|
x86_64-linux = {
|
||||||
system = "linux64";
|
system = "linux64";
|
||||||
sha256 = "1cpk7mb32z3a7c7cbaaxskpv91il3i8kgsdp2q8zw9w762kql953";
|
sha256 = upstream-info.sha256_linux;
|
||||||
};
|
};
|
||||||
|
|
||||||
x86_64-darwin = {
|
x86_64-darwin = {
|
||||||
system = "mac64";
|
system = "mac64";
|
||||||
sha256 = "06mx2yk6xy46azvkbyvhqm11prxbh67pfi50fcwxb0zqllbq7scr";
|
sha256 = upstream-info.sha256_darwin;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -25,10 +28,10 @@ let
|
|||||||
libX11 nspr nss pango libXrender
|
libX11 nspr nss pango libXrender
|
||||||
gconf libxcb libXext libXi
|
gconf libxcb libXext libXi
|
||||||
];
|
];
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
pname = "chromedriver";
|
pname = "chromedriver";
|
||||||
version = "87.0.4280.20";
|
version = upstream-info.version;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://chromedriver.storage.googleapis.com/${version}/chromedriver_${spec.system}.zip";
|
url = "https://chromedriver.storage.googleapis.com/${version}/chromedriver_${spec.system}.zip";
|
||||||
@ -47,10 +50,18 @@ stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
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";
|
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;
|
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;
|
platforms = attrNames allSpecs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user