From a04606a1597fc4cceea4fa8ac95d85a26ddae013 Mon Sep 17 00:00:00 2001 From: Sergey Alirzaev Date: Fri, 21 Jul 2023 15:26:47 +0200 Subject: [PATCH] Handle hadrian-based GHC installations with an ugly hack fixes https://github.com/gentoo-haskell/haskell-updater/issues/20 --- Distribution/Gentoo/GHC.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Distribution/Gentoo/GHC.hs b/Distribution/Gentoo/GHC.hs index f6b9043..2888ff0 100644 --- a/Distribution/Gentoo/GHC.hs +++ b/Distribution/Gentoo/GHC.hs @@ -236,8 +236,12 @@ checkLibDirs v thisGhc libDirs = isValid dir = any (`isGhcLibDir` dir) libDirs + -- Correct the path for hadrian-based installations + -- See https://github.com/gentoo-haskell/haskell-updater/issues/20 + thisGhc' = if BS.isSuffixOf (BS.pack "/lib") thisGhc then BS.dropEnd 4 thisGhc else thisGhc + -- Invalid if it's this GHC - isInvalid fp = fp == thisGhc || BS.isPrefixOf (thisGhc `BS.snoc` pathSeparator) fp + isInvalid fp = fp == thisGhc' || BS.isPrefixOf (thisGhc' `BS.snoc` pathSeparator) fp -- A valid GHC library directory starting at libdir has a name of -- "ghc", then a hyphen and then a version number.