From 49433ed9cc2126b756f2ca98604bd144c161df9d Mon Sep 17 00:00:00 2001 From: Fernando Rodrigues Date: Sun, 11 Aug 2024 16:34:54 +0000 Subject: [PATCH] xen: call the postPatch for each pre-fetched source manually instead of going through withTools withTools and withPrefetchedSources are pretty complicated functions meant to generalise per-version calls to build phases by each pre-fetched source. This is step 1 in deprecating them. Signed-off-by: Fernando Rodrigues --- .../virtualization/xen/generic/default.nix | 30 ++++--------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/pkgs/applications/virtualization/xen/generic/default.nix b/pkgs/applications/virtualization/xen/generic/default.nix index 7411acd1d855..d3937bcd45b6 100644 --- a/pkgs/applications/virtualization/xen/generic/default.nix +++ b/pkgs/applications/virtualization/xen/generic/default.nix @@ -116,10 +116,6 @@ let inherit (pkg.qemu) hash; }; patches = lib.lists.optionals (lib.attrsets.hasAttrByPath [ "patches" ] pkg.qemu) pkg.qemu.patches; - postPatch = '' - substituteInPlace scripts/tracetool.py \ - --replace-fail "/usr/bin/env python" "${python311Packages.python}/bin/python" - ''; }; } // lib.attrsets.optionalAttrs withInternalSeaBIOS { @@ -143,11 +139,6 @@ let inherit (pkg.ovmf) hash; }; patches = lib.lists.optionals (lib.attrsets.hasAttrByPath [ "patches" ] pkg.ovmf) pkg.ovmf.patches; - postPatch = '' - substituteInPlace \ - OvmfPkg/build.sh BaseTools/BinWrappers/PosixLike/{AmlToC,BrotliCompress,build,GenFfs,GenFv,GenFw,GenSec,LzmaCompress,TianoCompress,Trim,VfrCompile} \ - --replace-fail "/usr/bin/env bash" ${stdenv.shell} - ''; }; } // lib.attrsets.optionalAttrs withInternalIPXE { @@ -497,19 +488,14 @@ stdenv.mkDerivation (finalAttrs: { '' )} - ${withTools "postPatch" (name: source: source.postPatch)} - ${pkg.xen.postPatch or ""} + '' + # Patch shebangs for QEMU and OVMF build scripts. + + '' + patchShebangs --build tools/qemu-xen/scripts/tracetool.py + patchShebangs --build tools/firmware/ovmf-dir-remote/OvmfPkg/build.sh tools/firmware/ovmf-dir-remote/BaseTools/BinWrappers/PosixLike/{AmlToC,BrotliCompress,build,GenFfs,GenFv,GenFw,GenSec,LzmaCompress,TianoCompress,Trim,VfrCompile} ''; - preBuild = lib.lists.optionals (lib.attrsets.hasAttrByPath [ "preBuild" ] pkg.xen) pkg.xen.preBuild; - - postBuild = '' - ${withTools "buildPhase" (name: source: source.buildPhase)} - - ${pkg.xen.postBuild or ""} - ''; - installPhase = let cpFlags = builtins.toString [ @@ -555,12 +541,6 @@ stdenv.mkDerivation (finalAttrs: { for i in $out/etc/xen/scripts/!(*.sh); do sed --in-place "2s@^@export PATH=$out/bin:${scriptEnvPath}\n@" $i done - '' - - + '' - ${withTools "installPhase" (name: source: source.installPhase)} - - ${pkg.xen.installPhase or ""} ''; postFixup =