1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 20:21:14 +00:00

chromium/updater: Allow a single plugin arch

Until now, if we have a failure to fetch either the 32bit Debian package
or the 64bit Debian package, neither of these will be put into
sources.nix.

Unfortunately the beta/dev channels do not have a 32bit Debian package,
so even though there is a 64bit Debian package available we don't get
plugins *at* *all*.

This also introduces a nicer error message rather than just failing with
an assertion in fetchurl because we did not provide url/urls.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2016-02-26 10:47:04 +01:00
parent 20682386ca
commit 459642b8de
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961
2 changed files with 23 additions and 14 deletions

View file

@ -62,14 +62,18 @@ in rec {
pname = if channel == "dev"
then "google-chrome-unstable"
else "google-chrome-${channel}";
arch = if stdenv.is64bit then "amd64" else "i386";
relpath = "${pname}/${pname}_${chanAttrs.version}-1_${arch}.deb";
in lib.optionalAttrs (chanAttrs ? sha256bin64) {
urls = map (url: "${url}/${relpath}") ([ debURL ] ++ debMirrors);
sha256 = if stdenv.is64bit
then chanAttrs.sha256bin64
else chanAttrs.sha256bin32;
};
mkUrls = arch: let
relpath = "${pname}/${pname}_${chanAttrs.version}-1_${arch}.deb";
in map (url: "${url}/${relpath}") ([ debURL ] ++ debMirrors);
in if stdenv.is64bit && chanAttrs ? sha256bin64 then {
urls = mkUrls "amd64";
sha256 = chanAttrs.sha256bin64;
} else if stdenv.is32bit && chanAttrs ? sha256bin32 then {
urls = mkUrls "i386";
sha256 = chanAttrs.sha256bin64;
} else throw "No Chrome plugins are available for your architecture.";
};
updateHelpers = writeText "update-helpers.sh" ''
@ -91,11 +95,15 @@ in rec {
deb_pre="${debURL}/$pname/$pname";
deb32=$(nix-prefetch-url "''${deb_pre}_$version-1_i386.deb");
deb64=$(nix-prefetch-url "''${deb_pre}_$version-1_amd64.deb");
deb32="$(nix-prefetch-url "''${deb_pre}_$version-1_i386.deb")" || :
deb64="$(nix-prefetch-url "''${deb_pre}_$version-1_amd64.deb")" || :
echo "$deb32.$deb64";
return 0;
if [ -n "$deb32" -o -n "$deb64" ]; then
echo "$deb32.$deb64";
return 0
else
return 1
fi
}
prefetch_sha()

View file

@ -77,9 +77,10 @@ get_channel_exprs()
echo " $channel = {";
echo " version = \"$version\";";
echo " sha256 = \"$main\";";
if [ "x${deb#*[a-z0-9].[a-z0-9]}" != "x$deb" ];
then
if [ "x${deb#[a-z0-9]}" != "x$deb" ]; then
echo " sha256bin32 = \"$deb32\";";
fi;
if [ "x${deb#*.[a-z0-9]}" != "x$deb" ]; then
echo " sha256bin64 = \"$deb64\";";
fi;
echo " };";