treewide platform checks: abort -> throw

They aren't meant to be critical (uncatchable) errors.
Tested with nix-env + checkMeta:
[ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
This commit is contained in:
Vladimír Čunát 2017-12-06 00:06:43 +01:00 committed by Graham Christensen
parent 76bf375a16
commit 3a110ea3f9
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
21 changed files with 30 additions and 25 deletions

View file

@ -22,7 +22,7 @@ let
else if stdenv.system == "i686-linux" then
"x86"
else
abort "Unsupported platform";
throw "Unsupported platform ${stdenv.system}";
in
stdenv.mkDerivation rec {

View file

@ -6,7 +6,7 @@ let
arch =
if stdenv.system == "x86_64-linux" then "amd64"
else if stdenv.system == "i686-linux" then "i386"
else abort "Unsupported architecture";
else throw "Unsupported system ${stdenv.system}";
sha256 =
if arch == "amd64"
then "0dwnppn5snl5bwkdrgj4cyylnhngi0g66fn2k41j3dvis83x24k6"

View file

@ -48,7 +48,7 @@ let
ld32 =
if stdenv.system == "x86_64-linux" then "${stdenv.cc}/nix-support/dynamic-linker-m32"
else if stdenv.system == "i686-linux" then "${stdenv.cc}/nix-support/dynamic-linker"
else abort "Unsupported platform for PlayOnLinux: ${stdenv.system}";
else throw "Unsupported platform for PlayOnLinux: ${stdenv.system}";
ld64 = "${stdenv.cc}/nix-support/dynamic-linker";
libs = pkgs: stdenv.lib.makeLibraryPath [ pkgs.xlibs.libX11 ];

View file

@ -4,8 +4,9 @@ let
arch = {
"x86_64-linux" = "x64";
"i686-linux" = "i386";
}.${stdenv.system};
}.${stdenv.system} or throwSystem;
libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.libc ];
throwSystem = throw "Unsupported system: ${stdenv.system}";
in
stdenv.mkDerivation rec {
@ -19,7 +20,7 @@ stdenv.mkDerivation rec {
"https://download-cdn.getsync.com/${version}/linux-${arch}/BitTorrent-Sync_${arch}.tar.gz"
"http://syncapp.bittorrent.com/${version}/btsync_${arch}-${version}.tar.gz"
];
sha256 = sha256s.${stdenv.system};
sha256 = sha256s.${stdenv.system} or throwSystem;
};
dontStrip = true; # Don't strip, otherwise patching the rpaths breaks

View file

@ -4,7 +4,7 @@ let
ld32 =
if stdenv.system == "i686-linux" then "${stdenv.cc}/nix-support/dynamic-linker"
else if stdenv.system == "x86_64-linux" then "${stdenv.cc}/nix-support/dynamic-linker-m32"
else abort "Unsupported architecture";
else throw "Unsupported system ${stdenv.system}";
ld64 = "${stdenv.cc}/nix-support/dynamic-linker";
mkLdPath = ps: lib.makeLibraryPath (with ps; [ qt4 dbus alsaLib ]);

View file

