Merge pull request #241854 from trofi/mutt-smaller-closure

mutt: avoid build-only references in 'mutt -v'
This commit is contained in:
Sergei Trofimovich 2023-07-07 06:52:54 +01:00 committed by GitHub
commit c63bad1618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View file

@ -31,7 +31,10 @@ stdenv.mkDerivation rec {
sha256 = "sha256-TXc/IkIveQlve5S1e+5FZUrZolFl27NkY8WClbTNPYg=";
};
patches = lib.optional smimeSupport (fetchpatch {
patches = [
# Avoid build-only references embedding into 'mutt -v' output.
./no-build-only-refs.patch
] ++ lib.optional smimeSupport (fetchpatch {
url = "https://salsa.debian.org/mutt-team/mutt/raw/debian/1.10.1-2/debian/patches/misc/smime.rc.patch";
sha256 = "0b4i00chvx6zj9pcb06x2jysmrcb2znn831lcy32cgfds6gr3nsi";
});

View file

@ -0,0 +1,24 @@
Avoid build-only store references embedding into 'mutt -v'.
--- a/txt2c.sh
+++ b/txt2c.sh
@@ -21,8 +21,18 @@ txt2c_fallback () {
echo ";"
}
+nix_store_mangle() {
+ # consume stdin
+
+ # Avoid build-only references to nix store. These are usually
+ # 'gcc -v' output embedded into 'mutt -v'. But also might be
+ # ./configure-passed arguments.
+ sed \
+ -e 's@'$NIX_STORE'/[a-z0-9]\{32\}-@/<<NIX>>/@g'
+}
+
if ./txt2c test </dev/null >/dev/null 2>&1; then
- ./txt2c "$1"
+ nix_store_mangle | ./txt2c "$1"
else
- txt2c_fallback "$1"
+ nix_store_mangle | txt2c_fallback "$1"
fi