From 4fa9300cb0e3a73f7195bf71fac949b950b089b7 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 15 Nov 2023 20:16:34 +0000 Subject: [PATCH] cvise: fix shebang for `--command=` option Upstream `cvise` changed the way it encodes shebang from hardcoded value to `/bin` + value: https://github.com/marxin/cvise/commit/d99d82ce8e9d0991e629eb693f6a1187dc752938 This broke `nixpkgs` substitute hack and broke the option. I proposed upstream to use `/usr/bin/env bash` indirection instead. This change pulls in this proposed change. --- pkgs/development/tools/misc/cvise/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/misc/cvise/default.nix b/pkgs/development/tools/misc/cvise/default.nix index 56bd85b77218..f65b0386cfd8 100644 --- a/pkgs/development/tools/misc/cvise/default.nix +++ b/pkgs/development/tools/misc/cvise/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonApplication , fetchFromGitHub +, fetchpatch , bash , cmake , colordiff @@ -29,6 +30,14 @@ buildPythonApplication rec { patches = [ # Refer to unifdef by absolute path. ./unifdef.patch + + # Refer to shell via /usr/bin/env: + # https://github.com/marxin/cvise/pull/121 + (fetchpatch { + name = "env-shell.patch"; + url = "https://github.com/marxin/cvise/commit/6a416eb590be978a2ad25c610974fdde84e88651.patch"; + hash = "sha256-Kn6+TXP+wJpMs6jrgsa9OwjXf6vmIgGzny8jg3dfKWA="; + }) ]; postPatch = '' @@ -37,10 +46,6 @@ buildPythonApplication rec { substituteInPlace CMakeLists.txt \ --replace " -Werror " " " - # 'cvise --command=...' generates a script with hardcoded shebang. - substituteInPlace cvise.py \ - --replace "#!/bin/bash" "#!${bash}/bin/bash" - substituteInPlace cvise/utils/testing.py \ --replace "'colordiff --version'" "'${colordiff}/bin/colordiff --version'" \ --replace "'colordiff'" "'${colordiff}/bin/colordiff'"