haskell/generic-buidler: make installPhase handle Cabal 2.5's lax fields

This commit is contained in:
Kosyrev Serge 2019-01-30 04:50:56 +03:00 committed by Peter Simons
parent d8260d6af0
commit e505891a5c

View File

@ -377,6 +377,10 @@ stdenv.mkDerivation ({
runHook postHaddock
'';
# The scary sed expression handles two cases in v2.5 Cabal's package configs:
# 1. 'id: short-name-0.0.1-9yvw8HF06tiAXuxm5U8KjO'
# 2. 'id:\n
# very-long-descriptive-useful-name-0.0.1-9yvw8HF06tiAXuxm5U8KjO'
installPhase = ''
runHook preInstall
@ -391,7 +395,7 @@ stdenv.mkDerivation ({
rmdir "$packageConfFile"
fi
for packageConfFile in "$packageConfDir/"*; do
local pkgId=$( ${gnused}/bin/sed -n -e 's|^id:[ ]\+||p' $packageConfFile )
local pkgId=$( ${gnused}/bin/sed -n -e ':a' -e '/^id:$/N; s/id:\n[ ]*\([^\n]*\).*$/\1/p; s/id:[ ]*\([^\n]*\)$/\1/p; ta' $packageConfFile )
mv $packageConfFile $packageConfDir/$pkgId.conf
done