File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
Cabal/src/Distribution/Simple Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,6 @@ import Prelude ()
85
85
86
86
import Control.Arrow ((***) )
87
87
import Control.Monad (forM_ )
88
- import Data.List (stripPrefix )
89
88
import qualified Data.Map as Map
90
89
import Distribution.CabalSpecVersion
91
90
import Distribution.InstalledPackageInfo (InstalledPackageInfo )
@@ -248,8 +247,14 @@ configure verbosity hcPath hcPkgPath conf0 = do
248
247
compilerId :: CompilerId
249
248
compilerId = CompilerId GHC ghcVersion
250
249
250
+ -- The @AbiTag@ is the @Project Unit Id@ but with redundant information from the compiler version removed.
251
+ -- For development versions of the compiler these look like:
252
+ -- @Project Unit Id@: "ghc-9.13-inplace"
253
+ -- @compilerId@: "ghc-9.13.20250413"
254
+ -- So, we need to be careful to only strip the /common/ prefix.
255
+ -- In this example, @AbiTag@ is "inplace".
251
256
compilerAbiTag :: AbiTag
252
- compilerAbiTag = maybe NoAbiTag AbiTag (Map. lookup " Project Unit Id " ghcInfoMap >>= stripPrefix (prettyShow compilerId <> " - " ) )
257
+ compilerAbiTag = maybe NoAbiTag AbiTag (dropWhile ( == ' - ' ) . stripCommonPrefix (prettyShow compilerId) <$> Map. lookup " Project Unit Id " ghcInfoMap )
253
258
254
259
let comp =
255
260
Compiler
Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ module Distribution.Simple.Utils
195
195
, unintersperse
196
196
, wrapText
197
197
, wrapLine
198
+ , stripCommonPrefix
198
199
199
200
-- * FilePath stuff
200
201
, isAbsoluteOnAnyPlatform
@@ -2062,3 +2063,10 @@ findHookedPackageDesc verbosity mbWorkDir dir = do
2062
2063
2063
2064
buildInfoExt :: String
2064
2065
buildInfoExt = " .buildinfo"
2066
+
2067
+ -- | @stripCommonPrefix xs ys@ gives you @ys@ without the common prefix with @xs@.
2068
+ stripCommonPrefix :: String -> String -> String
2069
+ stripCommonPrefix (x : xs) (y : ys)
2070
+ | x == y = stripCommonPrefix xs ys
2071
+ | otherwise = y : ys
2072
+ stripCommonPrefix _ ys = ys
Original file line number Diff line number Diff line change
1
+ synopsis: Fix parsing the AbiTag with development versions of GHC
2
+ packages: Cabal
3
+ prs: #10979
4
+ issues: #10170
5
+
6
+ description: {
7
+ - Allow parsing the AbiTag for developmement versions of GHC.
8
+ }
You can’t perform that action at this time.
0 commit comments