Allow containers-unicode-symbols #58

We need to be able to select which flags to pass based on the selected core
packages, so that we can pass containers-old.
This commit is contained in:
Michael Snoyman 2013-04-10 09:24:16 +03:00
parent f920646c6f
commit 26e3408196
5 changed files with 19 additions and 11 deletions

View File

@ -140,10 +140,8 @@ defaultStablePackages = unPackageMap $ execWriter $ do
mapM_ (add "Felipe Lessa <felipe.lessa@gmail.com>") $ words mapM_ (add "Felipe Lessa <felipe.lessa@gmail.com>") $ words
"esqueleto fb fb-persistent yesod-fb yesod-auth-fb" "esqueleto fb fb-persistent yesod-fb yesod-auth-fb"
-- Requires containers 0.5 mapM_ (add "Alexander Altman <alexanderaltman@me.com>") $ words
-- https://github.com/fpco/stackage/issues/58 "base-unicode-symbols containers-unicode-symbols"
-- mapM_ (add "Alexander Altman <alexanderaltman@me.com>") $ words
-- "base-unicode-symbols containers-unicode-symbols"
-- https://github.com/fpco/stackage/issues/46 -- https://github.com/fpco/stackage/issues/46
addRange "Michael Snoyman" "QuickCheck" "< 2.6" addRange "Michael Snoyman" "QuickCheck" "< 2.6"

View File

@ -46,7 +46,7 @@ getInstallInfo settings = do
let totalCore = extraCore settings `Set.union` Set.map (\(PackageIdentifier p _) -> p) core let totalCore = extraCore settings `Set.union` Set.map (\(PackageIdentifier p _) -> p) core
putStrLn "Loading package database" putStrLn "Loading package database"
pdb <- loadPackageDB settings totalCore allPackages pdb <- loadPackageDB settings coreMap totalCore allPackages
putStrLn "Narrowing package database" putStrLn "Narrowing package database"
final <- narrowPackageDB settings totalCore pdb $ Set.fromList $ Map.toList $ Map.map snd $ allPackages final <- narrowPackageDB settings totalCore pdb $ Set.fromList $ Map.toList $ Map.map snd $ allPackages

View File

@ -54,10 +54,11 @@ import Stackage.Util
-- --
-- * For other packages, select the maximum version number. -- * For other packages, select the maximum version number.
loadPackageDB :: SelectSettings loadPackageDB :: SelectSettings
-> Set PackageName -- ^ core packages -> Map PackageName Version -- ^ core packages from HP file
-> Set PackageName -- ^ all core packages, including extras
-> Map PackageName (VersionRange, Maintainer) -- ^ additional deps -> Map PackageName (VersionRange, Maintainer) -- ^ additional deps
-> IO PackageDB -> IO PackageDB
loadPackageDB settings core deps = do loadPackageDB settings coreMap core deps = do
tarName <- getTarballName tarName <- getTarballName
lbs <- L.readFile tarName lbs <- L.readFile tarName
addEntries mempty $ Tar.read lbs addEntries mempty $ Tar.read lbs
@ -139,7 +140,7 @@ loadPackageDB settings core deps = do
checkCond' (CAnd c1 c2) = checkCond' c1 && checkCond' c2 checkCond' (CAnd c1 c2) = checkCond' c1 && checkCond' c2
flags' = map flagName (filter flagDefault $ genPackageFlags gpd) ++ flags' = map flagName (filter flagDefault $ genPackageFlags gpd) ++
(map FlagName $ Set.toList $ Stackage.Types.flags settings) (map FlagName $ Set.toList $ Stackage.Types.flags settings coreMap)
-- | Attempt to grab the Github username from a homepage. -- | Attempt to grab the Github username from a homepage.
parseGithubUserHP :: String -> Maybe String parseGithubUserHP :: String -> Maybe String

View File

@ -8,6 +8,8 @@ import qualified Data.Map as Map
import Data.Maybe (mapMaybe) import Data.Maybe (mapMaybe)
import Data.Set (empty) import Data.Set (empty)
import qualified Data.Set as Set import qualified Data.Set as Set
import Distribution.Text (simpleParse)
import Distribution.Version (withinRange)
import Prelude hiding (pi) import Prelude hiding (pi)
import Stackage.Config import Stackage.Config
import Stackage.InstallInfo import Stackage.InstallInfo
@ -22,7 +24,13 @@ defaultSelectSettings = SelectSettings
, haskellPlatformCabal = "haskell-platform/haskell-platform.cabal" , haskellPlatformCabal = "haskell-platform/haskell-platform.cabal"
, requireHaskellPlatform = True , requireHaskellPlatform = True
, excludedPackages = empty , excludedPackages = empty
, flags = Set.fromList $ words "blaze_html_0_5" , flags = \coreMap ->
Set.fromList (words "blaze_html_0_5") `Set.union`
-- Support for containers-unicode-symbols
(case Map.lookup (PackageName "containers") coreMap of
Just v | Just range <- simpleParse "< 0.5", v `withinRange` range
-> Set.singleton "containers-old"
_ -> Set.empty)
, disabledFlags = Set.fromList $ words "bytestring-in-base" , disabledFlags = Set.fromList $ words "bytestring-in-base"
, allowedPackage = const $ Right () , allowedPackage = const $ Right ()
, useGlobalDatabase = False , useGlobalDatabase = False

View File

@ -91,8 +91,9 @@ newtype Maintainer = Maintainer { unMaintainer :: String }
data SelectSettings = SelectSettings data SelectSettings = SelectSettings
{ haskellPlatformCabal :: FilePath { haskellPlatformCabal :: FilePath
, flags :: Set String , flags :: Map PackageName Version -> Set String
-- ^ Compile flags which should be turned on. -- ^ Compile flags which should be turned on. Takes a Map providing the
-- core packages so that flags can be set appropriately.
, disabledFlags :: Set String , disabledFlags :: Set String
-- ^ Compile flags which should always be disabled. -- ^ Compile flags which should always be disabled.
, extraCore :: Set PackageName , extraCore :: Set PackageName