diff options
author | Katharina Fey <kookie@spacekookie.de> | 2019-10-18 16:32:00 +0000 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2019-10-18 16:32:00 +0000 |
commit | 0f74f62ee25ac2d21bd67c29b8efc3ad079a72a8 (patch) | |
tree | bd701e982d896952f4291e4b795c85bb581593b8 /nixpkgs/lib | |
parent | dae1ae41b3a575e87d411e0cd9daa42a85c5aa89 (diff) | |
parent | 1c40ee6fc44f7eb474c69ea070a43247a1a2c83c (diff) |
Merge commit '1c40ee6fc44f7eb474c69ea070a43247a1a2c83c'
Diffstat (limited to 'nixpkgs/lib')
-rw-r--r-- | nixpkgs/lib/default.nix | 2 | ||||
-rw-r--r-- | nixpkgs/lib/modules.nix | 12 | ||||
-rw-r--r-- | nixpkgs/lib/systems/doubles.nix | 2 | ||||
-rw-r--r-- | nixpkgs/lib/tests/misc.nix | 15 | ||||
-rw-r--r-- | nixpkgs/lib/tests/systems.nix | 4 | ||||
-rw-r--r-- | nixpkgs/lib/versions.nix | 12 |
6 files changed, 35 insertions, 12 deletions
diff --git a/nixpkgs/lib/default.nix b/nixpkgs/lib/default.nix index 18d2dfae1e1..f293a1defb1 100644 --- a/nixpkgs/lib/default.nix +++ b/nixpkgs/lib/default.nix @@ -134,5 +134,7 @@ let mergeAttrsByFuncDefaultsClean mergeAttrBy fakeSha256 fakeSha512 nixType imap; + inherit (versions) + splitVersion; }); in lib diff --git a/nixpkgs/lib/modules.nix b/nixpkgs/lib/modules.nix index c3c903c1dfa..71672c7d112 100644 --- a/nixpkgs/lib/modules.nix +++ b/nixpkgs/lib/modules.nix @@ -591,12 +591,16 @@ rec { { options, ... }: { options = setAttrByPath optionName (mkOption { visible = false; + apply = x: throw "The option `${showOption optionName}' can no longer be used since it's been removed. ${replacementInstructions}"; }); - config.warnings = - let opt = getAttrFromPath optionName options; in - optional opt.isDefined '' + config.assertions = + let opt = getAttrFromPath optionName options; in [{ + assertion = !opt.isDefined; + message = '' The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it. - ${replacementInstructions}''; + ${replacementInstructions} + ''; + }]; }; /* Return a module that causes a warning to be shown if the diff --git a/nixpkgs/lib/systems/doubles.nix b/nixpkgs/lib/systems/doubles.nix index 8e02fcb5de0..58cff18e648 100644 --- a/nixpkgs/lib/systems/doubles.nix +++ b/nixpkgs/lib/systems/doubles.nix @@ -7,7 +7,7 @@ let all = [ "aarch64-linux" - "armv5tel-linux" "armv6l-linux" "armv7l-linux" + "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "mipsel-linux" diff --git a/nixpkgs/lib/tests/misc.nix b/nixpkgs/lib/tests/misc.nix index d8f412d3fc4..e5d76d4e57b 100644 --- a/nixpkgs/lib/tests/misc.nix +++ b/nixpkgs/lib/tests/misc.nix @@ -102,6 +102,21 @@ runTests { expected = [ "2001" "db8" "0" "0042" "" "8a2e" "370" "" ]; }; + testSplitVersionSingle = { + expr = versions.splitVersion "1"; + expected = [ "1" ]; + }; + + testSplitVersionDouble = { + expr = versions.splitVersion "1.2"; + expected = [ "1" "2" ]; + }; + + testSplitVersionTriple = { + expr = versions.splitVersion "1.2.3"; + expected = [ "1" "2" "3" ]; + }; + testIsStorePath = { expr = let goodPath = diff --git a/nixpkgs/lib/tests/systems.nix b/nixpkgs/lib/tests/systems.nix index 5748c09b564..818749442f9 100644 --- a/nixpkgs/lib/tests/systems.nix +++ b/nixpkgs/lib/tests/systems.nix @@ -14,7 +14,7 @@ let in with lib.systems.doubles; lib.runTests { testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded); - testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv7l-linux" "arm-none" "armv7a-darwin" ]; + testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "arm-none" "armv7a-darwin" ]; testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ]; testmips = mseteq mips [ "mipsel-linux" ]; testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" "x86_64-none" ]; @@ -24,7 +24,7 @@ in with lib.systems.doubles; lib.runTests { testfreebsd = mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ]; testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */); testillumos = mseteq illumos [ "x86_64-solaris" ]; - testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64le-linux" ]; + testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64le-linux" ]; testnetbsd = mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ]; testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]; testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ]; diff --git a/nixpkgs/lib/versions.nix b/nixpkgs/lib/versions.nix index 2c05445b3dd..0e9d81ac78b 100644 --- a/nixpkgs/lib/versions.nix +++ b/nixpkgs/lib/versions.nix @@ -1,13 +1,15 @@ /* Version string functions. */ { lib }: -let +rec { - splitVersion = builtins.splitVersion or (lib.splitString "."); - -in + /* Break a version string into its component parts. -{ + Example: + splitVersion "1.2.3" + => ["1" "2" "3"] + */ + splitVersion = builtins.splitVersion or (lib.splitString "."); /* Get the major version string from a string. |