various: switch from replace to replace-fail (#512135)

This commit is contained in:
Peder Bergebakken Sundt 2026-05-01 14:14:15 +00:00 committed by GitHub
commit 1d9005977f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 36 additions and 48 deletions

View file

@ -19,7 +19,7 @@ python3Packages.buildPythonApplication (finalAttrs: {
patchPhase = ''
substituteInPlace lightyears \
--replace \
--replace-fail \
"LIGHTYEARS_DIR = \".\"" \
"LIGHTYEARS_DIR = \"$out/share\""
'';

View file

@ -20,8 +20,8 @@ stdenv.mkDerivation (finalAttrs: {
# Don't strip binary on install, we strip it on fixup phase anyway.
postPatch = ''
substituteInPlace Makefile.Linux \
--replace "(INSTALL_BIN) -s" "(INSTALL_BIN)" \
--replace "/usr" ""
--replace-fail "(INSTALL_BIN) -s" "(INSTALL_BIN)" \
--replace-fail "/usr" ""
'';
makeFlags = [

View file

@ -79,7 +79,7 @@ stdenv.mkDerivation (finalAttrs: {
''
+ lib.optionalString stdenv.hostPlatform.isMinGW ''
substituteInPlace CPP/7zip/7zip_gcc.mak C/7zip_gcc_c.mak \
--replace windres.exe ${stdenv.cc.targetPrefix}windres
--replace-fail windres.exe ${stdenv.cc.targetPrefix}windres
'';
buildPhase =

View file

@ -65,7 +65,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = lib.optionalString stdenv.hostPlatform.isMinGW ''
substituteInPlace CPP/7zip/7zip_gcc.mak C/7zip_gcc_c.mak \
--replace windres.exe ${stdenv.cc.targetPrefix}windres
--replace-fail windres.exe ${stdenv.cc.targetPrefix}windres
'';
env.NIX_CFLAGS_COMPILE = toString (

View file

@ -40,7 +40,7 @@ stdenv.mkDerivation {
# the 9yacc script needs to be executed to build other items
preBuild = lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
substituteInPlace ./yacc/9yacc \
--replace "../yacc/yacc" "${lib.getExe' pkgsBuildHost._9base "yacc"}"
--replace-fail "../yacc/yacc" "${lib.getExe' pkgsBuildHost._9base "yacc"}"
'';
enableParallelBuilding = true;

View file

@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: {
};
postPatch = ''
substituteInPlace Makefile --replace "pkg-config" "$PKG_CONFIG"
substituteInPlace Makefile --replace-fail "pkg-config" "$PKG_CONFIG"
'';
makeFlags = [

View file

@ -44,7 +44,7 @@ stdenv.mkDerivation (finalAttrs: {
postInstall = ''
wrapProgram $out/bin/a2j_control --set PYTHONPATH $PYTHONPATH
substituteInPlace $out/bin/a2j --replace "a2j_control" "$out/bin/a2j_control"
substituteInPlace $out/bin/a2j --replace-fail "a2j_control" "$out/bin/a2j_control"
'';
passthru.updateScript = gitUpdater { };

View file

@ -22,8 +22,8 @@ stdenv.mkDerivation (finalAttrs: {
};
postPatch = ''
substituteInPlace afm/make_fonts_map.sh --replace "/bin/rm" "rm"
substituteInPlace tests/defs.in --replace "/bin/rm" "rm"
substituteInPlace afm/make_fonts_map.sh --replace-fail "/bin/rm" "rm"
substituteInPlace tests/defs.in --replace-fail "/bin/rm" "rm"
'';
nativeBuildInputs = [

View file

@ -30,10 +30,10 @@ resholve.mkDerivation rec {
postPatch = ''
substituteInPlace AAXtoMP3 \
--replace 'AAXtoMP3' 'aaxtomp3'
--replace-fail 'AAXtoMP3' 'aaxtomp3'
substituteInPlace interactiveAAXtoMP3 \
--replace 'AAXtoMP3' 'aaxtomp3' \
--replace 'call="./aaxtomp3"' 'call="$AAXTOMP3"'
--replace-fail 'AAXtoMP3' 'aaxtomp3' \
--replace-fail 'call="./aaxtomp3"' 'call="$AAXTOMP3"'
'';
installPhase = ''

View file

@ -38,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: {
echo CDROMREADERSYNTAX=cdparanoia >>abcde.conf
substituteInPlace "abcde" \
--replace "/etc/abcde.conf" "$out/etc/abcde.conf"
--replace-fail "/etc/abcde.conf" "$out/etc/abcde.conf"
runHook postConfigure
'';

View file

@ -21,9 +21,9 @@ stdenv.mkDerivation (finalAttrs: {
patchPhase = ''
substituteInPlace abi-dumper.pl \
--replace eu-readelf ${elfutils}/bin/eu-readelf \
--replace vtable-dumper ${vtable-dumper}/bin/vtable-dumper \
--replace '"ctags"' '"${ctags}/bin/ctags"'
--replace-fail eu-readelf ${elfutils}/bin/eu-readelf \
--replace-fail vtable-dumper ${vtable-dumper}/bin/vtable-dumper \
--replace-fail '"ctags"' '"${ctags}/bin/ctags"'
'';
buildInputs = [

View file

@ -53,8 +53,8 @@ stdenv.mkDerivation (finalAttrs: {
patchPhase = ''
substituteInPlace ./Makefile \
--replace 'chmod 4555' '#chmod 4555' \
--replace 'pkg-config' "$PKG_CONFIG"
--replace-fail 'chmod 4555' '#chmod 4555' \
--replace-fail 'pkg-config' "$PKG_CONFIG"
'';
makeFlags = [

View file

@ -21,7 +21,7 @@ buildGoModule (finalAttrs: {
postInstall = ''
install -D -m0444 -t $out/lib/systemd/system ./acme-dns.service
substituteInPlace $out/lib/systemd/system/acme-dns.service --replace "/usr/local/bin/acme-dns" "$out/bin/acme-dns"
substituteInPlace $out/lib/systemd/system/acme-dns.service --replace-fail "/usr/local/bin/acme-dns" "$out/bin/acme-dns"
'';
passthru.tests = { inherit (nixosTests) acme-dns; };

View file

@ -18,7 +18,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
substituteInPlace Makefile \
--replace "= gcc" "?= gcc"
--replace-fail "= gcc" "?= gcc"
'';
enableParallelBuilding = true;

View file

@ -16,7 +16,7 @@ python3Packages.buildPythonApplication (finalAttrs: {
postPatch = ''
substituteInPlace setup.py \
--replace "pbr>=5.8.1,<6" "pbr"
--replace-fail "pbr>=5.8.1,<6" "pbr"
'';
nativeBuildInputs = with python3Packages; [

View file

@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
);
postConfigure = ''
substituteInPlace 90-backlight.rules --replace /bin ${coreutils}/bin
substituteInPlace Makefile --replace udevadm true
substituteInPlace 90-backlight.rules --replace-fail /bin ${coreutils}/bin
substituteInPlace Makefile --replace-fail udevadm true
'';
buildInputs = [ pyenv ];

View file

@ -63,7 +63,7 @@ stdenv.mkDerivation (finalAttrs: {
install -Dm444 res/icon.png $out/share/icons/hicolor/128x128/apps/activate-linux.png
install -Dm444 res/activate-linux.desktop -t $out/share/applications
substituteInPlace $out/share/applications/activate-linux.desktop \
--replace 'Icon=icon' 'Icon=activate-linux'
--replace-fail 'Icon=icon' 'Icon=activate-linux'
runHook postInstall
'';

View file

@ -15,8 +15,8 @@ stdenv.mkDerivation (finalAttrs: {
preConfigure = ''
substituteInPlace Makefile \
--replace /usr/local $out \
--replace /etc $out/etc
--replace-fail /usr/local $out \
--replace-fail /etc $out/etc
'';
postInstall = ''

View file

@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
# very ugly way of replacing the adb calls
substituteInPlace adbfs.cpp \
--replace '"adb ' '"${android-tools}/bin/adb '
--replace-fail '"adb ' '"${android-tools}/bin/adb '
'';
installPhase = ''

View file

@ -31,7 +31,7 @@ python3.pkgs.buildPythonApplication {
install -vD $pname.py $out/bin/$pname
substituteInPlace $out/bin/$pname --replace '"Coercer"' '"coercer"'
substituteInPlace $out/bin/$pname --replace-fail '"Coercer"' '"coercer"'
runHook postInstall
'';

View file

@ -58,7 +58,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
# Fix plugin dir
substituteInPlace src/style/CMakeLists.txt \
--replace "DESTINATION \"\''${QT_PLUGINS_DIR}/styles" "DESTINATION \"$qtPluginPrefix/styles"
--replace-fail "DESTINATION \"\''${QT_PLUGINS_DIR}/styles" "DESTINATION \"$qtPluginPrefix/styles"
'';
passthru = {

View file

@ -35,7 +35,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
sed -i source/Makefile -e /ldconfig/d
substituteInPlace source/main.cc --replace /etc/ "$out/etc/"
substituteInPlace source/main.cc --replace-fail /etc/ "$out/etc/"
'';
preBuild = "cd source";

View file

@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: {
};
preBuild = ''
substituteInPlace src/Makefile --replace "CC=gcc" "CC?=gcc"
substituteInPlace src/Makefile --replace-fail "CC=gcc" "CC?=gcc"
cd src
'';

View file

@ -48,7 +48,7 @@ stdenv.mkDerivation (finalAttrs: {
# Causes fatal ldconfig cache generation attempt on non-NixOS Linux
for mkfile in autoconf/Makefile.common.lib.in libAfter{Base,Image}/Makefile.in; do
substituteInPlace $mkfile \
--replace 'test -w /etc' 'false'
--replace-fail 'test -w /etc' 'false'
done
'';
@ -72,20 +72,8 @@ stdenv.mkDerivation (finalAttrs: {
strictDeps = true;
# A strange type of bug: dbus is not immediately found by pkg-config
preConfigure = ''
# binutils 2.37 fix
# https://github.com/afterstep/afterstep/issues/2
fixupList=(
"autoconf/Makefile.defines.in"
"libAfterImage/aftershow/Makefile.in"
"libAfterImage/apps/Makefile.in"
"libAfterBase/Makefile.in"
"libAfterImage/Makefile.in"
)
for toFix in "''${fixupList[@]}"; do
substituteInPlace "$toFix" --replace "clq" "cq"
done
# A strange type of bug: dbus is not immediately found by pkg-config
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config dbus-1 --cflags)"
'';

View file

@ -36,7 +36,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
substituteInPlace include/agg_renderer_outline_aa.h \
--replace 'line_profile_aa& profile() {' 'const line_profile_aa& profile() {'
--replace-fail 'line_profile_aa& profile() {' 'const line_profile_aa& profile() {'
'';
# fix build with new automake, from Gentoo ebuild

View file

@ -41,7 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
];
postPatch = ''
substituteInPlace airspy-tools/CMakeLists.txt --replace "/etc/udev/rules.d" "$out/etc/udev/rules.d"
substituteInPlace airspy-tools/CMakeLists.txt --replace-fail "/etc/udev/rules.d" "$out/etc/udev/rules.d"
'';
nativeBuildInputs = [