@ -4,7 +4,7 @@ let
arch = {
"x86_64-linux" = "x64";
"i686-linux" = "i386";
}.${stdenv.system};
}.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.libc ];
in stdenv.mkDerivation rec {

View file

@ -8,13 +8,15 @@ let
x86_64-linux = "1hxlavcxy374yypfamlkygjg662lhll8j434qcvdawkvlidg5ii5";
x86_64-darwin = "1jkvhh710gwjnnjx59kaplx2ncfvkx9agfa76rr94sbjqq4igddm";
};
hash = hashes. ${system} or (throw "missing bootstrap hash for platform ${system}");
hash = hashes. ${system} or badSystem;
badSystem = throw "missing bootstrap hash for platform ${system}";
platforms = {
x86_64-linux = "x86_64-unknown-linux-musl";
x86_64-darwin = "x86_64-apple-darwin";
};
platform = platforms . ${system};
platform = platforms . ${system} or badSystem;
in stdenv.mkDerivation {
name = "cargo-vendor-${version}";

View file

@ -16,7 +16,7 @@ let drv = stdenv.mkDerivation rec {
sha256 = "1768f02i3dxdbxn8n29d522h8v0mkgnhpb8ixzq5p54vwjmfl6md";
}
else
abort "unsupported system: ${stdenv.system}";
throw "unsupported system: ${stdenv.system}";
nativeBuildInputs = [ file ];

View file

@ -44,7 +44,7 @@ assert stdenv.system == "i686-linux"
assert swingSupport -> xorg != null;
let
abortArch = abort "jdk requires i686-linux, x86_64-linux, aarch64-linux or armv7l-linux";
abortArch = throw "Unsupported system: ${stdenv.system}";
/**
* The JRE libraries are in directories that depend on the CPU.

View file

@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
platform =
if stdenv.isLinux then "linux"
else if stdenv.isDarwin then "macosx"
else abort "unrecognized platform";
else throw "unrecognized system ${stdenv.system}";
buildInputs = [ premake4 ];

View file

@ -9,7 +9,7 @@ let
"macosx"
else if stdenv.system == "aarch64-linux" then
"linux-arm"
else abort "Platform ${stdenv.system} not yet supported.";
else throw "Platform ${stdenv.system} not yet supported.";
in
stdenv.mkDerivation rec {

View file

@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
sha256 = "1skx2pfnic7pyss7c69qb7kg2xvflpxf112xkf9awk516dw1w4h7";
}
else
abort "Saleae Logic software requires i686-linux or x86_64-linux";
throw "Saleae Logic software requires i686-linux or x86_64-linux";
desktopItem = makeDesktopItem {
name = "saleae-logic";

View file

@ -3,7 +3,7 @@
let
platform =
if lib.elem stdenv.system lib.platforms.unix then "unix"
else abort "Unknown platform for NetHack";
else throw "Unknown platform for NetHack: ${stdenv.system}";
unixHint =
if stdenv.isLinux then "linux"
else if stdenv.isDarwin then "macosx10.10"

View file

@ -6,7 +6,7 @@ let
self = rec {
steamArch = if pkgs.stdenv.system == "x86_64-linux" then "amd64"
else if pkgs.stdenv.system == "i686-linux" then "i386"
else abort "Unsupported platform";
else throw "Unsupported platform: ${pkgs.stdenv.system}";
steam-runtime = callPackage ./runtime.nix { };
steam-runtime-wrapped = callPackage ./runtime-wrapped.nix { };

View file

@ -9,7 +9,7 @@
let arch =
if stdenv.system == "x86_64-linux" then "64"
else if stdenv.system == "i686-linux" then "32"
else abort "Unsupported architecture";
else throw "Unsupported system ${stdenv.system}";
in stdenv.mkDerivation rec {
name = "cnijfilter-${version}";

View file

@ -4,7 +4,7 @@ let
platform =
if stdenv.system == "x86_64-linux" then "64bit"
else if stdenv.system == "i686-linux" then "32bit"
else abort "Unsupported platform";
else throw "Unsupported system: ${stdenv.system}";
libPath = lib.makeLibraryPath [ cups ];
in

View file

@ -9,7 +9,7 @@ let
if isx86_64 then "64bit"
else
if isi686 then "32bit"
else abort "${system} not considered in build derivation. Might still be supported.";
else throw "${system} not considered in build derivation. Might still be supported.";
in
stdenv.mkDerivation {

View file

@ -16,7 +16,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/${tarball}";
sha256 = hashes."${stdenv.system}";
sha256 = hashes.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
};
hardeningDisable = [ "pic" ];

View file

@ -10,7 +10,7 @@ let xorgFullVer = (builtins.parseDrvName xorg.xorgserver.name).version;
xorgVer = lib.concatStringsSep "." (lib.take 2 (lib.splitString "." xorgFullVer));
x64 = if stdenv.system == "x86_64-linux" then true
else if stdenv.system == "i686-linux" then false
else abort "Parallels Tools for Linux only support {x86-64,i686}-linux targets";
else throw "Parallels Tools for Linux only support {x86-64,i686}-linux targets";
in
stdenv.mkDerivation rec {
version = "${prl_major}.2.1-41615";

View file

@ -5,12 +5,13 @@ let
if stdenv.system == "x86_64-linux" then "linux64"
else if stdenv.system == "i686-linux" then "linux"
else if stdenv.system == "x86_64-darwin" then "macosx64"
else abort "Unsupported platform";
else throwSystem;
throwSystem = throw "Unsupported system: ${stdenv.system}";
gwnum =
if stdenv.system == "x86_64-linux" then "make64"
else if stdenv.system == "i686-linux" then "makefile"
else if stdenv.system == "x86_64-darwin" then "makemac"
else abort "Unsupported platform";
else throwSystem;
in
stdenv.mkDerivation {

View file

@ -8,11 +8,12 @@ let
arch =
if stdenv.system == "x86_64-linux" then "x64"
else if stdenv.system == "i686-linux" then "x86"
else abort "Unsupported architecture";
else throwSystem;
throwSystem = throw "Unsupported system: ${stdenv.system}";
sha256 =
if stdenv.system == "x86_64-linux" then "011xg1frhjavv6zj1y3da0yh7rl6v1ax6xy2g8fk3sry9bi2p4j3"
else if stdenv.system == "i686-linux" then "03ml9xv19km99f0z7fpr21b1zkxvw7q39kjzd8wpb2pds51wnc62"
else abort "Unsupported architecture";
else throwSystem;
libraries = stdenv.lib.makeLibraryPath [ stdenv.cc.cc ];
in stdenv.mkDerivation rec {