mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2025-12-21 21:17:37 -08:00
haskell-cabal.eclass: Add early check for invalid GHC cache
If the GHC cache is invalid, it can create a confusing error during src_compile. Add a check in haskell-cabal-pkg_setup that checks for and fixes an invalid cache. Closes: https://bugs.gentoo.org/916785 Closes: https://bugs.gentoo.org/916971 Closes: https://bugs.gentoo.org/920879 Closes: https://github.com/gentoo-haskell/gentoo-haskell/issues/1469 Thanks-to: Tom Gillespie <tgbugs@gmail.com> Signed-off-by: hololeap <hololeap@protonmail.com> Part-of: https://github.com/gentoo/gentoo/pull/41562 Closes: https://github.com/gentoo/gentoo/pull/41562 Signed-off-by: Arsen Arsenović <arsen@gentoo.org>
This commit is contained in:
parent
78beda50cf
commit
8ae4c6d315
@ -661,6 +661,23 @@ cabal-is-dummy-lib() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# @FUNCTION: cabal-check-cache
|
||||||
|
# @DESCRIPTION:
|
||||||
|
# Check the state of the GHC cache by running 'ghc-pkg check' and looking
|
||||||
|
# for the string "WARNING: cache is out of date". If the string is not found,
|
||||||
|
# the cache is considered valid and the function returns 0. If it is found,
|
||||||
|
# the cache is considered invalid and the function returns 1.
|
||||||
|
cabal-check-cache() {
|
||||||
|
if $(ghc-getghcpkg) check 2>&1 \
|
||||||
|
| grep -q 'WARNING: cache is out of date'
|
||||||
|
then
|
||||||
|
ewarn 'GHC cache is out of date!'
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# exported function: check if cabal is correctly installed for
|
# exported function: check if cabal is correctly installed for
|
||||||
# the currently active ghc (we cannot guarantee this with portage)
|
# the currently active ghc (we cannot guarantee this with portage)
|
||||||
haskell-cabal_pkg_setup() {
|
haskell-cabal_pkg_setup() {
|
||||||
@ -672,6 +689,13 @@ haskell-cabal_pkg_setup() {
|
|||||||
fi
|
fi
|
||||||
if cabal-is-dummy-lib; then
|
if cabal-is-dummy-lib; then
|
||||||
einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
|
einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
|
||||||
|
else
|
||||||
|
# bug 916785
|
||||||
|
if ! cabal-check-cache; then
|
||||||
|
# avoid running ghc-recache-db so as not to set _GHC_RECACHE_CALLED
|
||||||
|
einfo "Recaching GHC package DB"
|
||||||
|
$(ghc-getghcpkg) recache
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user