From 3a110ea3f96db56012f7f2707e842593a7d7c5b8 Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Wed, 6 Dec 2017 00:06:43 +0100 Subject: 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" ] --- pkgs/applications/graphics/unigine-valley/default.nix | 2 +- pkgs/applications/misc/googleearth/default.nix | 2 +- pkgs/applications/misc/playonlinux/default.nix | 2 +- pkgs/applications/networking/bittorrentsync/generic.nix | 5 +++-- pkgs/applications/networking/remote/teamviewer/default.nix | 2 +- pkgs/applications/networking/resilio-sync/default.nix | 2 +- pkgs/build-support/rust/cargo-vendor.nix | 6 ++++-- pkgs/development/compilers/jetbrains-jdk/default.nix | 2 +- pkgs/development/compilers/oraclejdk/jdk-linux-base.nix | 2 +- pkgs/development/libraries/bootil/default.nix | 2 +- pkgs/development/tools/misc/iozone/default.nix | 2 +- pkgs/development/tools/misc/saleae-logic/default.nix | 2 +- pkgs/games/nethack/default.nix | 2 +- pkgs/games/steam/default.nix | 2 +- pkgs/misc/cups/drivers/cnijfilter_4_00/default.nix | 2 +- pkgs/misc/cups/drivers/kyocera/default.nix | 2 +- pkgs/misc/drivers/sundtek/default.nix | 2 +- pkgs/os-specific/linux/broadcom-sta/default.nix | 2 +- pkgs/os-specific/linux/prl-tools/default.nix | 2 +- pkgs/tools/misc/mprime/default.nix | 5 +++-- pkgs/tools/networking/logmein-hamachi/default.nix | 5 +++-- 21 files changed, 30 insertions(+), 25 deletions(-) (limited to 'pkgs') diff --git a/pkgs/applications/graphics/unigine-valley/default.nix b/pkgs/applications/graphics/unigine-valley/default.nix index 31908dcfd9f0..f1adc6bd10ea 100644 --- a/pkgs/applications/graphics/unigine-valley/default.nix +++ b/pkgs/applications/graphics/unigine-valley/default.nix @@ -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 { diff --git a/pkgs/applications/misc/googleearth/default.nix b/pkgs/applications/misc/googleearth/default.nix index df8cb71d6f9e..52903a1f8014 100644 --- a/pkgs/applications/misc/googleearth/default.nix +++ b/pkgs/applications/misc/googleearth/default.nix @@ -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" diff --git a/pkgs/applications/misc/playonlinux/default.nix b/pkgs/applications/misc/playonlinux/default.nix index 3f39a356312e..44650d001e34 100644 --- a/pkgs/applications/misc/playonlinux/default.nix +++ b/pkgs/applications/misc/playonlinux/default.nix @@ -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 ]; diff --git a/pkgs/applications/networking/bittorrentsync/generic.nix b/pkgs/applications/networking/bittorrentsync/generic.nix index 3fa7fe180402..eb988471c8c7 100644 --- a/pkgs/applications/networking/bittorrentsync/generic.nix +++ b/pkgs/applications/networking/bittorrentsync/generic.nix @@ -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 diff --git a/pkgs/applications/networking/remote/teamviewer/default.nix b/pkgs/applications/networking/remote/teamviewer/default.nix index d002b51625c6..4ff649dbf2a0 100644 --- a/pkgs/applications/networking/remote/teamviewer/default.nix +++ b/pkgs/applications/networking/remote/teamviewer/default.nix @@ -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 ]); diff --git a/pkgs/applications/networking/resilio-sync/default.nix b/pkgs/applications/networking/resilio-sync/default.nix index 7622cb76ad2a..5e94106a48f1 100644 --- a/pkgs/applications/networking/resilio-sync/default.nix +++ b/pkgs/applications/networking/resilio-sync/default.nix @@ -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 { diff --git a/pkgs/build-support/rust/cargo-vendor.nix b/pkgs/build-support/rust/cargo-vendor.nix index 6b50f8b83e73..9c379eaa3337 100644 --- a/pkgs/build-support/rust/cargo-vendor.nix +++ b/pkgs/build-support/rust/cargo-vendor.nix @@ -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}"; diff --git a/pkgs/development/compilers/jetbrains-jdk/default.nix b/pkgs/development/compilers/jetbrains-jdk/default.nix index 383283309ddf..7f23a4d507e7 100644 --- a/pkgs/development/compilers/jetbrains-jdk/default.nix +++ b/pkgs/development/compilers/jetbrains-jdk/default.nix @@ -16,7 +16,7 @@ let drv = stdenv.mkDerivation rec { sha256 = "1768f02i3dxdbxn8n29d522h8v0mkgnhpb8ixzq5p54vwjmfl6md"; } else - abort "unsupported system: ${stdenv.system}"; + throw "unsupported system: ${stdenv.system}"; nativeBuildInputs = [ file ]; diff --git a/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix b/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix index fadae3eb5925..554c322781fc 100644 --- a/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix +++ b/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix @@ -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. diff --git a/pkgs/development/libraries/bootil/default.nix b/pkgs/development/libraries/bootil/default.nix index 727c6bfc4f3f..160f62305945 100644 --- a/pkgs/development/libraries/bootil/default.nix +++ b/pkgs/development/libraries/bootil/default.nix @@ -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 ]; diff --git a/pkgs/development/tools/misc/iozone/default.nix b/pkgs/development/tools/misc/iozone/default.nix index 0bbab096c73f..31d70d280e32 100644 --- a/pkgs/development/tools/misc/iozone/default.nix +++ b/pkgs/development/tools/misc/iozone/default.nix @@ -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 { diff --git a/pkgs/development/tools/misc/saleae-logic/default.nix b/pkgs/development/tools/misc/saleae-logic/default.nix index 86be86cb6d63..de2d6c5b7bfd 100644 --- a/pkgs/development/tools/misc/saleae-logic/default.nix +++ b/pkgs/development/tools/misc/saleae-logic/default.nix @@ -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"; diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix index 92d87697fb16..d9ab3ee833b2 100644 --- a/pkgs/games/nethack/default.nix +++ b/pkgs/games/nethack/default.nix @@ -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" diff --git a/pkgs/games/steam/default.nix b/pkgs/games/steam/default.nix index 54805e91b2bd..6a6485d43319 100644 --- a/pkgs/games/steam/default.nix +++ b/pkgs/games/steam/default.nix @@ -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 { }; diff --git a/pkgs/misc/cups/drivers/cnijfilter_4_00/default.nix b/pkgs/misc/cups/drivers/cnijfilter_4_00/default.nix index 2856aee4a5d2..b83e84154bbe 100644 --- a/pkgs/misc/cups/drivers/cnijfilter_4_00/default.nix +++ b/pkgs/misc/cups/drivers/cnijfilter_4_00/default.nix @@ -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}"; diff --git a/pkgs/misc/cups/drivers/kyocera/default.nix b/pkgs/misc/cups/drivers/kyocera/default.nix index be9d4f837092..17e5b37ed440 100644 --- a/pkgs/misc/cups/drivers/kyocera/default.nix +++ b/pkgs/misc/cups/drivers/kyocera/default.nix @@ -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 diff --git a/pkgs/misc/drivers/sundtek/default.nix b/pkgs/misc/drivers/sundtek/default.nix index 4dc0f2591d82..35a9bd2e3844 100644 --- a/pkgs/misc/drivers/sundtek/default.nix +++ b/pkgs/misc/drivers/sundtek/default.nix @@ -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 { diff --git a/pkgs/os-specific/linux/broadcom-sta/default.nix b/pkgs/os-specific/linux/broadcom-sta/default.nix index 3143968d75c8..8a42e5a0b262 100644 --- a/pkgs/os-specific/linux/broadcom-sta/default.nix +++ b/pkgs/os-specific/linux/broadcom-sta/default.nix @@ -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" ]; diff --git a/pkgs/os-specific/linux/prl-tools/default.nix b/pkgs/os-specific/linux/prl-tools/default.nix index 9fe331e6cb12..12b361e953ea 100644 --- a/pkgs/os-specific/linux/prl-tools/default.nix +++ b/pkgs/os-specific/linux/prl-tools/default.nix @@ -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"; diff --git a/pkgs/tools/misc/mprime/default.nix b/pkgs/tools/misc/mprime/default.nix index 2aea2530057c..3ef039507d4e 100644 --- a/pkgs/tools/misc/mprime/default.nix +++ b/pkgs/tools/misc/mprime/default.nix @@ -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 { diff --git a/pkgs/tools/networking/logmein-hamachi/default.nix b/pkgs/tools/networking/logmein-hamachi/default.nix index 6808c5c0a42b..bbee6546b2f4 100644 --- a/pkgs/tools/networking/logmein-hamachi/default.nix +++ b/pkgs/tools/networking/logmein-hamachi/default.nix @@ -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 { -- cgit 1.4.1