From fe7dba685893030b2dec2b002164069ec9b7366a Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Tue, 1 Apr 2025 22:11:42 +0200 Subject: [PATCH] substituteAll: deprecate --- doc/release-notes/rl-2505.section.md | 2 + .../substitute/substitute-all.nix | 39 ++++++++++--------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/doc/release-notes/rl-2505.section.md b/doc/release-notes/rl-2505.section.md index 346319db23ab..1d9cd80d851b 100644 --- a/doc/release-notes/rl-2505.section.md +++ b/doc/release-notes/rl-2505.section.md @@ -112,6 +112,8 @@ - All support for 32‐bit Darwin systems has been dropped. +- `substituteAll` has been deprecated in favor of `replaceVars` and will be removed in the next release. + - Default ICU version updated from 74 to 76 - Apache Kafka was updated to `>= 4.0.0`. Please note that this is the first release which operates diff --git a/pkgs/build-support/substitute/substitute-all.nix b/pkgs/build-support/substitute/substitute-all.nix index 7f8d55449472..1135c822e22d 100644 --- a/pkgs/build-support/substitute/substitute-all.nix +++ b/pkgs/build-support/substitute/substitute-all.nix @@ -6,21 +6,24 @@ let isInvalidArgName = x: builtins.match "^[a-z][a-zA-Z0-9_]*$" x == null; invalidArgs = builtins.filter isInvalidArgName (builtins.attrNames args); in -if invalidArgs == [ ] then - stdenvNoCC.mkDerivation ( - { - name = if args ? name then args.name else baseNameOf (toString args.src); - builder = ./substitute-all.sh; - inherit (args) src; - preferLocalBuild = true; - allowSubstitutes = false; - } - // args - ) -else - throw '' - Argument names for `pkgs.substituteAll` must: - - start with a lower case ASCII letter - - only contain ASCII letters, digits and underscores - Found invalid argument names: ${lib.concatStringsSep ", " invalidArgs}. - '' +# TODO(@wolfgangwalther): Remove substituteAll, the nix function, after 25.05 branch-off. +lib.warn "substituteAll is deprecated and will be removed in 25.11. Use replaceVars instead." ( + if invalidArgs == [ ] then + stdenvNoCC.mkDerivation ( + { + name = if args ? name then args.name else baseNameOf (toString args.src); + builder = ./substitute-all.sh; + inherit (args) src; + preferLocalBuild = true; + allowSubstitutes = false; + } + // args + ) + else + throw '' + Argument names for `pkgs.substituteAll` must: + - start with a lower case ASCII letter + - only contain ASCII letters, digits and underscores + Found invalid argument names: ${lib.concatStringsSep ", " invalidArgs}. + '' +)