Commit f433d263 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Change UserHooks.confHook to use simply GenericPackageDescription

Rather than Either GenericPackageDescription PackageDescription
In principle this is an interface change that could break Setup.hs
scripts but in practise the few scripts that use confHook just pass
the arguments through and so are not sensitve to the type change.
parent 8814b950
...@@ -212,7 +212,7 @@ configureAction hooks flags args = do ...@@ -212,7 +212,7 @@ configureAction hooks flags args = do
-- get_pkg_descr (configVerbosity flags') -- get_pkg_descr (configVerbosity flags')
--let pkg_descr = updatePackageDescription pbi pkg_descr0 --let pkg_descr = updatePackageDescription pbi pkg_descr0
let epkg_descr = (Left pkg_descr0, pbi) let epkg_descr = (pkg_descr0, pbi)
--(warns, ers) <- sanityCheckPackage pkg_descr --(warns, ers) <- sanityCheckPackage pkg_descr
--errorOut (configVerbosity flags') warns ers --errorOut (configVerbosity flags') warns ers
......
...@@ -266,13 +266,11 @@ localBuildInfoFile distPref = distPref </> "setup-config" ...@@ -266,13 +266,11 @@ localBuildInfoFile distPref = distPref </> "setup-config"
-- |Perform the \"@.\/setup configure@\" action. -- |Perform the \"@.\/setup configure@\" action.
-- Returns the @.setup-config@ file. -- Returns the @.setup-config@ file.
configure :: ( Either GenericPackageDescription PackageDescription configure :: (GenericPackageDescription, HookedBuildInfo)
, HookedBuildInfo)
-> ConfigFlags -> IO LocalBuildInfo -> ConfigFlags -> IO LocalBuildInfo
configure (e_pkg_descr, pbi) cfg configure (pkg_descr0, pbi) cfg
= do let distPref = fromFlag (configDistPref cfg) = do let distPref = fromFlag (configDistPref cfg)
verbosity = fromFlag (configVerbosity cfg) verbosity = fromFlag (configVerbosity cfg)
pkg_descr0 = either packageDescription id e_pkg_descr
setupMessage verbosity "Configuring" (packageId pkg_descr0) setupMessage verbosity "Configuring" (packageId pkg_descr0)
...@@ -309,7 +307,7 @@ configure (e_pkg_descr, pbi) cfg ...@@ -309,7 +307,7 @@ configure (e_pkg_descr, pbi) cfg
-- need to pre-scan the conditional data to make a list of all private -- need to pre-scan the conditional data to make a list of all private
-- libraries that could possibly be defined by the .cabal file. -- libraries that could possibly be defined by the .cabal file.
let internalPackageSet = PackageIndex.fromList [ emptyInstalledPackageInfo { let internalPackageSet = PackageIndex.fromList [ emptyInstalledPackageInfo {
Installed.package = package pkg_descr0 Installed.package = packageId pkg_descr0
} ] } ]
maybeInstalledPackageSet <- getInstalledPackages (lessVerbose verbosity) comp maybeInstalledPackageSet <- getInstalledPackages (lessVerbose verbosity) comp
packageDbs programsConfig' packageDbs programsConfig'
...@@ -317,8 +315,7 @@ configure (e_pkg_descr, pbi) cfg ...@@ -317,8 +315,7 @@ configure (e_pkg_descr, pbi) cfg
let maybePackageSet = (`PackageIndex.merge` internalPackageSet) let maybePackageSet = (`PackageIndex.merge` internalPackageSet)
`fmap` maybeInstalledPackageSet `fmap` maybeInstalledPackageSet
(pkg_descr0', flags) <- case e_pkg_descr of (pkg_descr0', flags) <-
Left ppd ->
case finalizePackageDescription case finalizePackageDescription
(configConfigurationsFlags cfg) (configConfigurationsFlags cfg)
maybePackageSet maybePackageSet
...@@ -326,7 +323,7 @@ configure (e_pkg_descr, pbi) cfg ...@@ -326,7 +323,7 @@ configure (e_pkg_descr, pbi) cfg
Distribution.System.buildArch Distribution.System.buildArch
(compilerId comp) (compilerId comp)
(configConstraints cfg) (configConstraints cfg)
ppd pkg_descr0
of Right r -> return r of Right r -> return r
Left missing -> Left missing ->
die $ "At least the following dependencies are missing:\n" die $ "At least the following dependencies are missing:\n"
...@@ -334,7 +331,6 @@ configure (e_pkg_descr, pbi) cfg ...@@ -334,7 +331,6 @@ configure (e_pkg_descr, pbi) cfg
[ disp (Dependency name range') [ disp (Dependency name range')
| Dependency name range <- missing | Dependency name range <- missing
, let range' = simplifyVersionRange range ] , let range' = simplifyVersionRange range ]
Right pd -> return (pd,[])
-- add extra include/lib dirs as specified in cfg -- add extra include/lib dirs as specified in cfg
-- we do it here so that those get checked too -- we do it here so that those get checked too
...@@ -345,8 +341,7 @@ configure (e_pkg_descr, pbi) cfg ...@@ -345,8 +341,7 @@ configure (e_pkg_descr, pbi) cfg
++ intercalate ", " [ name ++ "=" ++ display value ++ intercalate ", " [ name ++ "=" ++ display value
| (FlagName name, value) <- flags ] | (FlagName name, value) <- flags ]
checkPackageProblems verbosity checkPackageProblems verbosity (Just pkg_descr0)
(either Just (\_->Nothing) e_pkg_descr) --TODO: make the Either go away
(updatePackageDescription pbi pkg_descr) (updatePackageDescription pbi pkg_descr)
let installedPackageSet = fromMaybe bogusPackageSet maybeInstalledPackageSet let installedPackageSet = fromMaybe bogusPackageSet maybeInstalledPackageSet
......
...@@ -92,8 +92,7 @@ data UserHooks = UserHooks { ...@@ -92,8 +92,7 @@ data UserHooks = UserHooks {
-- |Hook to run before configure command -- |Hook to run before configure command
preConf :: Args -> ConfigFlags -> IO HookedBuildInfo, preConf :: Args -> ConfigFlags -> IO HookedBuildInfo,
-- |Over-ride this hook to get different behavior during configure. -- |Over-ride this hook to get different behavior during configure.
confHook :: ( Either GenericPackageDescription PackageDescription confHook :: (GenericPackageDescription, HookedBuildInfo)
, HookedBuildInfo)
-> ConfigFlags -> IO LocalBuildInfo, -> ConfigFlags -> IO LocalBuildInfo,
-- |Hook to run after configure command -- |Hook to run after configure command
postConf :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO (), postConf :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO (),
......
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