From 13e45aeed302363be9eed17c75db80fcc3e0100e Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 28 Nov 2018 12:26:21 -0600 Subject: [PATCH 1/4] make-derivation: remove selfConsistent check version is set in lots of places but might not need to be in a name. Alternative to #50364. --- pkgs/stdenv/generic/make-derivation.nix | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 57e757080a2d..b4e391629511 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -81,13 +81,6 @@ rec { , ... } @ attrs: let - # Check that the name is consistent with pname and version: - selfConsistent = (with attrs; attrs ? "name" -> - (lib.assertMsg (attrs ? "version" -> lib.strings.hasInfix version name) - "version ${version} does not appear in name ${name}" && - lib.assertMsg (attrs ? "pname" -> lib.strings.hasInfix pname name) - "pname ${pname} does not appear in name ${name}")); - computedName = if name != "" then name else "${attrs.pname}-${attrs.version}"; # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when @@ -188,7 +181,7 @@ rec { // { # A hack to make `nix-env -qa` and `nix search` ignore broken packages. # TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix. - name = assert selfConsistent && validity.handled && (separateDebugInfo -> stdenv.hostPlatform.isLinux); computedName + lib.optionalString + name = assert validity.handled && (separateDebugInfo -> stdenv.hostPlatform.isLinux); computedName + lib.optionalString # Fixed-output derivations like source tarballs shouldn't get a host # suffix. But we have some weird ones with run-time deps that are # just used for their side-affects. Those might as well since the From d64f28815486924a6fc3b1d9a46e6925b5d3c2ba Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 28 Nov 2018 12:29:00 -0600 Subject: [PATCH 2/4] =?UTF-8?q?make-derivation:=20don=E2=80=99t=20assert?= =?UTF-8?q?=20on=20separateDebugInfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When separateDebugInfo = true & !stdenv.hostPlatform.isLinux, we always gave an error. There is no reason to do this. Instead, just don’t add separate debug info when we aren’t on Linux. --- pkgs/stdenv/generic/make-derivation.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index b4e391629511..2debf063c7eb 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -88,7 +88,8 @@ rec { doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; - outputs' = outputs ++ lib.optional separateDebugInfo "debug"; + separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux; + outputs' = outputs ++ lib.optional separateDebugInfo' "debug"; fixedOutputDrv = attrs ? outputHash; noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated @@ -123,7 +124,7 @@ rec { [ (map (drv: drv.__spliced.buildBuild or drv) depsBuildBuild) (map (drv: drv.nativeDrv or drv) nativeBuildInputs - ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh + ++ lib.optional separateDebugInfo' ../../build-support/setup-hooks/separate-debug-info.sh ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh) (map (drv: drv.__spliced.buildTarget or drv) depsBuildTarget) ] @@ -181,7 +182,7 @@ rec { // { # A hack to make `nix-env -qa` and `nix search` ignore broken packages. # TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix. - name = assert validity.handled && (separateDebugInfo -> stdenv.hostPlatform.isLinux); computedName + lib.optionalString + name = assert validity.handled; computedName + lib.optionalString # Fixed-output derivations like source tarballs shouldn't get a host # suffix. But we have some weird ones with run-time deps that are # just used for their side-affects. Those might as well since the From a9b7fa7634f509aa8332069867c220fe7546474b Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 28 Nov 2018 12:30:24 -0600 Subject: [PATCH 3/4] Revert "treewide: for substituteAll: s/version/version_/" This reverts commit 1e99582eaff5605947b8e9cdef7d440df8cf7ba3. --- pkgs/development/python-modules/py3exiv2/default.nix | 2 +- pkgs/development/python-modules/py3exiv2/setup.patch | 6 +++--- pkgs/misc/drivers/hplip/3.16.11.nix | 2 +- pkgs/misc/drivers/hplip/default.nix | 2 +- pkgs/misc/drivers/hplip/hplip.state | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/py3exiv2/default.nix b/pkgs/development/python-modules/py3exiv2/default.nix index 647fbdd872ce..4c6ca0bad338 100644 --- a/pkgs/development/python-modules/py3exiv2/default.nix +++ b/pkgs/development/python-modules/py3exiv2/default.nix @@ -19,7 +19,7 @@ buildPythonPackage rec { patches = [ (substituteAll { src = ./setup.patch; - version_ = "3${stdenv.lib.versions.minor python.version}"; + version = "3${stdenv.lib.versions.minor python.version}"; }) ]; diff --git a/pkgs/development/python-modules/py3exiv2/setup.patch b/pkgs/development/python-modules/py3exiv2/setup.patch index 784533105d6b..8b0619c5bc5f 100644 --- a/pkgs/development/python-modules/py3exiv2/setup.patch +++ b/pkgs/development/python-modules/py3exiv2/setup.patch @@ -3,9 +3,9 @@ @@ -39,7 +39,7 @@ if '3' in l[2:]: return l.replace('libboost', 'boost') - + -libboost = get_libboost_name() -+libboost = 'boost_python@version_@' - ++libboost = 'boost_python@version@' + setup( name='py3exiv2', diff --git a/pkgs/misc/drivers/hplip/3.16.11.nix b/pkgs/misc/drivers/hplip/3.16.11.nix index 0c6ff464a622..8982834d9a99 100644 --- a/pkgs/misc/drivers/hplip/3.16.11.nix +++ b/pkgs/misc/drivers/hplip/3.16.11.nix @@ -23,7 +23,7 @@ let }; hplipState = substituteAll { - version_ = version; + inherit version; src = ./hplip.state; }; diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix index e2c34473e544..f03d75dfa02d 100644 --- a/pkgs/misc/drivers/hplip/default.nix +++ b/pkgs/misc/drivers/hplip/default.nix @@ -25,7 +25,7 @@ let }; hplipState = substituteAll { - version_ = version; + inherit version; src = ./hplip.state; }; diff --git a/pkgs/misc/drivers/hplip/hplip.state b/pkgs/misc/drivers/hplip/hplip.state index 3c7c2eb2df7b..9d19a93f3644 100644 --- a/pkgs/misc/drivers/hplip/hplip.state +++ b/pkgs/misc/drivers/hplip/hplip.state @@ -1,4 +1,4 @@ [plugin] installed=1 eula=1 -version=@version_@ +version=@version@ From a56fe056ece1d7c0b384a08467408ded507573c7 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 28 Nov 2018 12:44:10 -0600 Subject: [PATCH 4/4] =?UTF-8?q?make-derivation:=20don=E2=80=99t=20add=20ho?= =?UTF-8?q?st=20suffix=20if=20there=20is=20no=20c=20compiler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some trivial builders use the name attr to choose the exec name produced. For example nixos-install, nixos-install = makeProg { name = "nixos-install"; src = ./nixos-install.sh; nix = config.nix.package.out; path = makeBinPath [ nixos-enter ]; }; When cross compiling, this puts the prog in, /bin/nixos-install-powerpc64le-unknown-linux-gnu --- pkgs/stdenv/generic/make-derivation.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 2debf063c7eb..aa1dcfe977db 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -96,7 +96,7 @@ rec { ++ depsHostHost ++ depsHostHostPropagated ++ buildInputs ++ propagatedBuildInputs ++ depsTargetTarget ++ depsTargetTargetPropagated) == 0; - runtimeSensativeIfFixedOutput = fixedOutputDrv -> !noNonNativeDeps; + dontAddHostSuffix = attrs ? outputHash && !noNonNativeDeps || stdenv.cc == null; supportedHardeningFlags = [ "fortify" "stackprotector" "pie" "pic" "strictoverflow" "format" "relro" "bindnow" ]; defaultHardeningFlags = if stdenv.targetPlatform.isMusl then supportedHardeningFlags @@ -187,7 +187,7 @@ rec { # suffix. But we have some weird ones with run-time deps that are # just used for their side-affects. Those might as well since the # hash can't be the same. See #32986. - (stdenv.hostPlatform != stdenv.buildPlatform && runtimeSensativeIfFixedOutput) + (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix) ("-" + stdenv.hostPlatform.config); builder = attrs.realBuilder or stdenv.shell;