1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

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 <alpha@sigmasquadron.net>
This commit is contained in:
Fernando Rodrigues 2024-08-11 16:34:54 +00:00
parent 37eddc4f7e
commit 49433ed9cc
No known key found for this signature in database
GPG key ID: CC3AE2EA00000000

View file

@ -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 =