lol

stdenv: substituteStream: deprecate --replace in favor of --replace-{fail,warn,quiet}

+50 -12
+3 -3
doc/languages-frameworks/emscripten.section.md
··· 86 86 87 87 postPatch = pkgs.lib.optionalString pkgs.stdenv.isDarwin '' 88 88 substituteInPlace configure \ 89 - --replace '/usr/bin/libtool' 'ar' \ 90 - --replace 'AR="libtool"' 'AR="ar"' \ 91 - --replace 'ARFLAGS="-o"' 'ARFLAGS="-r"' 89 + --replace-fail '/usr/bin/libtool' 'ar' \ 90 + --replace-fail 'AR="libtool"' 'AR="ar"' \ 91 + --replace-fail 'ARFLAGS="-o"' 'ARFLAGS="-r"' 92 92 ''; 93 93 }) 94 94 ```
+1 -1
doc/languages-frameworks/rust.section.md
··· 700 700 hello = attrs: lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") { 701 701 postPatch = '' 702 702 substituteInPlace lib/zoneinfo.rs \ 703 - --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" 703 + --replace-fail "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" 704 704 ''; 705 705 }; 706 706 };
+1 -1
doc/stdenv/platform-notes.chapter.md
··· 54 54 # ... 55 55 prePatch = '' 56 56 substituteInPlace Makefile \ 57 - --replace '/usr/bin/xcrun clang' clang 57 + --replace-fail '/usr/bin/xcrun clang' clang 58 58 ''; 59 59 } 60 60 ```
+17 -6
doc/stdenv/stdenv.chapter.md
··· 230 230 231 231 postInstall = '' 232 232 substituteInPlace $out/bin/solo5-virtio-mkimage \ 233 - --replace "/usr/lib/syslinux" "${syslinux}/share/syslinux" \ 234 - --replace "/usr/share/syslinux" "${syslinux}/share/syslinux" \ 235 - --replace "cp " "cp --no-preserve=mode " 233 + --replace-fail "/usr/lib/syslinux" "${syslinux}/share/syslinux" \ 234 + --replace-fail "/usr/share/syslinux" "${syslinux}/share/syslinux" \ 235 + --replace-fail "cp " "cp --no-preserve=mode " 236 236 237 237 wrapProgram $out/bin/solo5-virtio-mkimage \ 238 238 --prefix PATH : ${lib.makeBinPath [ dosfstools mtools parted syslinux ]} ··· 1253 1253 1254 1254 Performs string substitution on the contents of \<infile\>, writing the result to \<outfile\>. The substitutions in \<subs\> are of the following form: 1255 1255 1256 - #### `--replace` \<s1\> \<s2\> {#fun-substitute-replace} 1256 + #### `--replace-fail` \<s1\> \<s2\> {#fun-substitute-replace-fail} 1257 + 1258 + Replace every occurrence of the string \<s1\> by \<s2\>. 1259 + Will error if no change is made. 1260 + 1261 + #### `--replace-warn` \<s1\> \<s2\> {#fun-substitute-replace-warn} 1262 + 1263 + Replace every occurrence of the string \<s1\> by \<s2\>. 1264 + Will print a warning if no change is made. 1265 + 1266 + #### `--replace-quiet` \<s1\> \<s2\> {#fun-substitute-replace-quiet} 1257 1267 1258 1268 Replace every occurrence of the string \<s1\> by \<s2\>. 1269 + Will do nothing if no change can be made. 1259 1270 1260 1271 #### `--subst-var` \<varName\> {#fun-substitute-subst-var} 1261 1272 ··· 1269 1280 1270 1281 ```shell 1271 1282 substitute ./foo.in ./foo.out \ 1272 - --replace /usr/bin/bar $bar/bin/bar \ 1273 - --replace "a string containing spaces" "some other text" \ 1283 + --replace-fail /usr/bin/bar $bar/bin/bar \ 1284 + --replace-fail "a string containing spaces" "some other text" \ 1274 1285 --subst-var someVar 1275 1286 ``` 1276 1287
+2
nixos/doc/manual/release-notes/rl-2405.section.md
··· 160 160 - The option [`services.nextcloud.config.dbport`] of the Nextcloud module was removed to match upstream. 161 161 The port can be specified in [`services.nextcloud.config.dbhost`](#opt-services.nextcloud.config.dbhost). 162 162 163 + - `stdenv`: The `--replace` flag in `substitute`, `substituteInPlace`, `substituteAll`, `substituteAllStream`, and `substituteStream` is now deprecated if favor of the new `--replace-fail`, `--replace-warn` and `--replace-quiet`. The deprecated `--replace` equates to `--replace-warn`. 164 + 163 165 - The Yama LSM is now enabled by default in the kernel, which prevents ptracing 164 166 non-child processes. This means you will not be able to attach gdb to an 165 167 existing process, but will need to start that process from gdb (so it is a
+26 -1
pkgs/stdenv/generic/setup.sh
··· 815 815 ###################################################################### 816 816 # Textual substitution functions. 817 817 818 + # only log once, due to max logging limit on hydra 819 + _substituteStream_has_warned_replace_deprecation="" 818 820 819 821 substituteStream() { 820 822 local var=$1 ··· 822 824 shift 2 823 825 824 826 while (( "$#" )); do 827 + local is_required=1 828 + local is_quiet="" 825 829 case "$1" in 830 + --replace-quiet) 831 + is_quiet=1 832 + ;& 826 833 --replace) 834 + # deprecated 2023-11-22 835 + # this will either get removed, or switch to the behaviour of --replace-fail in the future 836 + if [ -z "$_substituteStream_has_warned_replace_deprecation" ]; then 837 + echo "substituteStream(): WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. ($description)" >&2 838 + _substituteStream_has_warned_replace_deprecation=1 839 + fi 840 + ;& 841 + --replace-warn) 842 + is_required="" 843 + ;& 844 + --replace-fail) 827 845 pattern="$2" 828 846 replacement="$3" 829 847 shift 3 ··· 832 850 eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' 833 851 if [ "$pattern" != "$replacement" ]; then 834 852 if [ "${!var}" == "$savedvar" ]; then 835 - echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" >&2 853 + if [ -z "$is_required" ]; then 854 + if [ -z "$is_quiet" ]; then 855 + echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" >&2 856 + fi 857 + else 858 + echo "substituteStream(): ERROR: pattern '$pattern' doesn't match anything in $description" >&2 859 + return 1 860 + fi 836 861 fi 837 862 fi 838 863 ;;