haskell.lib.buildFromSdist: add test, fix double-patch

Same issue as buildFromCabalSdist: sdistTarball applies patches via
overrideDerivation, but the patches attribute remained, causing
patchPhase to apply them again.
This commit is contained in:
Robert Hensing
2025-12-28 15:31:09 +01:00
parent 5a38e15e6d
commit b6a3b8846e
2 changed files with 15 additions and 1 deletions

View File

@@ -482,10 +482,11 @@ rec {
overrideCabal (drv: {
src = "${sdistTarball pkg}/${pkg.pname}-${pkg.version}.tar.gz";
# Revising and jailbreaking the cabal file has been handled in sdistTarball
# Revising, jailbreaking and patches have been handled in sdistTarball
revision = null;
editedCabalFile = null;
jailbreak = false;
patches = [ ];
}) pkg;
/*

View File

@@ -57,4 +57,17 @@ lib.recurseIntoAttrs rec {
${lib.getExe localPatchedFromCabalSdist} | grep "Patched" >/dev/null
touch $out
'';
# Test that buildFromSdist (non-cabal-install variant) also respects patches.
localPatchedFromSdist = haskell.lib.buildFromSdist localPatched;
patchRespectedSdist =
runCommand "patchRespectedSdist"
{
nativeBuildInputs = [ localPatchedFromSdist ];
}
''
${lib.getExe localPatchedFromSdist} | grep "Patched" >/dev/null
touch $out
'';
}