Commit 685fe44a authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Simplify checkPackageProblems function

Since we now always have a GenericPackageDescription
parent f433d263
...@@ -87,8 +87,7 @@ import Distribution.PackageDescription as PD ...@@ -87,8 +87,7 @@ import Distribution.PackageDescription as PD
import Distribution.PackageDescription.Configuration import Distribution.PackageDescription.Configuration
( finalizePackageDescription ) ( finalizePackageDescription )
import Distribution.PackageDescription.Check import Distribution.PackageDescription.Check
( PackageCheck(..) ( PackageCheck(..), checkPackage, checkPackageFiles )
, checkPackage, checkConfiguredPackage, checkPackageFiles )
import Distribution.Simple.Program import Distribution.Simple.Program
( Program(..), ProgramLocation(..), ConfiguredProgram(..) ( Program(..), ProgramLocation(..), ConfiguredProgram(..)
, ProgramConfiguration, defaultProgramConfiguration , ProgramConfiguration, defaultProgramConfiguration
...@@ -341,7 +340,7 @@ configure (pkg_descr0, pbi) cfg ...@@ -341,7 +340,7 @@ configure (pkg_descr0, pbi) cfg
++ intercalate ", " [ name ++ "=" ++ display value ++ intercalate ", " [ name ++ "=" ++ display value
| (FlagName name, value) <- flags ] | (FlagName name, value) <- flags ]
checkPackageProblems verbosity (Just pkg_descr0) checkPackageProblems verbosity pkg_descr0
(updatePackageDescription pbi pkg_descr) (updatePackageDescription pbi pkg_descr)
let installedPackageSet = fromMaybe bogusPackageSet maybeInstalledPackageSet let installedPackageSet = fromMaybe bogusPackageSet maybeInstalledPackageSet
...@@ -901,14 +900,12 @@ checkForeignDeps pkg lbi verbosity = do ...@@ -901,14 +900,12 @@ checkForeignDeps pkg lbi verbosity = do
-- | Output package check warnings and errors. Exit if any errors. -- | Output package check warnings and errors. Exit if any errors.
checkPackageProblems :: Verbosity checkPackageProblems :: Verbosity
-> Maybe GenericPackageDescription -> GenericPackageDescription
-> PackageDescription -> PackageDescription
-> IO () -> IO ()
checkPackageProblems verbosity mgpkg pkg = do checkPackageProblems verbosity gpkg pkg = do
ioChecks <- checkPackageFiles pkg "." ioChecks <- checkPackageFiles pkg "."
let pureChecks = case mgpkg of let pureChecks = checkPackage gpkg (Just pkg)
Just gpkg -> checkPackage gpkg (Just pkg)
Nothing -> checkConfiguredPackage pkg
errors = [ e | PackageBuildImpossible e <- pureChecks ++ ioChecks ] errors = [ e | PackageBuildImpossible e <- pureChecks ++ ioChecks ]
warnings = [ w | PackageBuildWarning w <- pureChecks ++ ioChecks ] warnings = [ w | PackageBuildWarning w <- pureChecks ++ ioChecks ]
if null errors if null errors
......
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