Skip to content

Commit e3cd6e0

Browse files
committed
Fix datadir for tests and benchmarks
Broken by #1732
1 parent bd6e4e8 commit e3cd6e0

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

builder/comp-builder.nix

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,28 @@ let
461461
in ''
462462
runHook preInstall
463463
${ # `Setup copy` does not install tests and benchmarks.
464-
lib.optionalString (!haskellLib.isTest componentId && !haskellLib.isBenchmark componentId) ''
465-
$SETUP_HS copy ${lib.concatStringsSep " " (
466-
setupInstallFlags
467-
++ lib.optional configureAllComponents
468-
(haskellLib.componentTarget componentId)
469-
)}''}
464+
if !haskellLib.isTest componentId && !haskellLib.isBenchmark componentId
465+
then ''
466+
$SETUP_HS copy ${lib.concatStringsSep " " (
467+
setupInstallFlags
468+
++ lib.optional configureAllComponents
469+
(haskellLib.componentTarget componentId)
470+
)}''
471+
else
472+
# However if there are exes or libraries it does copy the datadir.
473+
# So run it, but expect it might complain there was nothing to do.
474+
''
475+
SETUP_OUTPUT=$(mktemp)
476+
if $SETUP_HS copy ${lib.concatStringsSep " " (
477+
setupInstallFlags
478+
++ lib.optional configureAllComponents
479+
(haskellLib.componentTarget componentId)
480+
)} 2>&1 | tee $SETUP_OUTPUT; then
481+
echo Setup copy success
482+
else
483+
cat $SETUP_OUTPUT | grep 'Error: Setup: No executables and no library found\. Nothing to do\.'
484+
fi
485+
''}
470486
${lib.optionalString (haskellLib.isLibrary componentId) ''
471487
$SETUP_HS register --gen-pkg-config=${name}.conf
472488
${ghc.targetPrefix}ghc-pkg -v0 init $out/package.conf.d

0 commit comments

Comments
 (0)