mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-23 20:51:57 +01:00
Ignore pre-installed HP packages
This commit is contained in:
parent
3336356fd0
commit
48c9d56a73
@ -2,25 +2,37 @@ module Stackage.CheckPlan
|
|||||||
( checkPlan
|
( checkPlan
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (unless)
|
import Control.Monad (unless, when)
|
||||||
import Data.List (sort)
|
import Data.List (isPrefixOf, sort)
|
||||||
|
import qualified Data.Map as Map
|
||||||
|
import qualified Data.Set as Set
|
||||||
import Stackage.InstallInfo
|
import Stackage.InstallInfo
|
||||||
import Stackage.Types
|
import Stackage.Types
|
||||||
import System.Exit (ExitCode (ExitFailure), exitWith)
|
import Stackage.Util
|
||||||
import System.Process (readProcess)
|
import System.Exit (ExitCode (ExitFailure, ExitSuccess),
|
||||||
|
exitWith)
|
||||||
|
import System.Process (readProcessWithExitCode)
|
||||||
|
|
||||||
data Mismatch = OnlyDryRun String | OnlySimpleList String
|
data Mismatch = OnlyDryRun String | OnlySimpleList String
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
checkPlan :: InstallInfo -> IO ()
|
checkPlan :: InstallInfo -> IO ()
|
||||||
checkPlan ii = do
|
checkPlan ii = do
|
||||||
dryRun' <- readProcess "cabal-dev" ("install":"--dry-run":"-fnetwork23":iiPackageList ii) ""
|
(ec, dryRun', stderr) <- readProcessWithExitCode "cabal-dev" ("install":"--dry-run":"-fnetwork23":iiPackageList ii) ""
|
||||||
let dryRun = sort $ drop 2 $ lines dryRun'
|
when (ec /= ExitSuccess || "Warning:" `isPrefixOf` stderr) $ do
|
||||||
let mismatches = getMismatches dryRun (iiPackageList ii)
|
putStr stderr
|
||||||
|
putStr dryRun'
|
||||||
|
putStrLn "cabal-dev returned a bad result, exiting"
|
||||||
|
exitWith ec
|
||||||
|
let dryRun = sort $ filter notOptionalCore $ map (takeWhile (/= ' ')) $ drop 2 $ lines dryRun'
|
||||||
|
let mismatches = getMismatches dryRun (filter notOptionalCore $ iiPackageList ii)
|
||||||
unless (null mismatches) $ do
|
unless (null mismatches) $ do
|
||||||
putStrLn "Found the following mismtaches"
|
putStrLn "Found the following mismtaches"
|
||||||
mapM_ print mismatches
|
mapM_ print mismatches
|
||||||
exitWith $ ExitFailure 1
|
exitWith $ ExitFailure 1
|
||||||
|
where
|
||||||
|
optionalCore = Set.fromList $ map packageVersionString $ Map.toList $ iiOptionalCore ii
|
||||||
|
notOptionalCore s = not $ s `Set.member` optionalCore
|
||||||
|
|
||||||
getMismatches :: [String] -> [String] -> [Mismatch]
|
getMismatches :: [String] -> [String] -> [Mismatch]
|
||||||
getMismatches =
|
getMismatches =
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
module Stackage.Config where
|
module Stackage.Config where
|
||||||
|
|
||||||
import Control.Monad (unless, when)
|
|
||||||
import Control.Monad.Trans.Writer (execWriter, tell)
|
import Control.Monad.Trans.Writer (execWriter, tell)
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import Data.Set (fromList, singleton)
|
import Data.Set (fromList, singleton)
|
||||||
import Distribution.System (OS (..), buildOS)
|
|
||||||
import Distribution.Text (simpleParse)
|
import Distribution.Text (simpleParse)
|
||||||
import Stackage.Types
|
import Stackage.Types
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ getInstallInfo = do
|
|||||||
return InstallInfo
|
return InstallInfo
|
||||||
{ iiCore = totalCore
|
{ iiCore = totalCore
|
||||||
, iiPackages = Map.map fst final
|
, iiPackages = Map.map fst final
|
||||||
|
, iiOptionalCore = Map.fromList $ map (\(PackageIdentifier p v) -> (p, v)) $ Set.toList $ hplibs hp
|
||||||
}
|
}
|
||||||
|
|
||||||
showDep :: (PackageName, (Version, [PackageName])) -> String
|
showDep :: (PackageName, (Version, [PackageName])) -> String
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
module Stackage.LoadDatabase where
|
module Stackage.LoadDatabase where
|
||||||
|
|
||||||
import qualified Codec.Archive.Tar as Tar
|
import qualified Codec.Archive.Tar as Tar
|
||||||
import Control.Exception (throwIO)
|
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
import qualified Data.ByteString.Lazy.Char8 as L8
|
import qualified Data.ByteString.Lazy.Char8 as L8
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
|
|||||||
@ -3,7 +3,6 @@ module Stackage.Tarballs
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Codec.Archive.Tar as Tar
|
import qualified Codec.Archive.Tar as Tar
|
||||||
import Control.Exception (throwIO)
|
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
|
|||||||
@ -42,4 +42,8 @@ instance Monoid HaskellPlatform where
|
|||||||
data InstallInfo = InstallInfo
|
data InstallInfo = InstallInfo
|
||||||
{ iiCore :: Set PackageName
|
{ iiCore :: Set PackageName
|
||||||
, iiPackages :: Map PackageName Version
|
, iiPackages :: Map PackageName Version
|
||||||
|
, iiOptionalCore :: Map PackageName Version
|
||||||
|
-- ^ This is intended to hold onto packages which might be automatically
|
||||||
|
-- provided in the global package database. In practice, this would be
|
||||||
|
-- Haskell Platform packages provided by distributions.
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user