Commit 2b2634ed authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Make finalizePackageDescription use CompilerId type

Use the proper data type rather than a tuple (CompilerFlavor, Version)
parent 3c01c8a5
......@@ -56,8 +56,9 @@ import Distribution.PackageDescription
import Distribution.Simple.PackageIndex (PackageIndex)
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Version
( Version(..), VersionRange(..), withinRange )
import Distribution.Compiler (CompilerFlavor)
( VersionRange(..), withinRange )
import Distribution.Compiler
( CompilerId(CompilerId) )
import Distribution.System
( OS, Arch )
import Distribution.Simple.Utils (currentDir, lowercase)
......@@ -112,9 +113,9 @@ simplifyCondition cond i = fv . walk $ cond
-- | Simplify a configuration condition using the os and arch names. Returns
-- the names of all the flags occurring in the condition.
simplifyWithSysParams :: OS -> Arch -> (CompilerFlavor, Version) -> Condition ConfVar
simplifyWithSysParams :: OS -> Arch -> CompilerId -> Condition ConfVar
-> (Condition ConfFlag, [String])
simplifyWithSysParams os arch (comp, compVer) cond = (cond', flags)
simplifyWithSysParams os arch (CompilerId comp compVer) cond = (cond', flags)
where
(cond', fvs) = simplifyCondition cond interp
interp (OS os') = Right $ os' == os
......@@ -224,7 +225,7 @@ resolveWithFlags :: Monoid a =>
-- ^ Domain for each flag name, will be tested in order.
-> OS -- ^ OS as returned by Distribution.System.buildOS
-> Arch -- ^ Arch as returned by Distribution.System.buildArch
-> (CompilerFlavor, Version) -- ^ Compiler flavour + version
-> CompilerId -- ^ Compiler flavour + version
-> [Dependency] -- ^ Additional constraints
-> [CondTree ConfVar [Dependency] a]
-> ([Dependency] -> DepTestRslt [Dependency]) -- ^ Dependency test function.
......@@ -383,7 +384,7 @@ finalizePackageDescription ::
-- this is unknown.
-> OS -- ^ OS-name
-> Arch -- ^ Arch-name
-> (CompilerFlavor, Version) -- ^ Compiler + Version
-> CompilerId -- ^ Compiler + Version
-> [Dependency] -- ^ Additional constraints
-> GenericPackageDescription
-> Either [Dependency]
......
......@@ -81,4 +81,3 @@ readP_to_E err r =
, all isSpace s ]
of [] -> Left (err txt)
(p:_) -> Right p
\ No newline at end of file
......@@ -56,7 +56,7 @@ module Distribution.Simple.Configure (configure,
where
import Distribution.Simple.Compiler
( CompilerFlavor(..), Compiler, compilerFlavor, compilerVersion
( CompilerFlavor(..), Compiler(compilerId), compilerFlavor, compilerVersion
, showCompilerId, unsupportedExtensions, PackageDB(..) )
import Distribution.Package
( PackageIdentifier(PackageIdentifier), packageVersion, Package(..)
......@@ -157,25 +157,25 @@ tryGetConfigStateFile filename = do
return str
checkHeader :: String -> Maybe String
checkHeader header = case parseHeader header of
Just (cabalId, compilerId)
Just (cabalId, compId)
| cabalId
== currentCabalId -> Nothing
| otherwise -> Just (badVersion cabalId compilerId)
| otherwise -> Just (badVersion cabalId compId)
Nothing -> Just cantParse
missing = "Run the 'configure' command first."
cantParse = "Saved package config file seems to be corrupt. "
++ "Try re-running the 'configure' command."
badVersion cabalId compilerId
badVersion cabalId compId
= "You need to re-run the 'configure' command. "
++ "The version of Cabal being used has changed (was "
++ display cabalId ++ ", now "
++ display currentCabalId ++ ")."
++ badcompiler compilerId
badcompiler compilerId | compilerId == currentCompilerId = ""
| otherwise
++ badcompiler compId
badcompiler compId | compId == currentCompilerId = ""
| otherwise
= " Additionally the compiler is different (was "
++ display compilerId ++ ", now "
++ display compId ++ ", now "
++ display currentCompilerId
++ ") which is probably the cause of the problem."
......@@ -295,7 +295,7 @@ configure (pkg_descr0, pbi) cfg
maybePackageIndex
Distribution.System.buildOS
Distribution.System.buildArch
(flavor, version)
(compilerId comp)
(configConstraints cfg)
ppd
of Right r -> return r
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment