3 , module Stackage.Types
6import Data.Map as X (Map)
7import Data.Map (unionWith)
8import Data.Monoid (Monoid (..))
9import Data.Set as X (Set)
10import Data.Version as X (Version)
11import Distribution.Package as X (PackageIdentifier (..),
13import Distribution.PackageDescription (GenericPackageDescription)
14import Distribution.Version as X (VersionRange (..))
15import Distribution.Version (intersectVersionRanges)
17newtype PackageDB = PackageDB (Map PackageName PackageInfo)
20instance Monoid PackageDB where
21 mempty = PackageDB mempty
22 PackageDB x `mappend` PackageDB y =
23 PackageDB $ unionWith newest x y
26 | piVersion pi1 > piVersion pi2 = pi1
29data PackageInfo = PackageInfo
30 { piVersion :: Version
31 , piDeps :: Map PackageName VersionRange
33 , piBuildToolsExe :: Set Executable -- ^ required just for building executable/lib
34 , piBuildToolsAll :: Set Executable -- ^ required for all stanzas
35 , piGPD :: Maybe GenericPackageDescription
36 , piExecs :: Set Executable
37 , piGithubUser :: Maybe String
41newtype Executable = Executable String
42 deriving (Show, Eq, Ord)
44-- | Information on a package we're going to build.
45data BuildInfo = BuildInfo
46 { biVersion :: Version
47 , biUsers :: [PackageName]
48 , biMaintainer :: Maintainer
49 , biDeps :: Map PackageName VersionRange
50 , biGithubUser :: Maybe String
54data HaskellPlatform = HaskellPlatform
55 { hpcore :: Set PackageIdentifier
56 , hplibs :: Set PackageIdentifier
58 deriving (Show, Eq, Ord)
59instance Monoid HaskellPlatform where
60 mempty = HaskellPlatform mempty mempty
61 HaskellPlatform a x `mappend` HaskellPlatform b y = HaskellPlatform (mappend a b) (mappend x y)
63data InstallInfo = InstallInfo
64 { iiCore :: Map PackageName (Maybe Version)
65 , iiPackages :: Map PackageName SelectedPackageInfo
66 , iiOptionalCore :: Map PackageName Version
67 -- ^ This is intended to hold onto packages which might be automatically
68 -- provided in the global package database. In practice, this would be
69 -- Haskell Platform packages provided by distributions.
70 , iiPackageDB :: PackageDB
73data SelectedPackageInfo = SelectedPackageInfo
74 { spiVersion :: Version
75 , spiMaintainer :: Maintainer
76 , spiGithubUser :: Maybe String
81data BuildPlan = BuildPlan
83 , bpPackages :: Map PackageName SelectedPackageInfo
84 , bpCore :: Map PackageName (Maybe Version)
85 , bpOptionalCore :: Map PackageName Version
86 -- ^ See 'iiOptionalCore'
87 , bpSkippedTests :: Set PackageName
90-- | Email address of a Stackage maintainer.
91newtype Maintainer = Maintainer { unMaintainer :: String }
92 deriving (Show, Eq, Ord, Read)
94data SelectSettings = SelectSettings
95 { haskellPlatformDir :: FilePath
96 , flags :: Map PackageName Version -> Set String
97 -- ^ Compile flags which should be turned on. Takes a Map providing the
98 -- core packages so that flags can be set appropriately.
99 , disabledFlags :: Set String
100 -- ^ Compile flags which should always be disabled.
101 , extraCore :: Set PackageName
102 , ignoreUpgradeableCore :: Bool
103 -- ^ Do not pin down the versions of upgradeable core packages.
104 , requireHaskellPlatform :: Bool
105 , allowedPackage :: GenericPackageDescription -> Either String ()
106 -- ^ Checks if a package is allowed into the distribution. By default, we
107 -- allow all packages in, though this could be used to filter out certain
108 -- untrusted packages, or packages with an unacceptable license.
110 -- Returns a reason for stripping in Left, or Right if the package is
112 , expectedFailuresSelect :: Set PackageName
113 , excludedPackages :: Set PackageName
114 -- ^ Packages which should be dropped from the list of stable packages,
115 -- even if present via the Haskell Platform or @stablePackages@. If these
116 -- packages are dependencies of others, they will still be included.
117 , stablePackages :: Bool -- ^ require Haskell Platform?
118 -> Map PackageName (VersionRange, Maintainer)
119 , useGlobalDatabase :: Bool
120 -- ^ Instead of checking the Haskell Platform file for core packages, query
121 -- the global database. For this to be reliable, you should only have
122 -- default packages in your global database. Default is @False@.
123 , skippedTests :: Set PackageName
124 -- ^ Do not build or run test suites, usually in order to avoid a
126 , selectGhcVersion :: GhcMajorVersion
127 , selectTarballDir :: FilePath
128 -- ^ Directory containing replacement tarballs.
131data BuildStage = BSTools | BSBuild | BSTest
133data BuildSettings = BuildSettings
134 { sandboxRoot :: FilePath
135 , extraArgs :: BuildStage -> [String]
136 , expectedFailuresBuild :: Set PackageName
137 , testWorkerThreads :: Int
138 -- ^ How many threads to spawn for running test suites.
140 -- ^ Build docs as part of the test procedure.
141 , tarballDir :: FilePath
142 -- ^ Directory containing replacement tarballs.
143 , cabalFileDir :: Maybe FilePath
144 -- ^ Directory to place cabal files in
147-- | A wrapper around a @Map@ providing a better @Monoid@ instance.
148newtype PackageMap = PackageMap { unPackageMap :: Map PackageName (VersionRange, Maintainer) }
150instance Monoid PackageMap where
151 mempty = PackageMap mempty
152 PackageMap x `mappend` PackageMap y =
153 PackageMap $ unionWith go x y
155 go (r1, m1) (r2, _) = (intersectVersionRanges r1 r2, m1)
157-- | GHC major version. For example, for GHC 7.4.2, this would be 7 4.
158data GhcMajorVersion = GhcMajorVersion Int Int
159 deriving (Show, Ord, Eq)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list