on master help sign in
Remove all old code

Now constraints are always taken from a config file, meaning that executables do not need to be recompiled for every settings change.

commit11f9b73cf33657f96f18283b57cbe4a59775d506 authorMichael Snoyman <michael@snoyman.com> dateMon 15 Dec 2014, 07:49 (12 years ago) parent0dfc7ff
25 files changed+122−3209
Stackage/Build.hs−116 Stackage/BuildPlan.hs−186 Stackage/CheckCabalVersion.hs−27 Stackage/CheckPlan.hs−73 Stackage/Config.hs+6−840 Stackage/GhcPkg.hs−49 Stackage/Init.hs−32 Stackage/InstallInfo.hs−211 Stackage/LoadDatabase.hs−264 Stackage/ModuleNameConflict.hs−52 Stackage/NarrowDatabase.hs−54 Stackage/Select.hs−173 Stackage/ServerFiles.hs−104 Stackage/Tarballs.hs−45 Stackage/Test.hs−298 Stackage/Types.hs−165 Stackage/Util.hs−174 Stackage2/BuildConstraints.hs+96−77 Stackage2/BuildPlan.hs+4−1 Stackage2/CompleteBuild.hs+6−6 Stackage2/ConstraintFile.hs−81 Stackage2/GithubPings.hs+8−6 Stackage2/UpdateBuildPlan.hs+1 app/stackage.hs−148 stackage.cabal+1−27
Stackage/Build.hsdeleted−116
@@ -1,116 +0,0 @@
1−module Stackage.Build
2− ( build
3− , defaultBuildSettings
4− , BuildSettings (..)
5− ) where
6−
7−import Control.Monad (unless)
8−import Prelude hiding (pi)
9−import Stackage.CheckCabalVersion (checkCabalVersion)
10−import Stackage.Config
11−import Stackage.InstallInfo
12−import Stackage.ModuleNameConflict
13−import Stackage.Types
14−import Stackage.Util
15−import System.Exit (ExitCode (ExitSuccess), exitWith)
16−import System.IO (BufferMode (NoBuffering),
17− IOMode (WriteMode), hPutStrLn,
18− hSetBuffering, withBinaryFile)
19−import qualified System.IO.UTF8
20−import System.Process (rawSystem, runProcess,
21− waitForProcess)
22−import qualified Data.ByteString.Lazy.Char8 as L8
23−
24−defaultBuildSettings :: Maybe Int -- ^ argument to -j
25− -> GhcMajorVersion
26− -> BuildSettings
27−defaultBuildSettings cores version = BuildSettings
28− { sandboxRoot = "sandbox"
29− , extraArgs = \bs -> "-fnetwork23" : "-fhttps" :
30− case bs of
31− BSTest -> []
32− _ ->
33− case cores of
34− Nothing -> ["-j"]
35− Just 1 -> []
36− Just j -> ["-j" ++ show j]
37− , testWorkerThreads = 4
38− , buildDocs = True
39− , tarballDir = "patching/tarballs"
40− , cabalFileDir = Nothing
41− , underlayPackageDirs = []
42− }
43−
44−build :: BuildSettings -> BuildPlan -> IO ()
45−build settings' bp = do
46− libVersion <- checkCabalVersion
47−
48− putStrLn "Wiping out old sandbox folder"
49− rm_r $ sandboxRoot settings'
50− rm_r "logs"
51− settings <- fixBuildSettings settings'
52−
53− putStrLn "Creating new package database"
54− ec1 <- rawSystem "ghc-pkg" ["init", packageDir settings]
55− unless (ec1 == ExitSuccess) $ do
56− putStrLn "Unable to create package database via ghc-pkg init"
57− exitWith ec1
58−
59− menv <- fmap Just $ getModifiedEnv settings
60− let runCabal args handle = runProcess "cabal" args Nothing menv Nothing (Just handle) (Just handle)
61−
62− -- First install build tools so they can be used below.
63− let installBuildTool tool = do
64− let toolsDir = packageDir settings ++ "-tools"
65− rm_r toolsDir
66− ecInit <- rawSystem "ghc-pkg" ["init", toolsDir]
67− unless (ecInit == ExitSuccess) $ do
68− putStrLn "Unable to create package database via ghc-pkg init"
69− exitWith ecInit
70−
71− putStrLn $ "Installing build tool: " ++ tool
72− ec <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
73− hSetBuffering handle NoBuffering
74−
75− let args = addCabalArgs settings BSTools
76− $ "install"
77− : ("--cabal-lib-version=" ++ libVersion)
78− : "--build-log=logs-tools/$pkg.log"
79− : [tool]
80− hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args))
81− ph <- runCabal args handle
82− waitForProcess ph
83− unless (ec == ExitSuccess) $ do
84− putStrLn $ concat
85− [ "Building of "
86− , tool
87− , " failed, please see build-tools.log"
88− ]
89− exitWith ec
90− putStrLn $ tool ++ " built"
91− rm_r toolsDir
92− mapM_ installBuildTool $ bpTools bp
93−
94− putStrLn "Beginning Stackage build"
95− ph <- withBinaryFile "build.log" WriteMode $ \handle -> do
96− packageList <- mapM (replaceTarball $ tarballDir settings) $ bpPackageList bp
97− let args = addCabalArgs settings BSBuild
98− $ "install"
99− : ("--cabal-lib-version=" ++ libVersion)
100− : "--build-log=logs/$pkg.log"
101− : "--max-backjumps=-1"
102− : "--reorder-goals"
103− : "--build-summary=build-summary/$pkgid.report"
104− : packageList
105− hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args))
106− runCabal args handle
107− ec <- waitForProcess ph
108− unless (ec == ExitSuccess) $ do
109− putStrLn "Build failed, please see build.log"
110− L8.readFile "build.log" >>= L8.putStr
111− exitWith ec
112−
113− putStrLn "Build completed successfully, checking for module name conflicts"
114− conflicts <- getModuleNameConflicts $ packageDir settings
115− System.IO.UTF8.writeFile "module-name-conflicts.txt"
116− $ renderModuleNameConflicts conflicts
Stackage/BuildPlan.hsdeleted−186
@@ -1,186 +0,0 @@
1−{-# LANGUAGE FlexibleInstances #-}
2−{-# LANGUAGE RecordWildCards #-}
3−{-# LANGUAGE TypeSynonymInstances #-}
4−module Stackage.BuildPlan
5− ( readBuildPlan
6− , writeBuildPlan
7− , writeBuildPlanCsv
8− ) where
9−
10−import qualified Data.Map as Map
11−import qualified Data.Set as Set
12−import Distribution.Text (display, simpleParse)
13−import Stackage.Types
14−import qualified System.IO.UTF8
15−import Data.Char (isSpace)
16−import Stackage.Util
17−import Data.List (intercalate)
18−
19−readBuildPlan :: FilePath -> IO BuildPlan
20−readBuildPlan fp = do
21− str <- System.IO.UTF8.readFile fp
22− case fromString str of
23− Left s -> error $ "Could not read build plan: " ++ s
24− Right (x, "") -> return x
25− Right (_, _:_) -> error "Trailing content when reading build plan"
26−
27−writeBuildPlan :: FilePath -> BuildPlan -> IO ()
28−writeBuildPlan fp bp = System.IO.UTF8.writeFile fp $ toString bp
29−
30−class AsString a where
31− toString :: a -> String
32− fromString :: String -> Either String (a, String)
33−
34−instance AsString BuildPlan where
35− toString BuildPlan {..} = concat
36− [ makeSection "tools" bpTools
37− , makeSection "packages" $ Map.toList bpPackages
38− , makeSection "core" $ Map.toList bpCore
39− , makeSection "optional-core" $ Map.toList bpOptionalCore
40− , makeSection "skipped-tests" $ Set.toList bpSkippedTests
41− , makeSection "expected-failures" $ Set.toList bpExpectedFailures
42− ]
43− fromString s1 = do
44− (tools, s2) <- getSection "tools" s1
45− (packages, s3) <- getSection "packages" s2
46− (core, s4) <- getSection "core" s3
47− (optionalCore, s5) <- getSection "optional-core" s4
48− (skipped, s6) <- getSection "skipped-tests" s5
49− (failures, s7) <- getSection "expected-failures" s6
50− let bp = BuildPlan
51− { bpTools = tools
52− , bpPackages = Map.fromList packages
53− , bpCore = Map.fromList core
54− , bpOptionalCore = Map.fromList optionalCore
55− , bpSkippedTests = Set.fromList skipped
56− , bpExpectedFailures = Set.fromList failures
57− }
58− return (bp, s7)
59−
60−makeSection :: AsString a => String -> [a] -> String
61−makeSection title contents = unlines
62− $ ("-- BEGIN " ++ title)
63− : map toString contents
64− ++ ["-- END " ++ title, ""]
65−
66−instance AsString String where
67− toString = id
68− fromString s = Right (s, "")
69−
70−instance AsString PackageName where
71− toString (PackageName pn) = pn
72− fromString s = Right (PackageName s, "")
73−
74−instance AsString (Maybe Version) where
75− toString Nothing = ""
76− toString (Just x) = toString x
77− fromString s
78− | all isSpace s = return (Nothing, s)
79− | otherwise = do
80− (v, s') <- fromString s
81− return (Just v, s')
82−
83−instance AsString a => AsString (PackageName, a) where
84− toString (PackageName pn, s) = concat [pn, " ", toString s]
85− fromString s = do
86− (pn, rest) <- takeWord s
87− (rest', s') <- fromString rest
88− return ((PackageName pn, rest'), s')
89−
90−takeWord :: AsString a => String -> Either String (a, String)
91−takeWord s =
92− case break (== ' ') s of
93− (x, _:y) -> do
94− (x', s') <- fromString x
95− if null s'
96− then Right (x', y)
97− else Left $ "Unconsumed input in takeWord call"
98− (_, []) -> Left "takeWord failed"
99−
100−instance AsString SelectedPackageInfo where
101− toString SelectedPackageInfo {..} = unwords
102− [ display spiVersion
103− , toString spiHasTests
104− , (\v -> if null v then "@" else v) $ githubMentions spiGithubUser
105− , unMaintainer spiMaintainer
106− ]
107− fromString s1 = do
108− (version, s2) <- takeWord s1
109− (hasTests, s3) <- takeWord s2
110− (gu, m) <- takeWord s3
111− Right (SelectedPackageInfo
112− { spiVersion = version
113− , spiHasTests = hasTests
114− , spiGithubUser = [gu]
115− , spiMaintainer = Maintainer m
116− }, "")
117−
118−instance AsString (Maybe String) where
119− toString Nothing = "@"
120− toString (Just x) = "@" ++ x
121− fromString "@" = Right (Nothing, "")
122− fromString ('@':rest) = Right (Just rest, "")
123− fromString x = Left $ "Invalid Github user: " ++ x
124−
125−instance AsString Bool where
126− toString True = "test"
127− toString False = "notest"
128− fromString "test" = Right (True, "")
129− fromString "notest" = Right (False, "")
130− fromString x = Left $ "Invalid test value: " ++ x
131−
132−instance AsString Version where
133− toString = display
134− fromString s =
135− case simpleParse s of
136− Nothing -> Left $ "Invalid version: " ++ s
137− Just v -> Right (v, "")
138−
139−getSection :: AsString a => String -> String -> Either String ([a], String)
140−getSection title orig =
141− case lines orig of
142− [] -> Left "Unexpected EOF when looking for a section"
143− l1:ls1
144− | l1 == begin ->
145− case break (== end) ls1 of
146− (here, _:"":rest) -> do
147− here' <- mapM fromString' here
148− Right (here', unlines rest)
149− (_, _) -> Left $ "Could not find section end: " ++ title
150− | otherwise -> Left $ "Could not find section start: " ++ title
151− where
152− begin = "-- BEGIN " ++ title
153− end = "-- END " ++ title
154−
155− fromString' x = do
156− (y, z) <- fromString x
157− if null z
158− then return y
159− else Left $ "Unconsumed input on line: " ++ x
160−
161−-- | Used for Hackage distribution purposes.
162−writeBuildPlanCsv :: FilePath -> BuildPlan -> IO ()
163−writeBuildPlanCsv fp bp =
164− -- Obviously a proper CSV library should be used... but we're minimizing
165− -- deps
166− System.IO.UTF8.writeFile fp $ unlines' $ map toRow $ Map.toList fullMap
167− where
168− -- Hackage server is buggy, and won't accept trailing newlines. See:
169− -- https://github.com/haskell/hackage-server/issues/141#issuecomment-34615935
170− unlines' = intercalate "\n"
171−
172− fullMap = Map.unions
173− [ fmap spiVersion $ bpPackages bp
174− , Map.mapMaybe id $ bpCore bp
175− , bpOptionalCore bp
176− ]
177−
178− toRow (PackageName name, version) = concat
179− [ "\""
180− , name
181− , "\",\""
182− , display version
183− , "\",\"http://www.stackage.org/package/"
184− , name
185− , "\""
186− ]
Stackage/CheckCabalVersion.hsdeleted−27
@@ -1,27 +0,0 @@
1−module Stackage.CheckCabalVersion
2− ( checkCabalVersion
3− ) where
4−
5−import Control.Exception (assert)
6−import Distribution.Text (simpleParse)
7−import Distribution.Version (withinRange)
8−import Prelude hiding (pi)
9−import System.Process (readProcess)
10−
11−checkCabalVersion :: IO String
12−checkCabalVersion = do
13− putStrLn "Checking Cabal version"
14− versionString <- readProcess "cabal" ["--version"] ""
15− libVersion <-
16− case map words $ lines versionString of
17− [_,["using","version",libVersion,"of","the","Cabal","library"]] -> return libVersion
18− _ -> error "Did not understand cabal --version output"
19−
20− case (simpleParse libVersion, simpleParse ">= 1.16") of
21− (Nothing, _) -> error $ "cabal binary reported an invalid Cabal library version: " ++ libVersion
22− (_, Nothing) -> assert False $ return ()
23− (Just v, Just vr)
24− | v `withinRange` vr -> return ()
25− | otherwise -> error $ "cabal binary build against unsupported Cabal library version: " ++ libVersion
26−
27− return libVersion
Stackage/CheckPlan.hsdeleted−73
@@ -1,73 +0,0 @@
1−module Stackage.CheckPlan
2− ( checkPlan
3− ) where
4−
5−import Control.Monad (unless, when)
6−import Data.List (isPrefixOf, sort)
7−import qualified Data.Map as Map
8−import qualified Data.Set as Set
9−import Stackage.CheckCabalVersion (checkCabalVersion)
10−import Stackage.InstallInfo
11−import Stackage.Types
12−import Stackage.Util
13−import System.Exit (ExitCode (ExitFailure, ExitSuccess),
14− exitWith)
15−import System.Process (readProcessWithExitCode)
16−
17−data Mismatch = OnlyDryRun String | OnlySimpleList String
18− deriving Show
19−
20−checkPlan :: BuildSettings -> BuildPlan -> IO ()
21−checkPlan settings bp = do
22− _ <- checkCabalVersion
23−
24− putStrLn "Checking build plan"
25− packages <- mapM (replaceTarball $ tarballDir settings) (bpPackageList bp)
26− (ec, dryRun', stderr) <- readProcessWithExitCode "cabal"
27− ( addCabalArgsOnlyGlobal settings
28− $ "install"
29− : "--dry-run"
30− : "--max-backjumps=-1"
31− : "--reorder-goals"
32− : extraArgs settings BSBuild ++ packages
33− ) ""
34− when (ec /= ExitSuccess || "Warning:" `isPrefixOf` stderr) $ do
35− putStr stderr
36− putStr dryRun'
37− putStrLn "cabal returned a bad result, exiting"
38− exitWith ec
39− let dryRun = sort $ filter notOptionalCore $ map (takeWhile (/= ' ')) $ drop 2 $ lines dryRun'
40− let mismatches = getMismatches dryRun (filter notOptionalCore $ bpPackageList bp)
41− unless (null $ filter (not . acceptableMismatch) mismatches) $ do
42− putStrLn "Found the following mismatches"
43− mapM_ print mismatches
44− exitWith $ ExitFailure 1
45− putStrLn "Build plan checked, no mismatches"
46− where
47− optionalCore = Set.fromList $ map packageVersionString $ Map.toList $ bpOptionalCore bp
48− notOptionalCore s = not $ s `Set.member` optionalCore
49−
50−getMismatches :: [String] -> [String] -> [Mismatch]
51−getMismatches =
52− go
53− where
54− go [] y = map OnlySimpleList y
55− go x [] = map OnlyDryRun x
56− go (x:xs) (y:ys) =
57− case compare x y of
58− EQ -> go xs ys
59− LT -> OnlyDryRun x : go xs (y:ys)
60− GT -> OnlySimpleList y : go (x:xs) ys
61−
62−-- | Some mismatches are going to be acceptable. The reasons are described
63−-- below.
64−acceptableMismatch :: Mismatch -> Bool
65−acceptableMismatch m =
66− case m of
67− -- GHC 7.4 included extensible-extensions as a core package, and
68− -- therefore the HP at time of writing (2012.4.0.0) includes it in that
69− -- list. However, GHC 7.6 does /not/ include that package. As a result,
70− -- we get that package included in the dry run but not our list of
71− -- packages to build. See issue #57.
72− OnlyDryRun s | "extensible-exceptions-" `isPrefixOf` s -> True
73− _ -> False
Stackage/Config.hs+6−840
@@ -1,842 +1,8 @@
1−{-# LANGUAGE CPP #-}
2−module Stackage.Config where
1+{-
32
4−import Control.Monad (when, unless)
5−import Control.Monad.Trans.Writer (Writer, execWriter, tell)
6−import Data.Char (toLower)
7−import qualified Data.Map as Map
8−import Data.Maybe (fromMaybe)
9−import Data.Set (fromList, singleton)
10−import Distribution.Text (simpleParse)
11−import Stackage.Types
3+NOTE: This module is no longer used for tracking packages included in Stackage.
4+To simplify the codebase, that information is now stored in the
5+build-constraints.yaml configuration file. The file should be self-explanatory.
6+Sorry for the inconvenience.
127
13−-- | Packages which are shipped with GHC but are not included in the
14−-- Haskell Platform list of core packages.
15−defaultExtraCore :: GhcMajorVersion -> Set PackageName
16−defaultExtraCore _ = fromList $ map PackageName $ words
17− "binary Win32 ghc-prim integer-gmp"
18−
19−-- | Test suites which are expected to fail for some reason. The test suite
20−-- will still be run and logs kept, but a failure will not indicate an
21−-- error in our package combination.
22−defaultExpectedFailures :: GhcMajorVersion
23− -> Bool -- ^ haskell platform
24− -> Set PackageName
25−defaultExpectedFailures ghcVer requireHP = execWriter $ do
26− -- Requires an old version of WAI and Warp for tests
27− add "HTTP"
28−
29− -- text and setenv have recursive dependencies in their tests, which
30− -- cabal can't (yet) handle
31− add "text"
32− add "setenv"
33−
34− -- The version of GLUT included with the HP does not generate
35− -- documentation correctly.
36− add "GLUT"
37−
38− -- https://github.com/bos/statistics/issues/42
39− add "statistics"
40−
41− -- https://github.com/kazu-yamamoto/simple-sendfile/pull/10
42− add "simple-sendfile"
43−
44− -- http://hackage.haskell.org/trac/hackage/ticket/954
45− add "diagrams"
46−
47− -- https://github.com/fpco/stackage/issues/24
48− add "unix-time"
49−
50− -- With transformers 0.3, it doesn't provide any modules
51− add "transformers-compat"
52−
53− -- Tests require shell script and are incompatible with sandboxed package
54− -- databases
55− add "HTF"
56−
57− -- https://github.com/simonmar/monad-par/issues/28
58− add "monad-par"
59−
60− -- Unfortunately network failures seem to happen haphazardly
61− add "network"
62−
63− -- https://github.com/ekmett/hyphenation/issues/1
64− add "hyphenation"
65−
66− -- Test suite takes too long to run on some systems
67− add "punycode"
68−
69− -- http://hub.darcs.net/stepcut/happstack/issue/1
70− add "happstack-server"
71−
72− -- Requires a Facebook app.
73− add "fb"
74−
75− -- https://github.com/tibbe/hashable/issues/64
76− add "hashable"
77−
78− -- https://github.com/vincenthz/language-java/issues/10
79− add "language-java"
80−
81− add "threads"
82− add "crypto-conduit"
83− add "pandoc"
84− add "language-ecmascript"
85− add "hspec"
86− add "alex"
87−
88− -- https://github.com/basvandijk/concurrent-extra/issues/
89− add "concurrent-extra"
90−
91− -- https://github.com/skogsbaer/xmlgen/issues/2
92− add "xmlgen"
93−
94− -- Something very strange going on with the test suite, I can't figure
95− -- out how to fix it
96− add "bson"
97−
98− -- Requires a locally running PostgreSQL server with appropriate users
99− add "postgresql-simple"
100−
101− -- Missing files
102− add "websockets"
103−
104− -- Some kind of Cabal bug when trying to run tests
105− add "thyme"
106−
107− add "shake"
108−
109− -- https://github.com/jgm/pandoc-citeproc/issues/5
110− add "pandoc-citeproc"
111−
112− -- Problems with doctest and sandboxing
113− add "warp"
114− add "wai-logger"
115−
116− -- https://github.com/fpco/stackage/issues/163
117− add "hTalos"
118− add "seqloc"
119−
120− -- https://github.com/bos/math-functions/issues/25
121− add "math-functions"
122−
123− -- FIXME the test suite fails fairly regularly in builds, though I haven't
124− -- discovered why yet
125− add "crypto-numbers"
126−
127− -- Test suite is currently failing regularly, needs to be worked out still.
128− add "lens"
129−
130− -- Requires too old a version of test-framework
131− add "time"
132−
133− -- No code included any more, therefore Haddock fails
134− mapM_ add $ words =<<
135− [ "comonad-transformers comonads-fd groupoids"
136− , "profunctor-extras semigroupoid-extras"
137− , "hamlet shakespeare-css shakespeare-i18n"
138− , "shakespeare-js shakespeare-text"
139− , "attoparsec-conduit blaze-builder-conduit http-client-conduit"
140− , "network-conduit zlib-conduit http-client-multipart"
141− , "wai-eventsource wai-test"
142− , "hspec-discover"
143− ]
144−
145− -- Cloud Haskell tests seem to be unreliable
146− mapM_ add $ words =<<
147− [ "distributed-process lockfree-queue network-transport-tcp"
148− ]
149−
150− -- Pulls in monad-peel which does not compile
151− when (ghcVer >= GhcMajorVersion 7 8) $ add "monad-control"
152−
153− -- https://github.com/fpco/stackage/issues/226
154− add "options"
155−
156− -- https://github.com/gtk2hs/gtk2hs/issues/36
157− add "glib"
158− add "pango"
159−
160− -- https://github.com/acw/bytestring-progress/issues/3
161− add "bytestring-progress"
162−
163− -- Seems to require 32-bit functions
164− add "nettle"
165−
166− -- Depends on a missing graphviz executable
167− add "graphviz"
168−
169− -- https://github.com/silkapp/json-schema/issues/8
170− when (ghcVer <= GhcMajorVersion 7 6) $
171− add "json-schema"
172−
173− -- No AWS creds available
174− add "aws"
175−
176− -- Not sure why...
177− add "singletons"
178−
179− add "hspec2"
180− add "hspec-wai"
181−
182− -- Requires too new a version of time
183− when (ghcVer < GhcMajorVersion 7 8) $ add "cookie"
184−
185− -- https://github.com/fpco/stackage/issues/285
186− add "diagrams-haddock"
187− add "scientific"
188− add "json-schema"
189−
190− -- https://github.com/BioHaskell/octree/issues/4
191− add "Octree"
192−
193− -- No code until we upgrade to network 2.6
194− add "network-uri"
195−
196− -- https://github.com/goldfirere/th-desugar/issues/12
197− add "th-desugar"
198−
199− -- https://github.com/haskell/c2hs/issues/108
200− add "c2hs"
201−
202− -- https://github.com/jmillikin/haskell-filesystem/issues/3
203− add "system-filepath"
204−
205− -- For some unknown reason, doctest has trouble on GHC 7.6. This only
206− -- happens during a Stackage test.
207− --
208− -- See: http://www.reddit.com/r/haskell/comments/2go92u/beginner_error_messages_in_c_vs_haskell/cklaspk
209− when (ghcVer == GhcMajorVersion 7 6) $ add "http-types"
210−
211− -- Requires a running webdriver server
212− add "webdriver"
213− add "webdriver-snoy"
214−
215− -- Weird conflicts with sandboxing
216− add "ghc-mod"
217− add "ghcid"
218−
219− -- Requires locally running server
220− add "bloodhound"
221−
222− -- Too lazy to keep the test dependencies up to date
223− let names =
224− words "hasql hasql-postgres hasql-backend postgresql-binary" ++
225− words "stm-containers focus list-t slave-thread partial-handler" ++
226− words "neat-interpolation cases" ++
227− words "base-prelude mtl-prelude"
228− in mapM_ add names
229−
230− -- https://github.com/gtk2hs/gtk2hs/issues/79
231− add "gio"
232− add "gtk"
233−
234− -- Requires SAT solver and old QuickCheck
235− add "ersatz"
236−
237− -- https://github.com/ekmett/gl/issues/3
238− add "gl"
239−
240− -- Failing doctests
241− add "bits"
242−
243− -- No server running
244− add "amqp"
245−
246− when (ghcVer == GhcMajorVersion 7 8 && requireHP) $ do
247− -- https://github.com/vincenthz/hs-asn1/issues/11
248− add "asn1-encoding"
249−
250− -- https://github.com/vincenthz/hs-tls/issues/84
251− add "tls"
252−
253− add "x509"
254−
255− -- Often run out of inotify handles
256− add "fsnotify"
257−
258− -- Requires a correctly set up Postgres instance
259− add "opaleye"
260− where
261− add = tell . singleton . PackageName
262−
263−-- | List of packages for our stable Hackage. All dependencies will be
264−-- included as well. Please indicate who will be maintaining the package
265−-- via comments.
266−defaultStablePackages :: GhcMajorVersion
267− -> Bool -- ^ using haskell platform?
268− -> Map PackageName (VersionRange, Maintainer)
269−defaultStablePackages ghcVer requireHP = unPackageMap $ execWriter $ do
270− when (ghcVer == GhcMajorVersion 7 8 && requireHP) haskellPlatform78
271− mapM_ (add "michael@snoyman.com") $ words =<<
272− [ "yesod yesod-newsfeed yesod-sitemap yesod-static yesod-test yesod-bin"
273− , "markdown mime-mail-ses"
274− , "persistent persistent-template persistent-sqlite persistent-postgresql persistent-mysql"
275− , "network-conduit-tls yackage warp-tls keter"
276− , "process-conduit stm-conduit"
277− , "classy-prelude-yesod yesod-fay yesod-eventsource wai-websockets"
278− , "random-shuffle hebrew-time"
279− , "bzlib-conduit case-insensitive"
280− , "conduit-extra conduit-combinators yesod-websockets"
281− , "cabal-src"
282− , "yesod-auth-deskcom monadcryptorandom sphinx"
283− , "yesod-gitrepo"
284− ]
285−
286− -- https://github.com/fpco/stackage/issues/261
287− addRange "Michael Snoyman" "cabal-install" $
288− case () of
289− ()
290− | ghcVer <= GhcMajorVersion 7 6 -> "< 1.17"
291− | ghcVer <= GhcMajorVersion 7 8 -> "< 1.19"
292− | otherwise -> "-any"
293− -- cabal-install is buggy still...
294− addRange "Michael Snoyman" "network" "< 2.6"
295− addRange "Michael Snoyman" "network-uri" "< 2.6"
296−
297− mapM_ (add "FP Complete <michael@fpcomplete.com>") $ words =<<
298− [ "web-fpco th-expand-syns configurator smtLib"
299− , "fixed-list indents language-c pretty-class"
300− , "csv-conduit cassava"
301− , "async shelly thyme"
302− , "hxt hxt-relaxng dimensional"
303− , "cairo diagrams-cairo gtk2hs-buildtools"
304− , "base16-bytestring convertible"
305− , "compdata hybrid-vectors"
306− , "executable-path formatting quandl-api"
307− , "fgl hmatrix hmatrix-gsl"
308− , "alex happy c2hs"
309− , "fpco-api aws persistent-mongoDB"
310− , "random-fu lhs2tex"
311− , "Chart Chart-diagrams histogram-fill random-source"
312− , "webdriver"
313− , "foreign-store"
314− , "statistics-linreg"
315− -- https://github.com/Soostone/retry/issues/18
316− -- , "retry"
317− ]
318− when (ghcVer < GhcMajorVersion 7 8) $ do -- No GHC 7.8 support
319− mapM_ (add "FP Complete <michael@fpcomplete.com>") $ words =<<
320− [ "" -- too unreliable for the moment "distributed-process distributed-process-simplelocalnet"
321− -- https://github.com/fpco/stackage/issues/295
322− --, "threepenny-gui unification-fd"
323− ]
324− addRange "FP Complete <michael@fpcomplete.com>" "compdata" "< 0.8"
325− when (ghcVer >= GhcMajorVersion 7 8 && not requireHP) $
326− mapM_ (add "FP Complete <michael@fpcomplete.com>") $ words =<<
327− [ "criterion"
328− , "th-lift singletons th-desugar quickcheck-assertions"
329− , "distributed-process distributed-process-simplelocalnet" -- cloud-haskell"
330− ]
331−
332− addRange "FP Complete <michael@fpcomplete.com>" "kure" "<= 2.4.10"
333−
334− mapM_ (add "Omari Norman <omari@smileystation.com>") $ words
335− "barecheck rainbow rainbow-tests"
336− when (ghcVer >= GhcMajorVersion 7 8 && not requireHP) $
337− mapM_ (add "Omari Norman <omari@smileystation.com>") $ words
338− "quickpull"
339−
340− mapM_ (add "Neil Mitchell") $ words
341− "hlint hoogle shake derive tagsoup cmdargs safe uniplate nsis js-jquery js-flot extra bake ghcid"
342−
343− mapM_ (add "Alan Zimmerman") $ words
344− "hjsmin language-javascript"
345−
346− when (ghcVer >= GhcMajorVersion 7 8 && not requireHP) $
347− mapM_ (add "Alfredo Di Napoli <alfredo.dinapoli@gmail.com>") $ words
348− "mandrill"
349−
350− mapM_ (add "Jasper Van der Jeugt") $ words
351− "blaze-html blaze-markup stylish-haskell"
352−
353− mapM_ (add "Antoine Latter") $ words
354− "uuid byteorder"
355−
356− mapM_ (add "Philipp Middendorf <pmidden@secure.mailbox.org>") $ words
357− "clock"
358−
359− mapM_ (add "Stefan Wehr <wehr@factisresearch.com>") $ words
360− "HTF xmlgen stm-stats"
361− when (ghcVer < GhcMajorVersion 7 8) $ add "Stefan Wehr <wehr@factisresearch.com>" "hscurses"
362−
363− mapM_ (add "Bart Massey <bart.massey+stackage@gmail.com>") $ words
364− "parseargs"
365−
366− mapM_ (add "Vincent Hanquez") $ words =<<
367− [ "bytedump certificate cipher-aes cipher-rc4 connection"
368− , "cprng-aes cpu crypto-pubkey-types crypto-random-api cryptocipher"
369− , "cryptohash hit language-java libgit pem siphash socks tls"
370− , "tls-debug vhd language-java"
371− ]
372−
373− mapM_ (add "Chris Done") $ words =<<
374− [ "ace check-email freenect gd"
375− , "hostname-validate ini lucid osdkeys pdfinfo"
376− , "pure-io sourcemap frisby"
377− , "present"
378− ]
379−
380− -- Requires older haddock currently
381− when (ghcVer == GhcMajorVersion 7 8 && requireHP) $
382− mapM_ (add "Chris Done") $ words =<<
383− [ "haskell-docs"
384− ]
385−
386− -- https://github.com/jgoerzen/testpack/issues/10
387− when (ghcVer >= GhcMajorVersion 7 8 && not requireHP) $
388− mapM_ (add "Chris Done") $ words =<<
389− [ "scrobble"
390− ]
391−
392− -- Requires too new a process for GHC 7.6
393− when (ghcVer >= GhcMajorVersion 7 8) $
394− mapM_ (add "Chris Done") $ words =<<
395− [ "shell-conduit"
396− ]
397−
398− -- TODO: Add hindent and structured-haskell-mode once they've been ported to HSE 1.16.
399−
400−#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
401− -- Does not compile on Windows
402− mapM_ (add "Vincent Hanquez") $ words "udbus xenstore"
403−#endif
404−
405− when (ghcVer < GhcMajorVersion 7 8) $
406− mapM_ (add "Alberto G. Corona <agocorona@gmail.com>") $ words
407− "RefSerialize TCache Workflow MFlow"
408−
409− mapM_ (add "Edward Kmett <ekmett@gmail.com>") $ words =<<
410− [ "ad adjunctions bifunctors bound charset comonad comonad-transformers"
411− , "comonads-fd compressed concurrent-supply constraints contravariant"
412− , "distributive either eq free groupoids heaps hyphenation"
413− , "integration intervals kan-extensions lca lens linear monadic-arrays machines"
414− , "mtl profunctors profunctor-extras reducers reflection"
415− , "semigroups semigroupoids semigroupoid-extras speculation tagged void"
416− , "graphs monad-products monad-st wl-pprint-extras wl-pprint-terminfo"
417− , "numeric-extras parsers pointed prelude-extras reducers"
418− , "streams vector-instances"
419− , "approximate bits bytes compensated exceptions"
420− , "linear-accelerate log-domain"
421− , "monad-products monad-st nats"
422− , "ersatz"
423− -- hyperloglog
424− ]
425− when (ghcVer < GhcMajorVersion 7 8) $ do
426− mapM_ (add "Edward Kmett <ekmett@gmail.com>") $ words =<<
427− [ "categories comonad-extras recursion-schemes syb-extras"
428− ]
429− addRange "Edward Kmett <ekmett@gmail.com>" "bits" "< 0.4"
430− when (ghcVer >= GhcMajorVersion 7 8) $
431− mapM_ (add "Edward Kmett <ekmett@gmail.com>") $ words =<<
432− -- https://github.com/ekmett/fixed/issues/1
433− [ "fixed"
434− -- https://github.com/ekmett/half/issues/1
435− , "half gl"
436− ]
437− when (ghcVer >= GhcMajorVersion 7 8 && not requireHP) $
438− mapM_ (add "Edward Kmett <ekmett@gmail.com>") $ words =<<
439− [ "lens-aeson quickpull zlib-lens"
440− ]
441− -- Temporary upper bound for some of the above packages
442− addRange "Edward Kmett <ekmett@gmail.com>" "generic-deriving" "< 1.7"
443−
444− mapM_ (add "Andrew Farmer <afarmer@ittc.ku.edu>") $ words
445− "scotty wai-middleware-static"
446−
447− mapM_ (add "Simon Hengel <sol@typeful.net>") $ words
448− "hspec hspec-wai hspec-wai-json aeson-qq interpolate doctest base-compat"
449−
450− mapM_ (add "Mario Blazevic <blamario@yahoo.com>") $ words
451− "monad-parallel monad-coroutine incremental-parser monoid-subclasses"
452−
453− mapM_ (add "Brent Yorgey <byorgey@gmail.com>") $ words =<<
454− [ "monoid-extras dual-tree vector-space-points active force-layout"
455− , "diagrams diagrams-contrib diagrams-core diagrams-lib diagrams-svg"
456− , "diagrams-postscript haxr"
457− , "BlogLiterately"
458− , "MonadRandom"
459− , "diagrams-builder diagrams-haddock BlogLiterately-diagrams"
460− ]
461− mapM_ (add "Vincent Berthoux <vincent.berthoux@gmail.com>") $ words
462− "JuicyPixels"
463−
464− mapM_ (add "Patrick Brisbin") $ words "gravatar"
465−
466− -- https://github.com/fpco/stackage/issues/299
467− -- mapM_ (add "Paul Harper <benekastah@gmail.com>") $ words "yesod-auth-oauth2"
468−
469− mapM_ (add "Felipe Lessa <felipe.lessa@gmail.com>") $ words
470− "esqueleto fb fb-persistent yesod-fb yesod-auth-fb"
471−
472− mapM_ (add "Alexander Altman <alexanderaltman@me.com>") $ words
473− "base-unicode-symbols containers-unicode-symbols"
474−
475− if ghcVer >= GhcMajorVersion 7 8
476− then add "Trevor L. McDonell <tmcdonell@cse.unsw.edu.au>" "accelerate"
477− else do
478− addRange "Trevor L. McDonell <tmcdonell@cse.unsw.edu.au>" "accelerate" "< 0.15"
479− addRange "Michael Snoyman" "linear-accelerate" "< 0.2"
480−
481− mapM_ (add "Dan Burton <danburton.email@gmail.com>") $ words =<<
482− [ "basic-prelude composition io-memoize numbers rev-state runmemo"
483− , "tardis lens-family-th"
484− ]
485−
486− mapM_ (add "Daniel Díaz <dhelta.diaz@gmail.com>") $ words
487− "HaTeX matrix"
488− when (ghcVer >= GhcMajorVersion 7 8) $
489− mapM_ (add "Daniel Díaz <dhelta.diaz@gmail.com>") $ words
490− "binary-list"
491−
492− mapM_ (add "Gabriel Gonzalez <Gabriel439@gmail.com>")
493− ["pipes", "pipes-parse", "pipes-concurrency"]
494−
495− when (ghcVer >= GhcMajorVersion 7 8) $
496− mapM_ (add "Chris Allen <cma@bitemyapp.com>")
497− ["bloodhound"]
498−
499− mapM_ (add "Adam Bergmark <adam@bergmark.nl>") $ words
500− "fay fay-base fay-dom fay-jquery fay-text fay-uri snaplet-fay"
501−
502− when (ghcVer >= GhcMajorVersion 7 8 && not requireHP) $
503− mapM_ (add "Rodrigo Setti <rodrigosetti@gmail.com>") $ words
504− "messagepack messagepack-rpc"
505−
506− mapM_ (add "Boris Lykah <lykahb@gmail.com>") $ words
507− "groundhog groundhog-th groundhog-sqlite groundhog-postgresql groundhog-mysql"
508−
509− mapM_ (add "Janne Hellsten <jjhellst@gmail.com>") $ words
510− "sqlite-simple"
511−
512− mapM_ (add "Michal J. Gajda") $ words
513− "iterable Octree FenwickTree"
514− -- https://github.com/BioHaskell/hPDB/issues/2
515− when (ghcVer >= GhcMajorVersion 7 8) $ do
516− mapM_ (add "Michal J. Gajda") $ words
517− "hPDB hPDB-examples"
518−
519− mapM_ (add "Roman Cheplyaka <roma@ro-che.info>") $ words =<<
520− [ "smallcheck tasty tasty-smallcheck tasty-quickcheck tasty-hunit tasty-golden"
521− , "traverse-with-class regex-applicative time-lens"
522− , "haskell-names haskell-packages hse-cpp"
523− , "action-permutations amqp curl generics-sop heredoc immortal timezone-olson timezone-series"
524− ]
525−
526− mapM_ (add "George Giorgidze <giorgidze@gmail.com>") $ words
527− "HCodecs YampaSynth"
528−
529− mapM_ (add "Phil Hargett <phil@haphazardhouse.net>") $ words
530− "courier"
531−
532−#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
533− mapM_ (add "Aycan iRiCAN <iricanaycan@gmail.com>") $ words
534− "hdaemonize hsyslog hweblib"
535−#else
536− mapM_ (add "Aycan iRiCAN <iricanaycan@gmail.com>") $ words
537− "hweblib"
538−#endif
539−
540− mapM_ (add "Joachim Breitner <mail@joachim-breitner.de>") $ words
541− "circle-packing arbtt"
542− when (ghcVer >= GhcMajorVersion 7 8) $
543− mapM_ (add "Joachim Breitner <mail@joachim-breitner.de>") $ words
544− "ghc-heap-view"
545−
546− when (ghcVer < GhcMajorVersion 7 8) $
547− mapM_ (add "John Wiegley") $ words =<<
548− [ "bindings-DSL github monad-extras numbers"
549− ]
550−
551− mapM_ (add "Aditya Bhargava <adit@adit.io") $ words
552− "HandsomeSoup"
553−
554− mapM_ (add "Clint Adams <clint@debian.org>") $ words
555− "hOpenPGP openpgp-asciiarmor MusicBrainz DAV hopenpgp-tools"
556−
557− -- https://github.com/fpco/stackage/issues/160
558− mapM_ (add "Ketil Malde") $ words =<<
559− [ "biocore biofasta biofastq biosff"
560− , "blastxml bioace biophd"
561− , "biopsl" -- https://github.com/ingolia/SamTools/issues/3 samtools
562− , "seqloc bioalign BlastHTTP"
563− -- The following have out-of-date dependencies currently
564− -- biostockholm memexml RNAwolf
565− -- , "Biobase BiobaseDotP BiobaseFR3D BiobaseInfernal BiobaseMAF"
566− -- , "BiobaseTrainingData BiobaseTurner BiobaseXNA BiobaseVienna"
567− -- , "BiobaseTypes BiobaseFasta"
568− -- MC-Fold-DP
569− ]
570− -- https://github.com/fpco/stackage/issues/163
571− addRange "Michael Snoyman" "biophd" "< 0.0.6 || > 0.0.6"
572−
573− mapM_ (add "Silk <code@silk.co>") $ words =<<
574− [ "arrow-list attoparsec-expr bumper code-builder fay-builder"
575− , "hxt-pickle-utils multipart regular-xmlpickler"
576− , "tostring uri-encode imagesize-conduit"
577− ]
578− when (ghcVer >= GhcMajorVersion 7 8 && not requireHP) $ do
579− mapM_ (add "Silk <code@silk.co>") $ words =<<
580− [ "aeson-utils generic-aeson json-schema"
581− , "rest-client rest-core rest-gen rest-happstack rest-snap rest-stringmap"
582− , "rest-types rest-wai tostring uri-encode imagesize-conduit"
583− ]
584−
585− mapM_ (add "Simon Michael <simon@joyful.com>") $ words
586− "hledger"
587−
588− mapM_ (add "Mihai Maruseac <mihai.maruseac@gmail.com>") $ words
589− "io-manager"
590−
591− mapM_ (add "Dimitri Sabadie <dimitri.sabadie@gmail.com") $ words
592− "monad-journal"
593−
594− mapM_ (add "Thomas Schilling <nominolo@googlemail.com>") $ words
595− "ghc-syb-utils"
596−
597− mapM_ (add "Boris Buliga <d12frosted@icloud.com>") $ words
598− "ghc-mod io-choice"
599− when (ghcVer >= GhcMajorVersion 7 8) $
600− mapM_ (add "Boris Buliga <d12frosted@icloud.com>") $ words
601− "system-canonicalpath"
602−
603− when (ghcVer >= GhcMajorVersion 7 8) $
604− mapM_ (add "Yann Esposito <yann.esposito@gmail.com>") $ words
605− "holy-project"
606− when requireHP $ addRange "Yann Esposito <yann.esposito@gmail.com>" "holy-project" "< 0.1.1.1"
607−
608− mapM_ (add "Paul Rouse <pgr@doynton.org>") $ words
609− "yesod-auth-hashdb"
610−
611− add "Toralf Wittner <tw@dtex.org>" "zeromq4-haskell"
612−
613− mapM_ (add "trupill@gmail.com") $ words
614− "djinn-lib djinn-ghc"
615−
616− mapM_ (add "Arash Rouhani <miffoljud@gmail.com>") $ words
617− "yesod-text-markdown"
618−
619− mapM_ (add "Matvey Aksenov <matvey.aksenov@gmail.com") $ words
620− "terminal-size"
621−
622− mapM_ (add "Luis G. Torres <lgtorres42@gmail.com") $ words
623− "kdt"
624− {- https://github.com/fpco/stackage/pull/331
625− mapM_ (add "Jyotirmoy Bhattacharya <jyotirmoy@jyotirmoy.net") $ words
626− "hakyll"
627− -}
628−
629− mapM_ (add "Emanuel Borsobom <manny@fpcomplete.com>") $ words =<<
630− ["text-binary BoundedChan bytestring-lexing bytestring-trie"
631− ,"data-accessor data-accessor-mtl file-location here"
632− ,"hlibgit2 hostname-validate interpolatedstring-perl6 iproute"
633− ,"missing-foreign multimap parallel-io"]
634− when (ghcVer >= GhcMajorVersion 7 8) $
635− mapM_ (add "Emanuel Borsobom <manny@fpcomplete.com>") $ words
636− "haddock-api git-embed"
637− when (not requireHP) $
638− mapM_ (add "Emanuel Borsobom <manny@fpcomplete.com>") $ words
639− "fuzzcheck MissingH"
640−
641− mapM_ (add "Michael Sloan <mgsloan@gmail.com") $ words
642− "th-orphans th-reify-many"
643−
644− when (ghcVer == GhcMajorVersion 7 8 && not requireHP) $
645− mapM_ (add "Michael Snoyman") $ words =<<
646− [ "repa repa-io repa-algorithms repa-devil JuicyPixels-repa"
647− ]
648−
649− when (ghcVer >= GhcMajorVersion 7 8 && not requireHP) $ do
650− mapM_ (add "Nikita Volkov <nikita.y.volkov@mail.ru>") $
651− words "hasql hasql-postgres hasql-backend postgresql-binary" ++
652− words "stm-containers focus list-t slave-thread partial-handler" ++
653− words "neat-interpolation cases" ++
654− words "base-prelude mtl-prelude"
655− addRange "Nikita Volkov <nikita.y.volkov@mail.ru>" "mtl-prelude" "< 2"
656−
657− mapM_ (add "Iustin Pop <iustin@k1024.org>") $ words
658− "prefix-units"
659−
660− mapM_ (add "Alexander Thiemann <mail@athiemann.net>") $ words
661− "graph-core reroute Spock"
662−
663− mapM_ (add "Joey Eremondi <joey@eremondi.com>") $ words =<<
664− [ "prettyclass language-glsl union-find aeson-pretty QuasiText"
665− , "digest zip-archive elm-compiler elm-core-sources elm-build-lib"
666− -- elm-package
667− ]
668−
669−
670− mapM_ (add "Arthur Fayzrakhmanov <heraldhoi@gmail.com>") $ words
671− "sodium hdevtools"
672−
673− -- https://github.com/fpco/stackage/issues/217
674− addRange "Michael Snoyman" "transformers" "< 0.4"
675− addRange "Michael Snoyman" "mtl" "< 2.2"
676− addRange "Michael Snoyman" "lifted-base" "< 0.2.2.2"
677−
678− -- https://github.com/fpco/stackage/issues/224
679− when (ghcVer <= GhcMajorVersion 7 6) $ do
680− addRange "Michael Snoyman" "zip-archive" "== 0.2.2.1"
681− addRange "Michael Snoyman" "pandoc" "== 1.12.4.2"
682− addRange "Michael Snoyman" "texmath" "<= 0.6.6.3"
683− addRange "Michael Snoyman" "attoparsec" "== 0.11.3.1"
684− addRange "Michael Snoyman" "parsers" "< 0.11"
685− addRange "Michael Snoyman" "scientific" "< 0.3"
686− addRange "Michael Snoyman" "aeson" "< 0.7.0.5"
687− addRange "Michael Snoyman" "aeson-utils" "< 0.2.2"
688− addRange "Michael Snoyman" "formatting" "< 5"
689− addRange "Michael Snoyman" "aws" "< 0.10"
690− addRange "Michael Snoyman" "network" "< 2.6"
691− addRange "Michael Snoyman" "network-uri" "< 2.6"
692−
693− -- 0.16.2 fixes dependency issues with different version of GHC
694− -- and Haskell Platform. Now builds on GHC 7.4-7.8. Version 1.0 is
695− -- guaranteed to break the API. See
696− -- https://travis-ci.org/jswebtools/language-ecmascript for
697− -- current build status.
698− addRange "Andrey Chudnov <oss@chudnov.com>" "language-ecmascript" ">= 0.16.2 && < 1.0"
699−
700− -- https://github.com/fpco/stackage/issues/271
701− when (ghcVer < GhcMajorVersion 7 8) $
702− addRange "Michael Snoyman" "aeson" "< 0.8"
703−
704− -- https://github.com/fpco/stackage/issues/288
705− addRange "Michael Snoyman" "text" "< 1.2"
706−
707− -- Force a specific version that's compatible with transformers 0.3
708− addRange "Michael Snoyman" "transformers-compat" "== 0.3.3.3"
709−
710− -- https://github.com/fpco/stackage/issues/291
711− addRange "Michael Snoyman" "random" "< 1.0.1.3"
712−
713− -- https://github.com/fpco/stackage/issues/314
714− addRange "Michael Snoyman" "hxt" "< 9.3.1.9"
715−
716− -- https://github.com/fpco/stackage/issues/318
717− addRange "Michael Snoyman" "HaXml" "< 1.25"
718−
719− -- https://github.com/fpco/stackage/issues/319
720− addRange "Michael Snoyman" "polyparse" "< 1.10"
721−
722− -- https://github.com/fpco/stackage/issues/341
723− addRange "Michael Snoyman" "haskell-names" "< 0.5"
724−
725− -- https://github.com/nikita-volkov/stm-containers/issues/3
726− addRange "Michael Snoyman" "free" "< 4.10"
727−
728− -- https://github.com/fpco/stackage/issues/354
729− addRange "Michael Snoyman" "JuicyPixels" "< 3.2"
730−
731− when (ghcVer == GhcMajorVersion 7 8 && requireHP) $ do
732− -- Yay workarounds for unnecessarily old versions
733− let peg x y = addRange "Haskell Platform" x y
734− peg "aeson" "== 0.7.0.4"
735− peg "scientific" "== 0.2.0.2"
736− peg "criterion" "<= 0.8.1.0"
737− peg "tasty-quickcheck" "< 0.8.0.3"
738− peg "formatting" "< 5.0"
739− peg "parsers" "< 0.11"
740− peg "lens" "< 4.2"
741− peg "contravariant" "< 1"
742− peg "adjunctions" "< 4.2"
743− peg "kan-extensions" "< 4.1"
744− peg "semigroupoids" "< 4.1"
745− peg "aws" "< 0.10"
746− peg "pandoc" "< 1.13"
747− peg "texmath" "<= 0.6.6.3"
748− peg "checkers" "== 0.3.2"
749− peg "HandsomeSoup" "< 0.3.3"
750− peg "network-uri" "< 2.6"
751−
752− mapM_ (add "Tom Ellis <tom-stackage@jaguarpaw.co.uk>") $ words
753− "opaleye product-profunctors"
754−
755−add :: String -> String -> Writer PackageMap ()
756−add maintainer package = addRange maintainer package "-any"
757−
758−addRange :: String -> String -> String -> Writer PackageMap ()
759−addRange maintainer package range =
760− case simpleParse range of
761− Nothing -> error $ "Invalid range " ++ show range ++ " for " ++ package
762− Just range' -> tell $ PackageMap $ Map.singleton (PackageName package) (range', Maintainer maintainer)
763−
764−-- | Hard coded Haskell Platform versions
765−haskellPlatform78 :: Writer PackageMap ()
766−haskellPlatform78 = do
767− addRange "Haskell Platform" "ghc" "== 7.8.3"
768− addRange "Haskell Platform" "haddock" "== 2.14.3"
769− addRange "Haskell Platform" "array" "== 0.5.0.0"
770− addRange "Haskell Platform" "base" "== 4.7.0.1"
771− addRange "Haskell Platform" "bytestring" "== 0.10.4.0"
772− addRange "Haskell Platform" "Cabal" "== 1.18.1.3"
773− addRange "Haskell Platform" "containers" "== 0.5.5.1"
774− addRange "Haskell Platform" "deepseq" "== 1.3.0.2"
775− addRange "Haskell Platform" "directory" "== 1.2.1.0"
776− addRange "Haskell Platform" "filepath" "== 1.3.0.2"
777− addRange "Haskell Platform" "haskell2010" "== 1.1.2.0"
778− addRange "Haskell Platform" "haskell98" "== 2.0.0.3"
779− addRange "Haskell Platform" "hpc" "== 0.6.0.1"
780− addRange "Haskell Platform" "old-locale" "== 1.0.0.6"
781− addRange "Haskell Platform" "old-time" "== 1.1.0.2"
782− addRange "Haskell Platform" "pretty" "== 1.1.1.1"
783− addRange "Haskell Platform" "process" "== 1.2.0.0"
784− addRange "Haskell Platform" "template-haskell" "== 2.9.0.0"
785− addRange "Haskell Platform" "time" "== 1.4.2"
786− addRange "Haskell Platform" "transformers" "== 0.3.0.0"
787− addRange "Haskell Platform" "unix" "== 2.7.0.1"
788− addRange "Haskell Platform" "xhtml" "== 3000.2.1"
789− addRange "Haskell Platform" "async" "== 2.0.1.5"
790− addRange "Haskell Platform" "attoparsec" "== 0.10.4.0"
791− addRange "Haskell Platform" "case-insensitive" "== 1.1.0.3"
792− addRange "Haskell Platform" "fgl" "== 5.5.0.1"
793− addRange "Haskell Platform" "GLURaw" "== 1.4.0.1"
794− addRange "Haskell Platform" "GLUT" "== 2.5.1.1"
795− addRange "Haskell Platform" "hashable" "== 1.2.2.0"
796− addRange "Haskell Platform" "haskell-src" "== 1.0.1.6"
797− addRange "Haskell Platform" "html" "== 1.0.1.2"
798− addRange "Haskell Platform" "HTTP" "== 4000.2.10"
799− addRange "Haskell Platform" "HUnit" "== 1.2.5.2"
800− addRange "Haskell Platform" "mtl" "== 2.1.3.1"
801− addRange "Haskell Platform" "network" "== 2.4.2.3"
802− addRange "Haskell Platform" "OpenGL" "== 2.9.2.0"
803− addRange "Haskell Platform" "OpenGLRaw" "== 1.5.0.0"
804− addRange "Haskell Platform" "parallel" "== 3.2.0.4"
805− addRange "Haskell Platform" "parsec" "== 3.1.5"
806− addRange "Haskell Platform" "primitive" "== 0.5.2.1"
807− addRange "Haskell Platform" "QuickCheck" "== 2.6"
808− addRange "Haskell Platform" "random" "== 1.0.1.1"
809− addRange "Haskell Platform" "regex-base" "== 0.93.2"
810− addRange "Haskell Platform" "regex-compat" "== 0.95.1"
811− addRange "Haskell Platform" "regex-posix" "== 0.95.2"
812− addRange "Haskell Platform" "split" "== 0.2.2"
813− addRange "Haskell Platform" "stm" "== 2.4.2"
814− addRange "Haskell Platform" "syb" "== 0.4.1"
815− addRange "Haskell Platform" "text" "== 1.1.0.0"
816− addRange "Haskell Platform" "transformers" "== 0.3.0.0"
817− addRange "Haskell Platform" "unordered-containers" "== 0.2.4.0"
818− addRange "Haskell Platform" "vector" "== 0.10.9.1"
819− addRange "Haskell Platform" "xhtml" "== 3000.2.1"
820− addRange "Haskell Platform" "zlib" "== 0.5.4.1"
821− addRange "Haskell Platform" "alex" "== 3.1.3"
822− addRange "Haskell Platform" "cabal-install" "== 1.18.0.5"
823− addRange "Haskell Platform" "happy" "== 1.19.4"
824− addRange "Haskell Platform" "hscolour" "== 1.20.3"
825−
826−-- | Replacement Github users. This is useful when a project is owned by an
827−-- organization. It also lets you ping multiple users.
828−--
829−-- Note that cross organization team mentions aren't allowed by Github.
830−convertGithubUser :: String -> [String]
831−convertGithubUser x =
832− fromMaybe [x] $ Map.lookup (map toLower x) pairs
833− where
834− pairs = Map.fromList
835− [ ("diagrams", ["byorgey", "fryguybob", "jeffreyrosenbluth", "bergey"])
836− , ("yesodweb", ["snoyberg"])
837− , ("fpco", ["snoyberg"])
838− , ("faylang", ["bergmark"])
839− , ("silkapp", ["bergmark", "hesselink"])
840− , ("snapframework",["mightybyte"])
841− , ("haskell-ro", ["mihaimaruseac"])
842− ]
8+-}
Stackage/GhcPkg.hsdeleted−49
@@ -1,49 +0,0 @@
1−module Stackage.GhcPkg where
2−
3−import Stackage.Types
4−import System.Process
5−import Distribution.Text (simpleParse)
6−import Distribution.Version (Version (Version))
7−import Data.Char (isSpace)
8−import qualified Data.Set as Set
9−
10−getPackages :: [String] -> GhcMajorVersion -> IO (Set PackageIdentifier)
11−getPackages extraArgs version = do
12− output <- readProcess "ghc-pkg" (extraArgs ++ [arg, "list"]) ""
13− fmap Set.unions $ mapM parse $ drop 1 $ lines output
14− where
15− -- Account for a change in command line option name
16− arg
17− | version >= GhcMajorVersion 7 6 = "--no-user-package-db"
18− | otherwise = "--no-user-package-conf"
19− parse s =
20− case clean s of
21− "" -> return Set.empty
22− s' ->
23− case simpleParse s' of
24− Just x -> return $ Set.singleton x
25− Nothing -> error $ "Could not parse ghc-pkg output: " ++ show s
26− clean = stripParens . dropWhile isSpace . reverse . dropWhile isSpace . reverse
27− stripParens x@('(':_:_)
28− | last x == ')' = tail $ init $ x
29− stripParens x = x
30−
31−getGlobalPackages :: GhcMajorVersion -> IO (Set PackageIdentifier)
32−getGlobalPackages version = getPackages [] version
33−
34−getDBPackages :: [FilePath] -> GhcMajorVersion -> IO (Set PackageIdentifier)
35−getDBPackages [] _ = return Set.empty
36−getDBPackages packageDirs version =
37− getPackages (map packageDbArg packageDirs) version
38− where
39− packageDbArg db
40− | version >= GhcMajorVersion 7 6 = "--package-db=" ++ db
41− | otherwise = "--package-conf" ++ db
42−
43−getGhcVersion :: IO GhcMajorVersion
44−getGhcVersion = do
45− versionOutput <- readProcess "ghc-pkg" ["--version"] ""
46− maybe (error $ "Invalid version output: " ++ show versionOutput) return $ do
47− verS:_ <- Just $ reverse $ words versionOutput
48− Version (x:y:_) _ <- simpleParse verS
49− return $ GhcMajorVersion x y
Stackage/Init.hsdeleted−32
@@ -1,32 +0,0 @@
1−module Stackage.Init (stackageInit) where
2−
3−import Data.List (isInfixOf, isPrefixOf)
4−import Stackage.Util
5−import System.FilePath ((</>))
6−
7−stackageInit :: IO ()
8−stackageInit = do
9− c <- getCabalRoot
10− let config = c </> "config"
11− orig <- readFile config
12− -- bypass laziness
13− _ <- return $! length orig
14− writeFile config $ unlines $ go $ lines orig
15− where
16− go = addStackage
17− . map commentHackage
18− . filter (\s -> not $ "stackage" `isInfixOf` s)
19−
20− addStackage [] = stackageLines []
21− addStackage (l:ls)
22− | "remote-repo-cache:" `isPrefixOf` l = stackageLines $ l : ls
23− | otherwise = l : addStackage ls
24−
25− stackageLines x =
26− "remote-repo: stackage:http://hackage.haskell.org/packages/archive"
27− : "remote-repo: stackage-extra:http://hackage.haskell.org/packages/archive"
28− : x
29−
30− commentHackage s
31− | s == "remote-repo: hackage.haskell.org:http://hackage.haskell.org/packages/archive" = "--" ++ s
32− | otherwise = s
Stackage/InstallInfo.hsdeleted−211
@@ -1,211 +0,0 @@
1−{-# LANGUAGE RecordWildCards #-}
2−{-# LANGUAGE TupleSections #-}
3−module Stackage.InstallInfo
4− ( getInstallInfo
5− , bpPackageList
6− ) where
7−
8−import Control.Monad (forM_, unless)
9−import Data.List (foldl')
10−import qualified Data.Map as Map
11−import qualified Data.Set as Set
12−import Data.Time (getCurrentTime, formatTime)
13−import Data.Version (showVersion)
14−import qualified Distribution.Text
15−import Distribution.Version (simplifyVersionRange, withinRange)
16−import Stackage.GhcPkg
17−import Stackage.LoadDatabase
18−import Stackage.NarrowDatabase
19−import Stackage.ServerFiles
20−import Stackage.Types
21−import Stackage.Util
22−import System.Directory (createDirectoryIfMissing)
23−import System.FilePath ((</>))
24−import qualified System.IO as IO
25−import qualified System.IO.UTF8
26−import System.Locale (defaultTimeLocale)
27−import System.Exit (exitFailure)
28−
29−dropExcluded :: SelectSettings
30− -> Map PackageName (VersionRange, Maintainer)
31− -> Map PackageName (VersionRange, Maintainer)
32−dropExcluded bs m0 =
33− foldl' (flip Map.delete) m0 (Set.toList $ excludedPackages bs)
34−
35−getInstallInfo :: SelectSettings -> IO InstallInfo
36−getInstallInfo settings = do
37− core <- do
38− putStrLn "Loading core packages from global database"
39− getGlobalPackages $ selectGhcVersion settings
40− underlay <- getDBPackages (selectUnderlayPackageDirs settings) (selectGhcVersion settings)
41− let underlaySet = Set.map pkgName underlay
42− coreMap = Map.unions
43− $ map (\(PackageIdentifier k v) -> Map.singleton k v)
44− $ Set.toList core
45− allPackages' =
46− stablePackages settings $ requireHaskellPlatform settings
47− allPackages = dropExcluded settings allPackages'
48− totalCore
49− | ignoreUpgradeableCore settings =
50− Map.fromList $ map (\n -> (PackageName n, Nothing)) $ words "base containers template-haskell"
51− | otherwise =
52− Map.fromList (map (\(PackageIdentifier p v) -> (p, Just v)) (Set.toList core))
53− `Map.union` Map.fromList (map (, Nothing) (Set.toList $ extraCore settings))
54−
55− putStrLn "Loading package database"
56− pdb <- loadPackageDB settings coreMap (Map.keysSet totalCore) allPackages underlaySet
57−
58− putStrLn "Narrowing package database"
59− (final, errs) <- narrowPackageDB settings (Map.keysSet totalCore) pdb $ Set.fromList $ Map.toList $ Map.map snd $ allPackages
60−
61− putStrLn "Printing build plan to build-plan.log"
62− System.IO.UTF8.writeFile "build-plan.log" $ unlines $ map showDep $ Map.toList final
63− System.IO.UTF8.writeFile "hackage-map.txt" $ unlines $ map showHackageMap $ Map.toList final
64−
65− unless (Set.null errs) $ do
66− putStrLn "Build plan requires some disallowed packages"
67− mapM_ putStrLn $ Set.toList errs
68− exitFailure
69−
70− putStrLn "Checking for bad versions"
71− case checkBadVersions settings coreMap pdb final of
72− badVersions
73− | Map.null badVersions -> return ()
74− | otherwise -> do
75− forM_ (Map.toList badVersions) $ \(user, badDeps) -> do
76− putStrLn $ user ++ " cannot use: "
77− forM_ (Map.toList badDeps) $ \(name, (version, range)) -> do
78− putStrLn $ concat
79− [ "- "
80− , packageVersionString (name, version)
81− , " -- "
82− , Distribution.Text.display $ simplifyVersionRange range
83− ]
84− putStrLn ""
85−
86− error "Conflicting build plan, exiting"
87−
88− let ii = InstallInfo
89− { iiCore = totalCore
90− , iiPackages = Map.map biToSPI final
91− , iiOptionalCore = Map.empty
92− , iiPackageDB = pdb
93− }
94−
95− forM_ [False, True] $ \isInc -> do
96− let incexc = if isInc then "inclusive" else "exclusive"
97−
98− now <- getCurrentTime
99− let ghcVer =
100− let GhcMajorVersion x y = selectGhcVersion settings
101− in show x ++ "." ++ show y
102− date = formatTime defaultTimeLocale "%Y-%m-%d" now
103−
104− createDirectoryIfMissing True incexc
105−
106− putStrLn $ "Inclusive/exclusive: " ++ incexc
107−
108− putStrLn "Creating hackage file (for publishing to Stackage server)"
109− let isHP = requireHaskellPlatform settings
110− IO.withBinaryFile (incexc </> "hackage") IO.WriteMode $ \hackageH ->
111− IO.withBinaryFile (incexc </> "create-snapshot.sh") IO.WriteMode
112− (createHackageFile isInc isHP ii ghcVer date hackageH)
113−
114− putStrLn "Creating desc file (for publishing to Stackage server)"
115− System.IO.UTF8.writeFile (incexc </> "desc") $ concat
116− [ "Stackage build for GHC "
117− , ghcVer
118− , if requireHaskellPlatform settings
119− then " + Haskell Platform"
120− else ""
121− , ", "
122− , date
123− , ", "
124− , incexc
125− , "\nGenerated on "
126− , show now
127− ]
128−
129− System.IO.UTF8.writeFile (incexc </> "slug") $ concat
130− [ date
131− , "-ghc"
132− , ghcVer
133− , if requireHaskellPlatform settings then "hp" else ""
134− , if isInc then "-inc" else "-exc"
135− ]
136−
137− return ii
138−
139−biToSPI :: BuildInfo -> SelectedPackageInfo
140−biToSPI BuildInfo {..} = SelectedPackageInfo
141− { spiVersion = biVersion
142− , spiMaintainer = biMaintainer
143− , spiGithubUser = biGithubUser
144− , spiHasTests = biHasTests
145− }
146−
147−showDep :: (PackageName, BuildInfo) -> String
148−showDep (PackageName name, BuildInfo {..}) =
149− concat
150− [ name
151− , "-"
152− , showVersion biVersion
153− , " ("
154− , unMaintainer biMaintainer
155− , " " ++ githubMentions biGithubUser
156− , ")"
157− , ": "
158− , unwords $ map unP biUsers
159− ]
160− where
161− unP (PackageName p) = p
162−
163−-- | Convert to format used by Hackage for displaying distribution versions.
164−-- For more info, see https://github.com/fpco/stackage/issues/38.
165−showHackageMap :: (PackageName, BuildInfo) -> String
166−showHackageMap (PackageName name, BuildInfo {..}) =
167− show (name, showVersion biVersion, Nothing :: Maybe String)
168−
169−bpPackageList :: BuildPlan -> [String]
170−bpPackageList = map packageVersionString . Map.toList . Map.map spiVersion . bpPackages
171−
172−-- | Check for internal mismatches in required and actual package versions.
173−checkBadVersions :: SelectSettings
174− -> Map PackageName Version -- ^ core
175− -> PackageDB
176− -> Map PackageName BuildInfo
177− -> Map String (Map PackageName (Version, VersionRange))
178−checkBadVersions settings core (PackageDB pdb) buildPlan =
179− Map.unions $ map getBadVersions $ Map.toList $ Map.filterWithKey unexpectedFailure buildPlan
180− where
181− unexpectedFailure name _ = name `Set.notMember` expectedFailures settings
182−
183− getBadVersions :: (PackageName, BuildInfo) -> Map String (Map PackageName (Version, VersionRange))
184− getBadVersions (name, bi)
185− | Map.null badVersions = Map.empty
186− | otherwise = Map.singleton display badVersions
187− where
188− badVersions = Map.unions $ map (uncurry checkPackage) $ Map.toList $ biDeps bi
189− display = concat
190− [ packageVersionString (name, biVersion bi)
191− , " ("
192− , unMaintainer $ biMaintainer bi
193− , case Map.lookup name pdb of
194− Just PackageInfo { piGithubUser = gus } -> " " ++ githubMentions gus
195− _ -> ""
196− , ")"
197− ]
198−
199− checkPackage :: PackageName -> VersionRange -> Map PackageName (Version, VersionRange)
200− checkPackage name vr =
201− case Map.lookup name buildPlan of
202− Nothing ->
203− case Map.lookup name core of
204− -- Might be part of extra-core
205− Nothing -> Map.empty
206− Just version
207− | version `withinRange` vr -> Map.empty
208− | otherwise -> Map.singleton name (version, vr)
209− Just bi
210− | biVersion bi `withinRange` vr -> Map.empty
211− | otherwise -> Map.singleton name (biVersion bi, vr)
Stackage/LoadDatabase.hsdeleted−264
@@ -1,264 +0,0 @@
1−{-# LANGUAGE ScopedTypeVariables #-}
2−module Stackage.LoadDatabase where
3−
4−import qualified Codec.Archive.Tar as Tar
5−import qualified Codec.Compression.GZip as GZip
6−import Control.Exception (IOException, handle)
7−import Control.Monad (guard, foldM)
8−import qualified Data.ByteString.Lazy as L
9−import qualified Data.ByteString.Lazy.Char8 as L8
10−import Data.List (stripPrefix)
11−import qualified Data.Map as Map
12−import Data.Maybe (catMaybes, listToMaybe,
13− mapMaybe, fromMaybe)
14−import Data.Monoid (Monoid (..))
15−import Data.Set (member)
16−import qualified Data.Set as Set
17−import Distribution.Compiler (CompilerFlavor (GHC))
18−import Distribution.Package (Dependency (Dependency))
19−import Distribution.PackageDescription (Condition (..),
20− ConfVar (..),
21− FlagName (FlagName),
22− RepoType (Git),
23− SourceRepo (..),
24− benchmarkBuildInfo,
25− buildInfo, buildTools,
26− condBenchmarks,
27− condExecutables,
28− condLibrary,
29− condTestSuites,
30− condTreeComponents,
31− condTreeConstraints,
32− condTreeData,
33− flagDefault, flagName,
34− genPackageFlags,
35− homepage, libBuildInfo,
36− packageDescription,
37− sourceRepos,
38− testBuildInfo)
39−import Distribution.PackageDescription.Parse (ParseResult (ParseOk),
40− parsePackageDescription)
41−import Distribution.System (buildArch, buildOS)
42−import Distribution.Text (simpleParse)
43−import Distribution.Version (Version (Version),
44− unionVersionRanges,
45− withinRange)
46−import Stackage.Config (convertGithubUser)
47−import Stackage.Types
48−import Stackage.Util
49−import System.Directory (doesFileExist, getDirectoryContents)
50−import System.FilePath ((<.>), (</>))
51−
52−-- | Load the raw package database.
53−--
54−-- We want to put in some restrictions:
55−--
56−-- * Drop all core packages. We never want to install a new version of
57−-- those, nor include them in the package list.
58−--
59−-- * For packages with a specific version bound, find the maximum matching
60−-- version.
61−--
62−-- * For other packages, select the maximum version number.
63−loadPackageDB :: SelectSettings
64− -> Map PackageName Version -- ^ core packages from HP file
65− -> Set PackageName -- ^ all core packages, including extras
66− -> Map PackageName (VersionRange, Maintainer) -- ^ additional deps
67− -> Set PackageName -- ^ underlay packages to exclude
68− -> IO PackageDB
69−loadPackageDB settings coreMap core deps underlay = do
70− tarName <- getTarballName
71− lbs <- L.readFile tarName
72− pdb <- addEntries mempty $ Tar.read lbs
73− contents <- handle (\(_ :: IOException) -> return [])
74− $ getDirectoryContents $ selectTarballDir settings
75− pdb' <- foldM addTarball pdb $ mapMaybe stripTarGz contents
76− return $ excludeUnderlay pdb'
77− where
78− addEntries _ (Tar.Fail e) = error $ show e
79− addEntries db Tar.Done = return db
80− addEntries db (Tar.Next e es) = addEntry db e >>= flip addEntries es
81−
82− stripTarGz = fmap reverse . stripPrefix (reverse ".tar.gz") . reverse
83−
84− ghcVersion' =
85− let GhcMajorVersion x y = selectGhcVersion settings
86− in Version [x, y, 2] []
87−
88− addEntry :: PackageDB -> Tar.Entry -> IO PackageDB
89− addEntry pdb e =
90− case getPackageVersion e of
91− Nothing -> return pdb
92− Just (p, v)
93− | p `member` core -> return pdb
94− | otherwise ->
95− case Map.lookup p deps of
96− Just (vrange, _maintainer)
97− | not $ withinRange v vrange -> return pdb
98− _ -> do
99− let pkgname = packageVersionString (p, v)
100− tarball = selectTarballDir settings </> pkgname <.> "tar.gz"
101− case Tar.entryContent e of
102− Tar.NormalFile bs _ -> addPackage p v bs pdb
103− _ -> return pdb
104−
105− addTarball :: PackageDB -> FilePath -> IO PackageDB
106− addTarball pdb tarball' = do
107− lbs <- L.readFile tarball
108− let (v', p') = break (== '-') $ reverse tarball'
109− p = PackageName $ reverse $ drop 1 p'
110− v <- maybe (error $ "Invalid tarball name: " ++ tarball) return
111− $ simpleParse $ reverse v'
112− case Map.lookup p deps of
113− Just (vrange, _)
114− | not $ withinRange v vrange -> return pdb
115− _ -> findCabalAndAddPackage tarball p v pdb $ Tar.read $ GZip.decompress lbs
116− where
117− tarball = selectTarballDir settings </> tarball' <.> "tar.gz"
118−
119− excludeUnderlay :: PackageDB -> PackageDB
120− excludeUnderlay (PackageDB pdb) =
121− PackageDB $ Map.filterWithKey (\k _ -> Set.notMember k underlay) pdb
122−
123− skipTests p = p `Set.member` skippedTests settings
124−
125− -- Find the relevant cabal file in the given entries and add its contents
126− -- to the package database
127− findCabalAndAddPackage tarball p v pdb =
128− loop
129− where
130− fixPath '\\' = '/'
131− fixPath c = c
132−
133− expectedPath = let PackageName p' = p in concat
134− [ packageVersionString (p, v)
135− , "/"
136− , p'
137− , ".cabal"
138− ]
139− loop Tar.Done = error $ concat
140− [ "Missing cabal file "
141− , show expectedPath
142− , " in tarball: "
143− , show tarball
144− ]
145− loop (Tar.Fail e) = error $ concat
146− [ "Unable to read tarball "
147− , show tarball
148− , ": "
149− , show e
150− ]
151− loop (Tar.Next entry rest)
152− | map fixPath (Tar.entryPath entry) == expectedPath =
153− case Tar.entryContent entry of
154− Tar.NormalFile bs _ -> addPackage p v bs pdb
155− _ -> error $ concat
156− [ "In tarball "
157− , show tarball
158− , " the cabal file "
159− , show expectedPath
160− , " was not a normal file"
161− ]
162− | otherwise = loop rest
163−
164− addPackage p v lbs pdb = do
165− let (deps', hasTests, buildToolsExe', buildToolsOther', mgpd, execs, mgithub) = parseDeps p lbs
166− return $ mappend pdb $ PackageDB $ Map.singleton p PackageInfo
167− { piVersion = v
168− , piDeps = deps'
169− , piHasTests = hasTests
170− , piBuildToolsExe = buildToolsExe'
171− , piBuildToolsAll = buildToolsExe' `Set.union` buildToolsOther'
172− , piGPD = mgpd
173− , piExecs = execs
174− , piGithubUser = fromMaybe [] mgithub
175− }
176−
177− parseDeps p lbs =
178− case parsePackageDescription $ L8.unpack lbs of
179− ParseOk _ gpd -> (mconcat
180− [ maybe mempty (go gpd) $ condLibrary gpd
181− , mconcat $ map (go gpd . snd) $ condExecutables gpd
182− , if skipTests p
183− then mempty
184− else mconcat $ map (go gpd . snd) $ condTestSuites gpd
185− -- FIXME , mconcat $ map (go gpd . snd) $ condBenchmarks gpd
186− ], not $ null $ condTestSuites gpd
187− , Set.fromList $ map depName $ libExeBuildInfo gpd
188− , Set.fromList $ map depName $ testBenchBuildInfo gpd
189− , Just gpd
190− , Set.fromList $ map (Executable . fst) $ condExecutables gpd
191− , fmap convertGithubUser $ listToMaybe $ catMaybes
192− $ parseGithubUserHP (homepage $ packageDescription gpd)
193− : map parseGithubUserSR (sourceRepos $ packageDescription gpd)
194− )
195− _ -> (mempty, defaultHasTestSuites, Set.empty, Set.empty, Nothing, Set.empty, Nothing)
196− where
197− libExeBuildInfo gpd = concat
198− [ maybe mempty (goBI libBuildInfo) $ condLibrary gpd
199− , concat $ map (goBI buildInfo . snd) $ condExecutables gpd
200− ]
201− testBenchBuildInfo gpd = concat
202− [ if skipTests p
203− then []
204− else concat $ map (goBI testBuildInfo . snd) $ condTestSuites gpd
205− , concat $ map (goBI benchmarkBuildInfo . snd) $ condBenchmarks gpd
206− ]
207− goBI f x = buildTools $ f $ condTreeData x
208−
209− depName (Dependency (PackageName pn) _) = Executable pn
210− go gpd tree
211− = Map.filterWithKey (\k _ -> not $ ignoredDep k)
212− $ Map.unionsWith unionVersionRanges
213− $ Map.fromList (map (\(Dependency pn vr) -> (pn, vr)) $ condTreeConstraints tree)
214− : map (go gpd) (mapMaybe (checkCond gpd) $ condTreeComponents tree)
215−
216− -- Some specific overrides for cases where getting Stackage to be smart
217− -- enough to handle things would be too difficult.
218− ignoredDep :: PackageName -> Bool
219− ignoredDep dep
220− -- The flag logic used by text-stream-decode confuses Stackage.
221− | dep == PackageName "text" && p == PackageName "text-stream-decode" = True
222− | otherwise = False
223−
224− checkCond gpd (cond, tree, melse)
225− | checkCond' cond = Just tree
226− | otherwise = melse
227− where
228− checkCond' (Var (OS os)) = os == buildOS
229− checkCond' (Var (Arch arch)) = arch == buildArch
230−
231− -- Sigh... the small_base flag on mersenne-random-pure64 is backwards
232− checkCond' (Var (Flag (FlagName "small_base")))
233− | p == PackageName "mersenne-random-pure64" = False
234−
235− checkCond' (Var (Flag flag@(FlagName flag'))) =
236− flag' `Set.notMember` disabledFlags settings &&
237− flag `elem` flags'
238− checkCond' (Var (Impl compiler range)) =
239− compiler == GHC && withinRange ghcVersion' range
240− checkCond' (Lit b) = b
241− checkCond' (CNot c) = not $ checkCond' c
242− checkCond' (COr c1 c2) = checkCond' c1 || checkCond' c2
243− checkCond' (CAnd c1 c2) = checkCond' c1 && checkCond' c2
244−
245− flags' = map flagName (filter flagDefault $ genPackageFlags gpd) ++
246− (map FlagName $ Set.toList $ Stackage.Types.flags settings coreMap)
247−
248−-- | Attempt to grab the Github username from a homepage.
249−parseGithubUserHP :: String -> Maybe String
250−parseGithubUserHP url1 = do
251− url2 <- listToMaybe $ mapMaybe (flip stripPrefix url1)
252− [ "http://github.com/"
253− , "https://github.com/"
254− ]
255− let x = takeWhile (/= '/') url2
256− guard $ not $ null x
257− Just x
258−
259−-- | Attempt to grab the Github username from a source repo.
260−parseGithubUserSR :: SourceRepo -> Maybe String
261−parseGithubUserSR sr =
262− case (repoType sr, repoLocation sr) of
263− (Just Git, Just s) -> parseGithubUserHP s
264− _ -> Nothing
Stackage/ModuleNameConflict.hsdeleted−52
@@ -1,52 +0,0 @@
1−module Stackage.ModuleNameConflict
2− ( ModuleNameConflicts
3− , getModuleNameConflicts
4− , renderModuleNameConflicts
5− , parseModuleNameConflicts
6− ) where
7−
8−import Distribution.Simple.Configure (configCompiler, getInstalledPackages)
9−import Distribution.Simple.Compiler (CompilerFlavor (GHC), PackageDB (GlobalPackageDB, SpecificPackageDB))
10−import Distribution.Verbosity (normal)
11−import Distribution.Simple.Program (defaultProgramConfiguration)
12−import Distribution.Simple.PackageIndex (moduleNameIndex)
13−import Distribution.InstalledPackageInfo (sourcePackageId)
14−import Distribution.Package (PackageIdentifier (PackageIdentifier), PackageName (PackageName))
15−import qualified Data.Map as Map
16−import qualified Data.Set as Set
17−import Data.List (intercalate)
18−import Distribution.ModuleName (components)
19−
20−type ModuleNameConflicts = Map.Map (Set.Set String) (Set.Set String)
21−
22−getModuleNameConflicts :: FilePath -> IO ModuleNameConflicts
23−getModuleNameConflicts path = do
24− (compiler, progConfig) <-
25− configCompiler (Just GHC) Nothing Nothing defaultProgramConfiguration normal
26− let stack =
27− [ GlobalPackageDB
28− , SpecificPackageDB path
29− ]
30− packageIndex <- getInstalledPackages normal compiler stack progConfig
31− let modMap = moduleNameIndex packageIndex
32− packageName (PackageIdentifier (PackageName x) _) = x
33− simpleMN = intercalate "." . components
34− overlaps = Map.unionsWith Set.union
35− $ map (\(mn, pkgs) -> Map.singleton pkgs (Set.singleton $ simpleMN mn))
36− $ Map.toList
37− $ Map.filter (\x -> Set.size x > 1)
38− $ Map.map Set.fromList
39− $ fmap (map (packageName . sourcePackageId)) modMap
40− return overlaps
41−
42−renderModuleNameConflicts :: ModuleNameConflicts -> String
43−renderModuleNameConflicts =
44− unlines . map (unwords . Set.toList) . concatMap (\(x, y) -> [x, y]) . Map.toList
45−
46−parseModuleNameConflicts :: String -> ModuleNameConflicts
47−parseModuleNameConflicts =
48− Map.fromList . toPairs . map (Set.fromList . words) . lines
49− where
50− toPairs [] = []
51− toPairs [_] = []
52− toPairs (x:y:z) = (x, y) : toPairs z
Stackage/NarrowDatabase.hsdeleted−54
@@ -1,54 +0,0 @@
1−module Stackage.NarrowDatabase where
2−
3−import Control.Monad.Trans.Writer
4−import Data.List (foldl')
5−import qualified Data.Map as Map
6−import qualified Data.Set as Set
7−import Prelude hiding (pi)
8−import Stackage.Types
9−import Stackage.Util
10−
11−-- | Narrow down the database to only the specified packages and all of
12−-- their dependencies.
13−narrowPackageDB :: SelectSettings
14− -> Set PackageName -- ^ core packages to be excluded from installation
15− -> PackageDB
16− -> Set (PackageName, Maintainer)
17− -> IO (Map PackageName BuildInfo, Set String)
18−narrowPackageDB settings core (PackageDB pdb) packageSet =
19− runWriterT $ loop Map.empty $ Set.map (\(name, maintainer) -> ([], name, maintainer)) packageSet
20− where
21− loop result toProcess =
22− case Set.minView toProcess of
23− Nothing -> return result
24− Just ((users, p, maintainer), toProcess') ->
25− case Map.lookup p pdb of
26− Nothing
27− | p `Set.member` core -> loop result toProcess'
28− | null users -> error $ "Unknown package: " ++ show p
29− | otherwise -> loop result toProcess'
30− Just pi -> do
31− let users' = p:users
32− result' = Map.insert p BuildInfo
33− { biVersion = piVersion pi
34− , biUsers = users
35− , biMaintainer = maintainer
36− , biDeps = piDeps pi
37− , biGithubUser = piGithubUser pi
38− , biHasTests = piHasTests pi
39− } result
40− case piGPD pi of
41− Nothing -> return ()
42− Just gpd ->
43− case allowedPackage settings gpd of
44− Left msg -> tell $ Set.singleton $ concat
45− [ packageVersionString (p, piVersion pi)
46− , ": "
47− , msg
48− ]
49− Right () -> return ()
50− loop result' $ foldl' (addDep users' result' maintainer) toProcess' $ Map.keys $ piDeps pi
51− addDep users result maintainer toProcess p =
52− case Map.lookup p result of
53− Nothing -> Set.insert (users, p, maintainer) toProcess
54− Just{} -> toProcess
Stackage/Select.hsdeleted−173
@@ -1,173 +0,0 @@
1−{-# LANGUAGE PatternGuards #-}
2−{-# LANGUAGE CPP #-}
3−module Stackage.Select
4− ( select
5− , defaultSelectSettings
6− ) where
7−
8−import Data.Either (partitionEithers)
9−import qualified Data.Map as Map
10−import Data.Maybe (mapMaybe)
11−import Data.Set (empty)
12−import qualified Data.Set as Set
13−import Distribution.Text (simpleParse)
14−import Distribution.Version (withinRange)
15−import Prelude hiding (pi)
16−import Stackage.Config
17−import Stackage.InstallInfo
18−import Stackage.Types
19−import Stackage.Util
20−
21−defaultSelectSettings :: GhcMajorVersion
22− -> Bool -- ^ haskell platform?
23− -> SelectSettings
24−defaultSelectSettings version requireHP = SelectSettings
25− { extraCore = defaultExtraCore version
26− , expectedFailures = defaultExpectedFailures version requireHP
27− , stablePackages = defaultStablePackages version
28− , haskellPlatformDir = "hp"
29− , requireHaskellPlatform = requireHP
30− , ignoreUpgradeableCore = False
31− , excludedPackages = empty
32− , flags = \coreMap ->
33− Set.fromList (words "blaze_html_0_5 small_base https splitbase old-locale new-base") `Set.union`
34−
35−#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
36− -- Needed on Windows to get unix-compat to compile
37− (if version >= GhcMajorVersion 7 6 then Set.empty else Set.fromList (words "old-time"))
38− `Set.union`
39−#endif
40− -- Support for containers-unicode-symbols
41− (case Map.lookup (PackageName "containers") coreMap of
42− Just v | Just range <- simpleParse "< 0.5", v `withinRange` range
43− -> Set.singleton "containers-old"
44− _ -> Set.empty) `Set.union`
45−
46− {-
47− -- Support for network 2.6
48− (if version >= GhcMajorVersion 7 8 && not requireHP
49− then Set.singleton "network-uri"
50− else Set.empty)
51− -}
52− Set.empty
53− , disabledFlags = Set.fromList (words "bytestring-in-base test-hlint")
54− `Set.union`
55− (if version <= GhcMajorVersion 7 4
56− then Set.singleton "bytestring-builder"
57− else Set.empty)
58−
59− -- SHA and binary
60−
61− `Set.union`
62− (if version <= GhcMajorVersion 7 6
63− then Set.singleton "decoderinterface"
64− else Set.empty) `Set.union`
65−
66− {-
67− -- Support for network 2.6
68− (if version >= GhcMajorVersion 7 8 && not requireHP
69− then Set.empty
70− else Set.singleton "network-uri")
71− -}
72− Set.singleton "network-uri"
73− , allowedPackage = const $ Right ()
74− , useGlobalDatabase = False
75− , skippedTests =
76− Set.insert (PackageName "ReadArgs") $ -- old version of hspec
77− Set.insert (PackageName "ersatz") $ -- old QuickCheck
78− if version >= GhcMajorVersion 7 8
79− then Set.fromList
80− [ PackageName "punycode" -- pulls in encoding
81− ]
82− else Set.empty
83− , selectGhcVersion = version
84− , selectTarballDir = "patching/tarballs"
85− , selectUnderlayPackageDirs = []
86− }
87−
88−select :: SelectSettings -> IO BuildPlan
89−select settings' = do
90− ii <- getInstallInfo settings'
91−
92− bt <-
93− case iiBuildTools ii of
94− Left s -> error $ "Could not topologically sort build tools: " ++ s
95− Right x -> return x
96−
97− return BuildPlan
98− { bpTools = bt
99− , bpPackages = iiPackages ii
100− , bpOptionalCore = iiOptionalCore ii
101− , bpCore = iiCore ii
102− , bpSkippedTests = skippedTests settings'
103− , bpExpectedFailures = expectedFailures settings'
104− }
105−
106−-- | Get all of the build tools required.
107−iiBuildTools :: InstallInfo -> Either String [String]
108−iiBuildTools InstallInfo { iiPackageDB = PackageDB m, iiPackages = packages } =
109− fmap (map packageVersionString)
110− $ topSort
111− $ map addDependencies
112− $ filter (flip Set.notMember coreTools . fst)
113− $ Set.toList
114− $ Set.fromList
115− $ mapMaybe (flip Map.lookup buildToolMap)
116− $ Set.toList
117− $ Set.unions
118− $ map piBuildToolsAll
119− $ Map.elems
120− $ Map.filterWithKey isSelected m
121− where
122− isSelected name _ = name `Set.member` selected
123− selected = Set.fromList $ Map.keys packages
124−
125− -- Build tools shipped with GHC which we should not attempt to build
126− -- ourselves.
127− coreTools = Set.fromList $ map PackageName $ words "hsc2hs"
128−
129− -- The map from build tool name to the package it comes from.
130− buildToolMap :: Map Executable (PackageName, Version)
131− buildToolMap = Map.unions $ map toBuildToolMap $ Map.toList m
132−
133− toBuildToolMap :: (PackageName, PackageInfo) -> Map Executable (PackageName, Version)
134− toBuildToolMap (pn, pi) = Map.unions
135− $ map (flip Map.singleton (pn, piVersion pi))
136− $ Set.toList
137− $ piExecs pi
138−
139− addDependencies :: (PackageName, Version) -> ((PackageName, Version), Set (PackageName, Version))
140− addDependencies (pn, pv) =
141− ((pn, pv), deps)
142− where
143− deps =
144− case Map.lookup pn m of
145− Nothing -> Set.empty
146− Just pi -> Set.fromList
147− $ mapMaybe (flip Map.lookup buildToolMap)
148− $ Set.toList
149− $ piBuildToolsExe pi `Set.union` manualDeps
150−
151− manualDeps
152− | pn == PackageName "c2hs" = Set.singleton $ Executable "happy"
153− | otherwise = Set.empty
154−
155−topSort :: (Show a, Ord a) => [(a, Set a)] -> Either String [a]
156−topSort orig =
157− uncurry go . partitionEithers . map (splitter . limitDeps) $ orig
158− where
159− splitter (x, y)
160− | Set.null y = Left x
161− | otherwise = Right (x, y)
162−
163− go x [] = Right x
164− go [] y = Left $ "The following form a cycle: " ++ show (map fst y)
165− go (x:xs) ys = do
166− let (xs', ys') = partitionEithers $ map (splitter . dropDep x) ys
167− rest <- go (xs ++ xs') ys'
168− return $ x : rest
169−
170− dropDep x (y, z) = (y, Set.delete x z)
171−
172− allVertices = Set.fromList $ map fst orig
173− limitDeps (x, y) = (x, Set.intersection allVertices y)
Stackage/ServerFiles.hsdeleted−104
@@ -1,104 +0,0 @@
1−-- | Create the files necessary for Stackage server.
2−module Stackage.ServerFiles
3− ( createHackageFile
4− ) where
5−
6−import Stackage.Util
7−import Stackage.Types
8−import qualified Data.Map as Map
9−import Control.Exception (throwIO)
10−import qualified Codec.Archive.Tar as Tar
11−import qualified Data.ByteString.Lazy as L
12−import Control.Arrow (second)
13−import Control.Monad (unless)
14−import Distribution.Text (display)
15−import System.Directory (doesFileExist)
16−import System.FilePath ((</>), (<.>))
17−import System.IO (Handle, hPutStrLn, hPutStr)
18−
19−createHackageFile :: Bool -- ^ inclusive?
20− -> Bool -- ^ haskell platform?
21− -> InstallInfo
22− -> String -- ^ GHC version
23− -> String -- ^ date
24− -> Handle -- ^ hackage
25− -> Handle -- ^ tarballs
26− -> IO ()
27−createHackageFile isInc hp ii ghcVer date hackageH tarballH = do
28− let stackageFP = concat
29− [ "../ghc-"
30− , ghcVer
31− , if hp then "hp" else ""
32− , "-"
33− , date
34− , if isInc then "-inclusive" else "-exclusive"
35− , ".stackage"
36− ]
37− hPutStr tarballH $ concat
38− [ "#!/bin/bash -ex\n\ntar czfv "
39− , stackageFP
40− , " hackage desc slug ../build*"
41− ]
42− indextargz <- getTarballName
43− indexLBS <- L.readFile indextargz
44− loop $ Tar.read indexLBS
45− hPutStrLn tarballH ""
46− hPutStrLn tarballH $ concat
47− [ "runghc ../stackage-upload.hs "
48− , stackageFP
49− , " unstable-ghc"
50− , filter (/= '.') ghcVer
51− , if hp then "hp" else ""
52− , if isInc then "-inclusive" else "-exclusive"
53− ]
54−
55− unless isInc $ do
56− -- Add in some OS-specific package/version combos to work with
57− -- non-Linux systems.
58− hPutStrLn hackageH "hfsevents-0.1.5"
59− hPutStrLn hackageH "Win32-notify-0.3"
60− where
61− selected = Map.fromList . map toStrs . Map.toList $
62− fmap spiVersion (iiPackages ii)
63− `Map.union` iiOptionalCore ii
64− `Map.union` Map.mapMaybe id (iiCore ii)
65−
66− toStrs (PackageName name, version) = (name, display version)
67−
68− loop Tar.Done = return ()
69− loop (Tar.Fail e) = throwIO e
70− loop (Tar.Next e es) = go e >> loop es
71−
72− go e =
73− case parsePair $ Tar.entryPath e of
74− Nothing -> return ()
75− Just (name, version) ->
76− case Map.lookup name selected of
77− Just version'
78− | version == version' -> emit True name version
79− | otherwise -> return ()
80− Nothing
81− | isInc -> emit False name version
82− | otherwise -> return ()
83−
84− emit usePatch name version = do
85− exists <- if usePatch then doesFileExist tarball else return False
86− if exists
87− then hPutStr tarballH $ ' ' : ".." </> tarball
88− else hPutStrLn hackageH base
89− where
90− base = concat [name, "-", version]
91− tarball = "patching" </> "tarballs" </> base <.> "tar" <.> "gz"
92−
93−parsePair :: String -> Maybe (String, String)
94−parsePair s =
95− case splitOn '/' s of
96− [name, version, cabal] | name ++ ".cabal" == cabal -> Just (name, version)
97− _ -> Nothing
98−
99−splitOn :: Eq a => a -> [a] -> [[a]]
100−splitOn _ [] = []
101−splitOn c x =
102− y : splitOn c z
103− where
104− (y, z) = second (drop 1) $ break (== c) x
Stackage/Tarballs.hsdeleted−45
@@ -1,45 +0,0 @@
1−module Stackage.Tarballs
2− ( makeTarballs
3− ) where
4−
5−import qualified Codec.Archive.Tar as Tar
6−import qualified Data.ByteString.Lazy as L
7−import qualified Data.Map as Map
8−import qualified Data.Set as Set
9−import Stackage.Types
10−import Stackage.Util
11−import System.Directory (createDirectoryIfMissing)
12−import System.FilePath (takeDirectory)
13−
14−makeTarballs :: BuildPlan -> IO ()
15−makeTarballs bp = do
16− putStrLn "Building tarballs"
17− tarName <- getTarballName
18− origEntries <- fmap Tar.read $ L.readFile tarName
19− (stableEntries, extraEntries) <- loop id id origEntries
20−
21− (stableTar, extraTar) <- getStackageTarballNames
22−
23− createDirectoryIfMissing True $ takeDirectory stableTar
24− L.writeFile stableTar $ Tar.write stableEntries
25−
26− createDirectoryIfMissing True $ takeDirectory extraTar
27− L.writeFile extraTar $ Tar.write extraEntries
28− where
29− -- Using "error . show" for compatibility with tar 0.3 and 0.4
30− loop _ _ (Tar.Fail err) = error $ show err
31− loop stable extra Tar.Done = return (stable [], extra [])
32− loop stable extra (Tar.Next e es) =
33− loop stable' extra' es
34− where
35− (stable', extra') =
36− case getPackageVersion e of
37− Nothing -> (stable, extra)
38− Just (package, version) ->
39− case Map.lookup package $ bpPackages bp of
40− Just spi
41− | version == spiVersion spi -> (stable . (e:), extra)
42− | otherwise -> (stable, extra)
43− Nothing
44− | package `Map.member` bpCore bp -> (stable, extra)
45− | otherwise -> (stable, extra . (e:))
Stackage/Test.hsdeleted−298
@@ -1,298 +0,0 @@
1−{-# LANGUAGE DeriveDataTypeable #-}
2−{-# LANGUAGE RecordWildCards #-}
3−{-# LANGUAGE ScopedTypeVariables #-}
4−module Stackage.Test
5− ( runTestSuites
6− ) where
7−
8−import qualified Control.Concurrent as C
9−import Control.Exception (Exception, SomeException, handle, throwIO, IOException, try)
10−import Control.Monad (replicateM, unless, when, forM_)
11−import qualified Data.Map as Map
12−import qualified Data.Set as Set
13−import qualified Control.Monad.Trans.Writer as W
14−import Distribution.Package (Dependency (Dependency))
15−import Data.Version (parseVersion, Version (Version))
16−import Data.Typeable (Typeable)
17−import Stackage.Types
18−import Stackage.Util
19−import System.Directory (copyFile, createDirectory,
20− createDirectoryIfMissing, doesFileExist, findExecutable,
21− getDirectoryContents, removeFile,
22− renameDirectory, canonicalizePath)
23−import System.Exit (ExitCode (ExitSuccess))
24−import System.FilePath ((<.>), (</>), takeDirectory)
25−import System.IO (IOMode (WriteMode, AppendMode),
26− withBinaryFile)
27−import System.Process (readProcess, runProcess, waitForProcess, createProcess, proc, cwd)
28−import Text.ParserCombinators.ReadP (readP_to_S)
29−import Data.IORef (IORef, readIORef, atomicModifyIORef, newIORef)
30−import qualified Data.ByteString.Lazy as L
31−import qualified Data.ByteString.Lazy.Char8 as L8
32−import qualified Distribution.PackageDescription as PD
33−import Distribution.PackageDescription.Parse (ParseResult (ParseOk),
34− parsePackageDescription)
35−
36−runTestSuites :: BuildSettings -> BuildPlan -> IO ()
37−runTestSuites settings' bp = do
38− settings <- fixBuildSettings settings'
39− let selected' = Map.filterWithKey notSkipped $ bpPackages bp
40− let testdir = "runtests"
41− docdir = "haddock"
42− rm_r testdir
43− rm_r docdir
44− createDirectory testdir
45− createDirectory docdir
46−
47− putStrLn "Determining package dependencies"
48− selected <- mapM (addDependencies settings (Map.keysSet selected') testdir)
49− $ Map.toList selected'
50− putStrLn "Running test suites"
51−
52− copyBuiltInHaddocks docdir
53−
54− cabalVersion <- getCabalVersion
55− haddockFilesRef <- newIORef []
56− allPass <- parFoldM
57− (testWorkerThreads settings)
58− (runTestSuite cabalVersion settings testdir docdir bp haddockFilesRef)
59− (&&)
60− True
61− selected
62− unless allPass $ error $ "There were failures, please see the logs in " ++ testdir
63− where
64− notSkipped p _ = p `Set.notMember` bpSkippedTests bp
65−
66−addDependencies :: BuildSettings
67− -> Set PackageName -- ^ all packages to be installed
68− -> FilePath -- ^ testdir
69− -> (PackageName, SelectedPackageInfo)
70− -> IO (PackageName, Set PackageName, SelectedPackageInfo)
71−addDependencies settings allPackages testdir (packageName, spi) = do
72− package' <- replaceTarball (tarballDir settings) package
73− deps <- handle (\e -> print (e :: IOException) >> return Set.empty)
74− $ getDeps allPackages testdir packageName package package'
75− return (packageName, deps, spi)
76− where
77− package = packageVersionString (packageName, spiVersion spi)
78−
79−getDeps :: Set PackageName -- ^ all packages to be installed
80− -> FilePath -> PackageName -> String -> String -> IO (Set PackageName)
81−getDeps allPackages testdir (PackageName name) nameVer loc = do
82− (Nothing, Nothing, Nothing, ph) <- createProcess
83− (proc "cabal" ["unpack", loc, "--verbose=0"]) { cwd = Just testdir }
84− ec <- waitForProcess ph
85− unless (ec == ExitSuccess) $ error $ "Unable to unpack: " ++ loc
86− lbs <- L.readFile $ testdir </> nameVer </> name <.> "cabal"
87− case parsePackageDescription $ L8.unpack lbs of
88− ParseOk _ gpd -> return $ Set.intersection allPackages $ allLibraryDeps gpd
89− _ -> return Set.empty
90−
91−allLibraryDeps :: PD.GenericPackageDescription -> Set PackageName
92−allLibraryDeps =
93− maybe Set.empty (W.execWriter . goTree) . PD.condLibrary
94− where
95− goTree tree = do
96− mapM_ goDep $ PD.condTreeConstraints tree
97− forM_ (PD.condTreeComponents tree) $ \(_, y, z) -> do
98− goTree y
99− maybe (return ()) goTree z
100−
101− goDep (Dependency pn _) = W.tell $ Set.singleton pn
102−
103−getCabalVersion :: IO CabalVersion
104−getCabalVersion = do
105− output <- readProcess "cabal" ["--numeric-version"] ""
106− case filter (null . snd) $ readP_to_S parseVersion $ filter notCRLF output of
107− (Version (x:y:_) _, _):_ -> return $ CabalVersion x y
108− _ -> error $ "Invalid cabal version: " ++ show output
109− where
110− notCRLF '\n' = False
111− notCRLF '\r' = False
112− notCRLF _ = True
113−
114−parFoldM :: Int -- ^ number of threads
115− -> ((PackageName, payload) -> IO c)
116− -> (a -> c -> a)
117− -> a
118− -> [(PackageName, Set PackageName, payload)]
119− -> IO a
120−parFoldM threadCount0 f g a0 bs0 = do
121− ma <- C.newMVar a0
122− mbs <- C.newMVar bs0
123− signal <- C.newEmptyMVar
124− completed <- newIORef Set.empty
125− tids <- replicateM threadCount0 $ C.forkIO $ worker completed ma mbs signal
126− wait threadCount0 signal tids
127−
128− unrun <- C.takeMVar mbs
129− when (not $ null unrun) $
130− error $ "The following tests were not run: " ++ unwords
131− [x | (PackageName x, _, _) <- unrun]
132− C.takeMVar ma
133− where
134− worker completedRef ma mbs signal =
135− handle
136− (C.putMVar signal . Just)
137− (loop >> C.putMVar signal Nothing)
138− where
139− loop = do
140− mb <- C.modifyMVar mbs $ \bs -> do
141− completed <- readIORef completedRef
142− return $ case findReady completed bs of
143− -- There's a workload ready with no deps
144− Just (b, bs') -> (bs', Just b)
145− -- No workload with no deps
146− Nothing -> (bs, Nothing)
147− case mb of
148− Nothing -> return ()
149− Just (name, _, payload) -> do
150− c <- f (name, payload)
151− C.modifyMVar_ ma $ \a -> return $! g a c
152− atomicModifyIORef completedRef $ \s -> (Set.insert name s, ())
153− loop
154− wait threadCount signal tids
155− | threadCount == 0 = return ()
156− | otherwise = do
157− me <- C.takeMVar signal
158− case me of
159− Nothing -> wait (threadCount - 1) signal tids
160− Just e -> do
161− mapM_ C.killThread tids
162− throwIO (e :: SomeException)
163−
164−-- | Find a workload whose dependencies have been met.
165−findReady :: Ord key
166− => Set key -- ^ workloads already complete
167− -> [(key, Set key, value)]
168− -> Maybe ((key, Set key, value), [(key, Set key, value)])
169−findReady completed =
170− loop id
171− where
172− loop _ [] = Nothing
173− loop front (x@(_, deps, _):xs)
174− | Set.null $ Set.difference deps completed = Just (x, front xs)
175− | otherwise = loop (front . (x:)) xs
176−
177−data TestException = TestException
178− deriving (Show, Typeable)
179−instance Exception TestException
180−
181−data CabalVersion = CabalVersion Int Int
182− deriving (Eq, Ord, Show)
183−
184−runTestSuite :: CabalVersion
185− -> BuildSettings
186− -> FilePath -- ^ testdir
187− -> FilePath -- ^ docdir
188− -> BuildPlan
189− -> IORef [(String, FilePath)] -- ^ .haddock files
190− -> (PackageName, SelectedPackageInfo)
191− -> IO Bool
192−runTestSuite cabalVersion settings testdir docdir
193− bp haddockFilesRef (packageName, SelectedPackageInfo {..}) = do
194− -- Set up a new environment that includes the sandboxed bin folder in PATH.
195− env' <- getModifiedEnv settings
196− let menv = Just $ addSandbox env'
197− addSandbox = (("HASKELL_PACKAGE_SANDBOX", packageDir settings):)
198−
199− let run cmd args wdir handle' = do
200− ph <- runProcess cmd args (Just wdir) menv Nothing (Just handle') (Just handle')
201− ec <- waitForProcess ph
202− unless (ec == ExitSuccess) $ throwIO TestException
203−
204− passed <- handle (\TestException -> return False) $ do
205− case cabalFileDir settings of
206− Nothing -> return ()
207− Just cfd -> do
208− let PackageName name = packageName
209− basename = name ++ ".cabal"
210− src = dir </> basename
211− dst = cfd </> basename
212− createDirectoryIfMissing True cfd
213− copyFile src dst
214− getHandle WriteMode $ run "cabal" (addCabalArgs settings BSTest ["configure", "--enable-tests"]) dir
215−
216− -- Try building docs first in case tests have an expected failure.
217− when (buildDocs settings) $ do
218− -- https://github.com/gtk2hs/gtk2hs/issues/79
219− when (packageName `Set.member` buildBeforeHaddock) $
220− getHandle AppendMode $ run "cabal" ["build"] dir
221−
222− hfs <- readIORef haddockFilesRef
223− let hfsOpts = flip map hfs $ \(pkgVer, hf) -> concat
224− [ "--haddock-options=--read-interface="
225− , "../"
226− , pkgVer
227− , "/,"
228− , hf
229− ]
230− getHandle AppendMode $ run "cabal"
231− ( "haddock"
232− : "--hyperlink-source"
233− : "--html"
234− : "--hoogle"
235− -- FIXME is this redundant with read-interface above?
236− : "--html-location=../$pkg-$version/"
237− : hfsOpts) dir
238− let PackageName packageName' = packageName
239− handle (\(_ :: IOException) -> return ()) $ renameDirectory
240− (dir </> "dist" </> "doc" </> "html" </> packageName')
241− (docdir </> package)
242−
243− enewPath <- try $ canonicalizePath $ docdir </> package </> packageName' <.> "haddock"
244− case enewPath :: Either IOException FilePath of
245− Left _ -> return () -- print e
246− Right newPath -> atomicModifyIORef haddockFilesRef $ \hfs'
247− -> ((package, newPath) : hfs', ())
248−
249− when spiHasTests $ do
250− getHandle AppendMode $ run "cabal" ["build"] dir
251− getHandle AppendMode $ run "cabal" (concat
252− [ ["test"]
253− , if cabalVersion >= CabalVersion 1 20
254− then ["--show-details=streaming"] -- FIXME temporary workaround for https://github.com/haskell/cabal/issues/1810
255− else []
256− ]) dir
257− return True
258− let expectedFailure = packageName `Set.member` bpExpectedFailures bp
259− if passed
260− then do
261− removeFile logfile
262− when expectedFailure $ putStrLn $ " " ++ package ++ " passed, but I didn't think it would."
263− else unless expectedFailure $ putStrLn $ concat
264− [ "Test suite failed: "
265− , package
266− , "("
267− , unMaintainer spiMaintainer
268− , githubMentions spiGithubUser
269− , ")"
270− ]
271− rm_r dir
272− return $! passed || expectedFailure
273− where
274− logfile = testdir </> package <.> "log"
275− dir = testdir </> package
276− getHandle mode = withBinaryFile logfile mode
277− package = packageVersionString (packageName, spiVersion)
278−
279− buildBeforeHaddock = Set.fromList $ map PackageName $ words =<<
280− [ "gio gtk"
281− ]
282−
283−copyBuiltInHaddocks docdir = do
284− Just ghc <- findExecutable "ghc"
285− copyTree (takeDirectory ghc </> "../share/doc/ghc/html/libraries") docdir
286− where
287− copyTree src dest = do
288− entries <- fmap (filter (\s -> s /= "." && s /= ".."))
289− $ getDirectoryContents src
290− forM_ entries $ \entry -> do
291− let src' = src </> entry
292− dest' = dest </> entry
293− isFile <- doesFileExist src'
294− if isFile
295− then copyFile src' dest'
296− else do
297− createDirectory dest'
298− copyTree src' dest'
Stackage/Types.hsdeleted−165
@@ -1,165 +0,0 @@
1−module Stackage.Types
2− ( module X
3− , module Stackage.Types
4− ) where
5−
6−import Data.Map as X (Map)
7−import Data.Map (unionWith)
8−import Data.Monoid (Monoid (..))
9−import Data.Set as X (Set)
10−import Data.Version as X (Version)
11−import Distribution.Package as X (PackageIdentifier (..),
12− PackageName (..))
13−import Distribution.PackageDescription (GenericPackageDescription)
14−import Distribution.Version as X (VersionRange (..))
15−import Distribution.Version (intersectVersionRanges)
16−
17−newtype PackageDB = PackageDB (Map PackageName PackageInfo)
18− deriving (Show, Eq)
19−
20−instance Monoid PackageDB where
21− mempty = PackageDB mempty
22− PackageDB x `mappend` PackageDB y =
23− PackageDB $ unionWith newest x y
24− where
25− newest pi1 pi2
26− | piVersion pi1 > piVersion pi2 = pi1
27− | otherwise = pi2
28−
29−data PackageInfo = PackageInfo
30− { piVersion :: Version
31− , piDeps :: Map PackageName VersionRange
32− , piHasTests :: Bool
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 :: [String]
38− }
39− deriving (Show, Eq)
40−
41−newtype Executable = Executable String
42− deriving (Show, Eq, Ord)
43−
44−-- | Information on a package we're going to build.
45−data BuildInfo = BuildInfo
46− { biVersion :: Version
47− , biUsers :: [PackageName]
48− , biMaintainer :: Maintainer
49− , biDeps :: Map PackageName VersionRange
50− , biGithubUser :: [String]
51− , biHasTests :: Bool
52− }
53−
54−data HaskellPlatform = HaskellPlatform
55− { hpcore :: Set PackageIdentifier
56− , hplibs :: Set PackageIdentifier
57− }
58− deriving (Show, Eq, Ord)
59−instance Monoid HaskellPlatform where
60− mempty = HaskellPlatform mempty mempty
61− HaskellPlatform a x `mappend` HaskellPlatform b y = HaskellPlatform (mappend a b) (mappend x y)
62−
63−data 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
71− }
72−
73−data SelectedPackageInfo = SelectedPackageInfo
74− { spiVersion :: Version
75− , spiMaintainer :: Maintainer
76− , spiGithubUser :: [String]
77− , spiHasTests :: Bool
78− }
79− deriving (Show, Read)
80−
81−data BuildPlan = BuildPlan
82− { bpTools :: [String]
83− , bpPackages :: Map PackageName SelectedPackageInfo
84− , bpCore :: Map PackageName (Maybe Version)
85− , bpOptionalCore :: Map PackageName Version
86− -- ^ See 'iiOptionalCore'
87− , bpSkippedTests :: Set PackageName
88− , bpExpectedFailures :: Set PackageName
89− -- ^ Expected test failures. Unlike SkippedTests, we should still try to
90− -- build them.
91− }
92−
93−-- | Email address of a Stackage maintainer.
94−newtype Maintainer = Maintainer { unMaintainer :: String }
95− deriving (Show, Eq, Ord, Read)
96−
97−data SelectSettings = SelectSettings
98− { haskellPlatformDir :: FilePath
99− , flags :: Map PackageName Version -> Set String
100− -- ^ Compile flags which should be turned on. Takes a Map providing the
101− -- core packages so that flags can be set appropriately.
102− , disabledFlags :: Set String
103− -- ^ Compile flags which should always be disabled.
104− , extraCore :: Set PackageName
105− , ignoreUpgradeableCore :: Bool
106− -- ^ Do not pin down the versions of upgradeable core packages.
107− , requireHaskellPlatform :: Bool
108− , allowedPackage :: GenericPackageDescription -> Either String ()
109− -- ^ Checks if a package is allowed into the distribution. By default, we
110− -- allow all packages in, though this could be used to filter out certain
111− -- untrusted packages, or packages with an unacceptable license.
112− --
113− -- Returns a reason for stripping in Left, or Right if the package is
114− -- allowed.
115− , expectedFailures :: Set PackageName
116− , excludedPackages :: Set PackageName
117− -- ^ Packages which should be dropped from the list of stable packages,
118− -- even if present via the Haskell Platform or @stablePackages@. If these
119− -- packages are dependencies of others, they will still be included.
120− , stablePackages :: Bool -- require Haskell Platform?
121− -> Map PackageName (VersionRange, Maintainer)
122− , useGlobalDatabase :: Bool
123− -- ^ Instead of checking the Haskell Platform file for core packages, query
124− -- the global database. For this to be reliable, you should only have
125− -- default packages in your global database. Default is @False@.
126− , skippedTests :: Set PackageName
127− -- ^ Do not build or run test suites, usually in order to avoid a
128− -- dependency.
129− , selectGhcVersion :: GhcMajorVersion
130− , selectTarballDir :: FilePath
131− -- ^ Directory containing replacement tarballs.
132− , selectUnderlayPackageDirs :: [FilePath]
133− -- ^ Additional package directories to reference
134− }
135−
136−data BuildStage = BSTools | BSBuild | BSTest
137−
138−data BuildSettings = BuildSettings
139− { sandboxRoot :: FilePath
140− , extraArgs :: BuildStage -> [String]
141− , testWorkerThreads :: Int
142− -- ^ How many threads to spawn for running test suites.
143− , buildDocs :: Bool
144− -- ^ Build docs as part of the test procedure.
145− , tarballDir :: FilePath
146− -- ^ Directory containing replacement tarballs.
147− , cabalFileDir :: Maybe FilePath
148− -- ^ Directory to place cabal files in
149− , underlayPackageDirs :: [FilePath]
150− -- ^ Additional package directories to reference
151− }
152−
153−-- | A wrapper around a @Map@ providing a better @Monoid@ instance.
154−newtype PackageMap = PackageMap { unPackageMap :: Map PackageName (VersionRange, Maintainer) }
155−
156−instance Monoid PackageMap where
157− mempty = PackageMap mempty
158− PackageMap x `mappend` PackageMap y =
159− PackageMap $ unionWith go x y
160− where
161− go (r1, m1) (r2, _) = (intersectVersionRanges r1 r2, m1)
162−
163−-- | GHC major version. For example, for GHC 7.4.2, this would be 7 4.
164−data GhcMajorVersion = GhcMajorVersion Int Int
165− deriving (Show, Ord, Eq)
Stackage/Util.hsdeleted−174
@@ -1,174 +0,0 @@
1−{-# LANGUAGE CPP #-}
2−module Stackage.Util where
3−
4−import qualified Codec.Archive.Tar as Tar
5−import qualified Codec.Archive.Tar.Entry as TarEntry
6−import Control.Monad (guard, when)
7−import Data.Char (isSpace, toUpper)
8−import Data.List (intercalate, stripPrefix)
9−import qualified Data.Map as Map
10−import Data.Maybe (mapMaybe)
11−import qualified Data.Set as Set
12−import Data.Version (showVersion)
13−import Distribution.License (License (..))
14−import qualified Distribution.Package as P
15−import qualified Distribution.PackageDescription as PD
16−import Distribution.Text (display, simpleParse)
17−import Distribution.Version (thisVersion)
18−import Stackage.Types
19−import System.Directory (doesDirectoryExist,
20− removeDirectoryRecursive,
21− getAppUserDataDirectory,
22− canonicalizePath,
23− createDirectoryIfMissing, doesFileExist)
24−import System.Environment (getEnvironment)
25−import System.FilePath ((</>), (<.>))
26−
27−-- | Allow only packages with permissive licenses.
28−allowPermissive :: [String] -- ^ list of explicitly allowed packages
29− -> PD.GenericPackageDescription
30− -> Either String ()
31−allowPermissive allowed gpd
32− | P.pkgName (PD.package $ PD.packageDescription gpd) `elem` map PackageName allowed = Right ()
33− | otherwise =
34− case PD.license $ PD.packageDescription gpd of
35− BSD3 -> Right ()
36− MIT -> Right ()
37− PublicDomain -> Right ()
38− l -> Left $ "Non-permissive license: " ++ display l
39−
40−identsToRanges :: Set PackageIdentifier -> Map PackageName (VersionRange, Maintainer)
41−identsToRanges =
42− Map.unions . map go . Set.toList
43− where
44− go (PackageIdentifier package version) = Map.singleton package (thisVersion version, Maintainer "Haskell Platform")
45−
46−packageVersionString :: (PackageName, Version) -> String
47−packageVersionString (PackageName p, v) = concat [p, "-", showVersion v]
48−
49−rm_r :: FilePath -> IO ()
50−rm_r fp = do
51− exists <- doesDirectoryExist fp
52− when exists $ removeDirectoryRecursive fp
53−
54−getCabalRoot :: IO FilePath
55−getCabalRoot = getAppUserDataDirectory "cabal"
56−
57−-- | Name of the 00-index.tar downloaded from Hackage.
58−getTarballName :: IO FilePath
59−getTarballName = do
60− c <- getCabalRoot
61− configLines <- fmap lines $ readFile (c </> "config")
62− case mapMaybe getRemoteCache configLines of
63− [x] -> return $ x </> "hackage.haskell.org" </> "00-index.tar"
64− [] -> error $ "No remote-repo-cache found in Cabal config file"
65− _ -> error $ "Multiple remote-repo-cache entries found in Cabal config file"
66− where
67− getRemoteCache s = do
68− ("remote-repo-cache", ':':v) <- Just $ break (== ':') s
69− Just $ reverse $ dropWhile isSpace $ reverse $ dropWhile isSpace v
70−
71−stableRepoName, extraRepoName :: String
72−stableRepoName = "stackage"
73−extraRepoName = "stackage-extra"
74−
75−-- | Locations for the stackage and stackage-extra tarballs
76−getStackageTarballNames :: IO (FilePath, FilePath)
77−getStackageTarballNames = do
78− c <- getCabalRoot
79− let f x = c </> "packages" </> x </> "00-index.tar"
80− return (f stableRepoName, f extraRepoName)
81−
82−getPackageVersion :: Tar.Entry -> Maybe (PackageName, Version)
83−getPackageVersion e = do
84− let (package', s1) = break (== '/') fp
85− package = PackageName package'
86− s2 <- stripPrefix "/" s1
87− let (version', s3) = break (== '/') s2
88− version <- simpleParse version'
89− s4 <- stripPrefix "/" s3
90− guard $ s4 == package' ++ ".cabal"
91− Just (package, version)
92− where
93− fp = TarEntry.fromTarPathToPosixPath $ TarEntry.entryTarPath e
94−
95−-- | If a package cannot be parsed or is not found, the default value for
96−-- whether it has a test suite. We default to @True@ since, worst case
97−-- scenario, this just means a little extra time trying to run a suite that's
98−-- not there. Defaulting to @False@ would result in silent failures.
99−defaultHasTestSuites :: Bool
100−defaultHasTestSuites = True
101−
102−packageDir, libDir, binDir, dataDir, docDir :: BuildSettings -> FilePath
103−packageDir = (</> "package-db") . sandboxRoot
104−libDir = (</> "lib") . sandboxRoot
105−binDir = (</> "bin") . sandboxRoot
106−dataDir = (</> "share") . sandboxRoot
107−docDir x = sandboxRoot x </> "share" </> "doc" </> "$pkgid"
108−
109−addCabalArgsOnlyGlobal :: BuildSettings -> [String] -> [String]
110−addCabalArgsOnlyGlobal settings rest
111− = "--package-db=clear"
112− : "--package-db=global"
113− : map ("--package-db=" ++) (underlayPackageDirs settings)
114− ++ rest
115−
116−addCabalArgs :: BuildSettings -> BuildStage -> [String] -> [String]
117−addCabalArgs settings bs rest
118− = addCabalArgsOnlyGlobal settings
119− $ ("--package-db=" ++ packageDir settings ++ toolsSuffix)
120− : ("--libdir=" ++ libDir settings ++ toolsSuffix)
121− : ("--bindir=" ++ binDir settings)
122− : ("--datadir=" ++ dataDir settings)
123− : ("--docdir=" ++ docDir settings ++ toolsSuffix)
124− : extraArgs settings bs ++ rest
125− where
126− toolsSuffix =
127− case bs of
128− BSTools -> "-tools"
129− _ -> ""
130−
131−-- | Modified environment that adds our sandboxed bin folder to PATH.
132−getModifiedEnv :: BuildSettings -> IO [(String, String)]
133−getModifiedEnv settings = do
134− fmap (map $ fixEnv $ binDir settings) getEnvironment
135− where
136− fixEnv :: FilePath -> (String, String) -> (String, String)
137− fixEnv bin (p, x)
138− -- Thank you Windows having case-insensitive environment variables...
139− | map toUpper p == "PATH" = (p, bin ++ pathSep : x)
140− | otherwise = (p, x)
141−
142− -- | Separate for the PATH environment variable
143− pathSep :: Char
144−#ifdef mingw32_HOST_OS
145− pathSep = ';'
146−#else
147− pathSep = ':'
148−#endif
149−
150−-- | Minor fixes, such as making paths absolute.
151−--
152−-- Note: creates the sandbox root in the process.
153−fixBuildSettings :: BuildSettings -> IO BuildSettings
154−fixBuildSettings settings' = do
155− let root' = sandboxRoot settings'
156− createDirectoryIfMissing True root'
157− root <- canonicalizePath root'
158− return settings' { sandboxRoot = root }
159−
160−-- | Check if a tarball exists in the tarball directory and, if so, use that
161−-- instead of the given name.
162−replaceTarball :: FilePath -- ^ tarball directory
163− -> String
164− -> IO String
165−replaceTarball tarballdir pkgname = do
166− exists <- doesFileExist fp
167− if exists
168− then canonicalizePath fp
169− else return pkgname
170− where
171− fp = tarballdir </> pkgname <.> "tar.gz"
172−
173−githubMentions :: [String] -> String
174−githubMentions = intercalate "," . map ('@' :)
Stackage2/BuildConstraints.hs+96−77
@@ -12,14 +12,17 @@ module Stackage2.BuildConstraints
1212 , defaultBuildConstraints
1313 ) where
1414
15+import Control.Monad.Writer.Strict (execWriter, tell)
1516import Data.Aeson
16−import qualified Data.Map as Map
17−import Distribution.System (Arch, OS)
17+import qualified Data.Map as Map
18+import Data.Yaml (decodeEither', decodeFileEither)
19+import Distribution.Package (Dependency (..))
20+import Distribution.System (Arch, OS)
1821import qualified Distribution.System
19−import Distribution.Version (anyVersion)
20−import qualified Stackage.Config as Old
21−import qualified Stackage.Select as Old
22−import qualified Stackage.Types as Old
22+import Distribution.Version (anyVersion)
23+import Distribution.Version (anyVersion)
24+import Filesystem (isFile)
25+import Network.HTTP.Client (Manager, httpLbs, responseBody)
2326import Stackage2.CorePackages
2427import Stackage2.Prelude
2528
@@ -80,6 +83,9 @@ data BuildConstraints = BuildConstraints
8083 , bcPackageConstraints :: PackageName -> PackageConstraints
8184
8285 , bcSystemInfo :: SystemInfo
86+
87+ , bcGithubUsers :: Map Text (Set Text)
88+ -- ^ map an account to set of pingees
8389 }
8490
8591data PackageConstraints = PackageConstraints
@@ -113,50 +119,19 @@ instance FromJSON PackageConstraints where
113119 return PackageConstraints {..}
114120
115121-- | The proposed plan from the requirements provided by contributors.
116−defaultBuildConstraints :: IO BuildConstraints
117−defaultBuildConstraints = do
118− bcSystemInfo <- getSystemInfo
119− oldGhcVer <-
120− case siGhcVersion bcSystemInfo of
121− Version (x:y:_) _ -> return $ Old.GhcMajorVersion x y
122− _ -> error $ "Didn't not understand GHC version: " ++ show (siGhcVersion bcSystemInfo)
123−
124−
125− let oldSettings = Old.defaultSelectSettings oldGhcVer False
126− oldStable = Old.defaultStablePackages oldGhcVer False
127− defaultGlobalFlags = asMap $ mapFromList $
128− map (, True) (map FlagName $ setToList $ Old.flags oldSettings mempty) ++
129− map (, False) (map FlagName $ setToList $ Old.disabledFlags oldSettings)
130− expectedFailures = Old.defaultExpectedFailures oldGhcVer False ++
131− newExpectedFailures
132− skippedTests =
133− old ++ extraSkippedTests
134− where
135− old = setFromList $ map unPackageName $ setToList $ Old.skippedTests oldSettings
136−
137− bcPackages = Map.keysSet oldStable
138− bcPackageConstraints name =
139− PackageConstraints {..}
140− where
141− mold = lookup name $ oldStable
142−
143− pcVersionRange = simplifyVersionRange $ maybe anyVersion fst mold
144− pcMaintainer = (Maintainer . pack . Old.unMaintainer . snd) <$> mold
145− pcTests
146− | unPackageName name `member` skippedTests = Don'tBuild
147− | name `member` expectedFailures = ExpectFailure
148− | otherwise = ExpectSuccess
149−
150− pcBuildBenchmarks = unPackageName name `notMember` skippedBenchs
151−
152− -- FIXME ultimately separate haddock and test failures in specification
153− pcHaddocks
154− | name `member` expectedFailures = ExpectFailure
155− | otherwise = ExpectSuccess
156−
157− pcFlagOverrides = packageFlags name ++ defaultGlobalFlags
158−
159− return BuildConstraints {..}
122+--
123+-- Checks the current directory for a build-constraints.yaml file and uses it
124+-- if present. If not, downloads from Github.
125+defaultBuildConstraints :: Manager -> IO BuildConstraints
126+defaultBuildConstraints man = do
127+ e <- isFile fp
128+ if e
129+ then decodeFileEither (fpToString fp) >>= either throwIO toBC
130+ else httpLbs req man >>=
131+ either throwIO toBC . decodeEither' . toStrict . responseBody
132+ where
133+ fp = "build-constraints.yaml"
134+ req = "https://raw.githubusercontent.com/fpco/stackage/master/build-constraints.yaml"
160135
161136getSystemInfo :: IO SystemInfo
162137getSystemInfo = do
@@ -169,30 +144,74 @@ getSystemInfo = do
169144 siOS = Distribution.System.Linux
170145 siArch = Distribution.System.X86_64
171146
172−packageFlags :: PackageName -> Map FlagName Bool
173−packageFlags (PackageName "mersenne-random-pure64") = singletonMap (FlagName "small_base") False
174−packageFlags _ = mempty
175−
176−extraSkippedTests :: HashSet Text
177−extraSkippedTests = setFromList $ words =<<
178− [ "HTTP Octree options"
179− , "hasql"
180− , "bloodhound fb" -- require old hspec
181− , "diagrams-haddock" -- requires old tasty
182− , "hasql-postgres" -- requires old hasql
183− , "compdata" -- https://github.com/pa-ba/compdata/issues/4
184− ]
185−
186−skippedBenchs :: HashSet Text
187−skippedBenchs = setFromList $ words =<<
188− [ "machines criterion-plus graphviz lifted-base pandoc stm-containers uuid"
189− , "cases hasql-postgres" -- pulls in criterion-plus, which has restrictive upper bounds
190− -- https://github.com/vincenthz/hs-crypto-cipher/issues/46
191− , "cipher-aes cipher-blowfish cipher-camellia cipher-des cipher-rc4"
192− , "hasql" -- sometimes falls out-of-sync on hasql-postgres
193− ]
194−
195−newExpectedFailures :: Set PackageName
196−newExpectedFailures = setFromList $ map PackageName $ words =<<
197− [ "cautious-file" -- weird problems with cabal test
198− ]
147+loadBuildConstraints fp = decodeFileEither fp >>= either throwIO toBC
148+
149+data ConstraintFile = ConstraintFile
150+ { cfGlobalFlags :: Map FlagName Bool
151+ , cfPackageFlags :: Map PackageName (Map FlagName Bool)
152+ , cfSkippedTests :: Set PackageName
153+ , cfExpectedTestFailures :: Set PackageName
154+ , cfExpectedHaddockFailures :: Set PackageName
155+ , cfSkippedBenchmarks :: Set PackageName
156+ , cfPackages :: Map Maintainer (Vector Dependency)
157+ , cfGithubUsers :: Map Text (Set Text)
158+ }
159+
160+instance FromJSON ConstraintFile where
161+ parseJSON = withObject "ConstraintFile" $ \o -> do
162+ cfGlobalFlags <- goFlagMap <$> o .: "global-flags"
163+ cfPackageFlags <- (goPackageMap . fmap goFlagMap) <$> o .: "package-flags"
164+ cfSkippedTests <- getPackages o "skipped-tests"
165+ cfExpectedTestFailures <- getPackages o "expected-test-failures"
166+ cfExpectedHaddockFailures <- getPackages o "expected-haddock-failures"
167+ cfSkippedBenchmarks <- getPackages o "skipped-benchmarks"
168+ cfPackages <- o .: "packages"
169+ >>= mapM (mapM toDep)
170+ . Map.mapKeysWith const Maintainer
171+ cfGithubUsers <- o .: "github-users"
172+ return ConstraintFile {..}
173+ where
174+ goFlagMap = Map.mapKeysWith const FlagName
175+ goPackageMap = Map.mapKeysWith const PackageName
176+ getPackages o name = (setFromList . map PackageName) <$> o .: name
177+
178+ toDep :: Monad m => Text -> m Dependency
179+ toDep = either (fail . show) return . simpleParse
180+
181+toBC :: ConstraintFile -> IO BuildConstraints
182+toBC ConstraintFile {..} = do
183+ bcSystemInfo <- getSystemInfo
184+ return BuildConstraints {..}
185+ where
186+ combine (maintainer, range1) (_, range2) =
187+ (maintainer, intersectVersionRanges range1 range2)
188+ revmap = unionsWith combine $ ($ []) $ execWriter
189+ $ forM_ (mapToList cfPackages)
190+ $ \(maintainer, deps) -> forM_ deps
191+ $ \(Dependency name range) ->
192+ tell (singletonMap name (maintainer, range):)
193+
194+ bcPackages = Map.keysSet revmap
195+
196+ bcPackageConstraints name =
197+ PackageConstraints {..}
198+ where
199+ mpair = lookup name revmap
200+ pcMaintainer = fmap fst mpair
201+ pcVersionRange = maybe anyVersion snd mpair
202+ pcTests
203+ | name `member` cfSkippedTests = Don'tBuild
204+ | name `member` cfExpectedTestFailures = ExpectFailure
205+ | otherwise = ExpectSuccess
206+ pcBuildBenchmarks = name `notMember` cfSkippedBenchmarks
207+ pcHaddocks
208+ | name `member` cfExpectedHaddockFailures = ExpectFailure
209+
210+ -- Temporary to match old behavior
211+ | name `member` cfExpectedTestFailures = ExpectFailure
212+
213+ | otherwise = ExpectSuccess
214+ pcFlagOverrides = fromMaybe mempty (lookup name cfPackageFlags) ++
215+ cfGlobalFlags
216+
217+ bcGithubUsers = cfGithubUsers
Stackage2/BuildPlan.hs+4−1
@@ -32,6 +32,7 @@ data BuildPlan = BuildPlan
3232 { bpSystemInfo :: SystemInfo
3333 , bpTools :: Vector (PackageName, Version)
3434 , bpPackages :: Map PackageName PackagePlan
35+ , bpGithubUsers :: Map Text (Set Text)
3536 }
3637 deriving (Show, Eq)
3738
@@ -51,6 +52,7 @@ instance FromJSON BuildPlan where
5152 bpSystemInfo <- o .: "system-info"
5253 bpTools <- (o .: "tools") >>= mapM goTool
5354 bpPackages <- Map.mapKeysWith const mkPackageName <$> (o .: "packages")
55+ bpGithubUsers <- o .:? "github-users" .!= mempty
5456 return BuildPlan {..}
5557 where
5658 goTool = withObject "Tool" $ \o -> (,)
@@ -105,6 +107,7 @@ newBuildPlan bc@BuildConstraints {..} = liftIO $ do
105107 { bpSystemInfo = bcSystemInfo
106108 , bpTools = tools
107109 , bpPackages = packages
110+ , bpGithubUsers = bcGithubUsers
108111 }
109112 where
110113 SystemInfo {..} = bcSystemInfo
@@ -182,7 +185,7 @@ mkPackagePlan bc gpd = do
182185 return PackagePlan {..}
183186 where
184187 PackageIdentifier name ppVersion = package $ packageDescription gpd
185− ppGithubPings = getGithubPings gpd
188+ ppGithubPings = getGithubPings bc gpd
186189 ppConstraints = bcPackageConstraints bc name
187190 ppUsers = mempty -- must be filled in later
188191
Stackage2/CompleteBuild.hs+6−6
@@ -39,11 +39,11 @@ data Settings = Settings
3939 , postBuild :: IO ()
4040 }
4141
42−getSettings :: BuildType -> IO Settings
43−getSettings Nightly = do
42+getSettings :: Manager -> BuildType -> IO Settings
43+getSettings man Nightly = do
4444 day <- tshow . utctDay <$> getCurrentTime
4545 let slug' = "nightly-" ++ day
46− plan' <- defaultBuildConstraints >>= newBuildPlan
46+ plan' <- defaultBuildConstraints man >>= newBuildPlan
4747 return Settings
4848 { planFile = fpFromText ("nightly-" ++ day) <.> "yaml"
4949 , buildDir = fpFromText $ "builds/stackage-nightly-" ++ day
@@ -59,7 +59,7 @@ getSettings Nightly = do
5959 , plan = plan'
6060 , postBuild = return ()
6161 }
62−getSettings (LTS bumpType) = do
62+getSettings man (LTS bumpType) = do
6363 Option mlts <- fmap (fmap getMax) $ runResourceT
6464 $ sourceDirectory "."
6565 $$ foldMapC (Option . fmap Max . parseLTSVer . filename)
@@ -70,7 +70,7 @@ getSettings (LTS bumpType) = do
7070 case mlts of
7171 Nothing -> LTSVer 0 0
7272 Just (LTSVer x _) -> LTSVer (x + 1) 0
73− plan' <- defaultBuildConstraints >>= newBuildPlan
73+ plan' <- defaultBuildConstraints man >>= newBuildPlan
7474 return (new, plan')
7575 Minor -> do
7676 old <- maybe (error "No LTS plans found in current directory") return mlts
@@ -133,7 +133,7 @@ completeBuild buildType = withManager defaultManagerSettings $ \man -> do
133133 hSetBuffering stdout LineBuffering
134134
135135 putStrLn $ "Loading settings for: " ++ tshow buildType
136− Settings {..} <- getSettings buildType
136+ Settings {..} <- getSettings man buildType
137137
138138 putStrLn $ "Writing build plan to: " ++ fpToText planFile
139139 encodeFile (fpToString planFile) plan
Stackage2/ConstraintFile.hsdeleted−81
@@ -1,81 +0,0 @@
1−{-# LANGUAGE OverloadedStrings, NoImplicitPrelude, RecordWildCards #-}
2−module Stackage2.ConstraintFile
3− ( loadBuildConstraints
4− ) where
5−
6−import Stackage2.Prelude
7−import Data.Yaml (decodeFileEither)
8−import Stackage2.BuildConstraints
9−import Data.Aeson
10−import qualified Data.Map as Map
11−import Distribution.Package (Dependency (..))
12−import Distribution.Version (anyVersion)
13−import Control.Monad.Writer.Strict (execWriter, tell)
14−
15−loadBuildConstraints fp = decodeFileEither fp >>= either throwIO toBC
16−
17−data ConstraintFile = ConstraintFile
18− { cfGlobalFlags :: Map FlagName Bool
19− , cfPackageFlags :: Map PackageName (Map FlagName Bool)
20− , cfSkippedTests :: Set PackageName
21− , cfExpectedTestFailures :: Set PackageName
22− , cfExpectedHaddockFailures :: Set PackageName
23− , cfSkippedBenchmarks :: Set PackageName
24− , cfPackages :: Map Maintainer (Vector Dependency)
25− }
26−
27−instance FromJSON ConstraintFile where
28− parseJSON = withObject "ConstraintFile" $ \o -> do
29− cfGlobalFlags <- goFlagMap <$> o .: "global-flags"
30− cfPackageFlags <- (goPackageMap . fmap goFlagMap) <$> o .: "package-flags"
31− cfSkippedTests <- getPackages o "skipped-tests"
32− cfExpectedTestFailures <- getPackages o "expected-test-failures"
33− cfExpectedHaddockFailures <- getPackages o "expected-haddock-failures"
34− cfSkippedBenchmarks <- getPackages o "skipped-benchmarks"
35− cfPackages <- o .: "packages"
36− >>= mapM (mapM toDep)
37− . Map.mapKeysWith const Maintainer
38− return ConstraintFile {..}
39− where
40− goFlagMap = Map.mapKeysWith const FlagName
41− goPackageMap = Map.mapKeysWith const PackageName
42− getPackages o name = (setFromList . map PackageName) <$> o .: name
43−
44− toDep :: Monad m => Text -> m Dependency
45− toDep = either (fail . show) return . simpleParse
46−
47−toBC :: ConstraintFile -> IO BuildConstraints
48−toBC ConstraintFile {..} = do
49− bcSystemInfo <- getSystemInfo
50− return BuildConstraints {..}
51− where
52− combine (maintainer, range1) (_, range2) =
53− (maintainer, intersectVersionRanges range1 range2)
54− revmap = unionsWith combine $ ($ []) $ execWriter
55− $ forM_ (mapToList cfPackages)
56− $ \(maintainer, deps) -> forM_ deps
57− $ \(Dependency name range) ->
58− tell (singletonMap name (maintainer, range):)
59−
60− bcPackages = Map.keysSet revmap
61−
62− bcPackageConstraints name =
63− PackageConstraints {..}
64− where
65− mpair = lookup name revmap
66− pcMaintainer = fmap fst mpair
67− pcVersionRange = maybe anyVersion snd mpair
68− pcTests
69− | name `member` cfSkippedTests = Don'tBuild
70− | name `member` cfExpectedTestFailures = ExpectFailure
71− | otherwise = ExpectSuccess
72− pcBuildBenchmarks = name `notMember` cfSkippedBenchmarks
73− pcHaddocks
74− | name `member` cfExpectedHaddockFailures = ExpectFailure
75−
76− -- Temporary to match old behavior
77− | name `member` cfExpectedTestFailures = ExpectFailure
78−
79− | otherwise = ExpectSuccess
80− pcFlagOverrides = fromMaybe mempty (lookup name cfPackageFlags) ++
81− cfGlobalFlags
Stackage2/GithubPings.hs+8−6
@@ -1,18 +1,20 @@
11{-# LANGUAGE NoImplicitPrelude #-}
22{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE ViewPatterns #-}
34module Stackage2.GithubPings
45 ( getGithubPings
56 ) where
67
7−import Distribution.PackageDescription
8−import qualified Stackage.Config as Old
9−import Stackage2.Prelude
8+import Distribution.PackageDescription
9+import Stackage2.BuildConstraints
10+import Stackage2.Prelude
1011
1112-- | Determine accounts to be pinged on Github based on various metadata in the
1213-- package description.
13−getGithubPings :: GenericPackageDescription -> Set Text
14−getGithubPings gpd =
15− setFromList $ map pack $ foldMap Old.convertGithubUser $
14+getGithubPings :: BuildConstraints -- ^ for mapping to pingees
15+ -> GenericPackageDescription -> Set Text
16+getGithubPings bc gpd =
17+ foldMap (\(pack -> name) -> fromMaybe (singletonSet name) (lookup name (bcGithubUsers bc))) $
1618 goHomepage (homepage $ packageDescription gpd) ++
1719 concatMap goRepo (sourceRepos $ packageDescription gpd)
1820 where
Stackage2/UpdateBuildPlan.hs+1
@@ -24,6 +24,7 @@ updateBuildConstraints BuildPlan {..} =
2424 where
2525 bcSystemInfo = bpSystemInfo
2626 bcPackages = Map.keysSet bpPackages
27+ bcGithubUsers = bpGithubUsers
2728
2829 bcPackageConstraints name = PackageConstraints
2930 { pcVersionRange = addBumpRange (maybe anyVersion pcVersionRange moldPC)
app/stackage.hsdeleted−148
@@ -1,148 +0,0 @@
1−{-# LANGUAGE RecordWildCards #-}
2−import Data.Set (fromList)
3−import Stackage.Build (build, defaultBuildSettings)
4−import Stackage.BuildPlan (readBuildPlan, writeBuildPlan, writeBuildPlanCsv)
5−import Stackage.CheckPlan (checkPlan)
6−import Stackage.GhcPkg (getGhcVersion)
7−import Stackage.Init (stackageInit)
8−import Stackage.Select (defaultSelectSettings, select)
9−import Stackage.Tarballs (makeTarballs)
10−import Stackage.Test (runTestSuites)
11−import Stackage.Types
12−import Stackage.Util (allowPermissive)
13−import System.Environment (getArgs, getProgName)
14−import System.IO (hFlush, stdout)
15−
16−data SelectArgs = SelectArgs
17− { excluded :: [String]
18− , noPlatform :: Bool
19− , ignoreUpgradeable :: Bool
20− , onlyPermissive :: Bool
21− , allowed :: [String]
22− , buildPlanDest :: FilePath
23− , buildPlanCsvDest :: FilePath
24− , globalDB :: Bool
25− }
26−
27−parseSelectArgs :: [String] -> IO SelectArgs
28−parseSelectArgs =
29− loop SelectArgs
30− { excluded = []
31− , noPlatform = True
32− , ignoreUpgradeable = False
33− , onlyPermissive = False
34− , allowed = []
35− , buildPlanDest = defaultBuildPlan
36− , buildPlanCsvDest = defaultBuildPlanCsv
37− , globalDB = False
38− }
39− where
40− loop x [] = return x
41− loop x ("--exclude":y:rest) = loop x { excluded = y : excluded x } rest
42− loop x ("--no-platform":rest) = loop x { noPlatform = True } rest
43− loop x ("--platform":rest) = loop x { noPlatform = False } rest
44− loop x ("--ignore-upgradeable":rest) = loop x { ignoreUpgradeable = True } rest
45− loop x ("--only-permissive":rest) = loop x { onlyPermissive = True } rest
46− loop x ("--allow":y:rest) = loop x { allowed = y : allowed x } rest
47− loop x ("--build-plan":y:rest) = loop x { buildPlanDest = y } rest
48− loop x ("--build-plan-csv":y:rest) = loop x { buildPlanCsvDest = y } rest
49− loop x ("--use-global-db":rest) = loop x { globalDB = True } rest
50− loop _ (y:_) = error $ "Did not understand argument: " ++ y
51−
52−data BuildArgs = BuildArgs
53− { sandbox :: String
54− , buildPlanSrc :: FilePath
55− , extraArgs' :: [String] -> [String]
56− , noDocs :: Bool
57− , buildCores :: Maybe Int
58− , testThreads :: Maybe Int
59− }
60−
61−parseBuildArgs :: GhcMajorVersion -> [String] -> IO BuildArgs
62−parseBuildArgs version =
63− loop BuildArgs
64− { sandbox = sandboxRoot $ defaultBuildSettings Nothing version
65− , buildPlanSrc = defaultBuildPlan
66− , extraArgs' = id
67− , noDocs = False
68− , buildCores = Nothing
69− , testThreads = Nothing
70− }
71− where
72− loop x [] = return x
73− loop x ("--sandbox":y:rest) = loop x { sandbox = y } rest
74− loop x ("--build-plan":y:rest) = loop x { buildPlanSrc = y } rest
75− loop x ("--arg":y:rest) = loop x { extraArgs' = extraArgs' x . (y:) } rest
76− loop x ("--no-docs":rest) = loop x { noDocs = True } rest
77− loop x ("-j":y:rest) = loop x { buildCores = Just $ read y } rest
78− loop x ("--test-threads":y:rest) = loop x { testThreads = Just $ read y } rest
79− loop _ (y:_) = error $ "Did not understand argument: " ++ y
80−
81−defaultBuildPlan :: FilePath
82−defaultBuildPlan = "build-plan.txt"
83−
84−defaultBuildPlanCsv :: FilePath
85−defaultBuildPlanCsv = "build-plan.csv"
86−
87−withBuildSettings :: [String] -> (BuildSettings -> BuildPlan -> IO a) -> IO a
88−withBuildSettings args f = do
89− version <- getGhcVersion
90− BuildArgs {..} <- parseBuildArgs version args
91− bp <- readBuildPlan buildPlanSrc
92− let bs = defaultBuildSettings buildCores version
93− modTestThreads settings' =
94− case testThreads of
95− Nothing -> settings'
96− Just t -> settings' { testWorkerThreads = t }
97− settings = modTestThreads bs
98− { sandboxRoot = sandbox
99− , extraArgs = extraArgs' . extraArgs bs
100− , buildDocs = not noDocs
101− }
102− f settings bp
103−
104−main :: IO ()
105−main = do
106− args <- getArgs
107− case args of
108− "select":rest -> do
109− SelectArgs {..} <- parseSelectArgs rest
110− ghcVersion <- getGhcVersion
111− bp <- select
112− (defaultSelectSettings ghcVersion $ not noPlatform)
113− { excludedPackages = fromList $ map PackageName excluded
114− , requireHaskellPlatform = not noPlatform
115− , ignoreUpgradeableCore = ignoreUpgradeable
116− , allowedPackage =
117− if onlyPermissive
118− then allowPermissive allowed
119− else const $ Right ()
120− , useGlobalDatabase = globalDB
121− }
122− writeBuildPlan buildPlanDest bp
123− writeBuildPlanCsv buildPlanCsvDest bp
124− ("check":rest) -> withBuildSettings rest checkPlan
125− ("build":rest) -> withBuildSettings rest build
126− ("test":rest) -> withBuildSettings rest runTestSuites
127− ("tarballs":rest) -> withBuildSettings rest $ const makeTarballs
128− ["init"] -> do
129− putStrLn "Note: init isn't really ready for prime time use."
130− putStrLn "Using it may make it impossible to build stackage."
131− putStr "Are you sure you want continue (y/n)? "
132− hFlush stdout
133− x <- getLine
134− case x of
135− c:_ | c `elem` "yY" -> stackageInit
136− _ -> putStrLn "Probably a good decision, exiting."
137− ["update"] -> stackageInit >> error "FIXME update"
138− _ -> do
139− pn <- getProgName
140− putStrLn $ "Usage: " ++ pn ++ " <command>"
141− putStrLn "Available commands:"
142− --putStrLn " update Download updated Stackage databases. Automatically calls init."
143− --putStrLn " init Initialize your cabal file to use Stackage"
144− putStrLn " uploads"
145− putStrLn " select [--no-clean] [--no-platform] [--exclude package...] [--only-permissive] [--allow package] [--build-plan file]"
146− putStrLn " check [--build-plan file] [--sandbox rootdir] [--arg cabal-arg]"
147− putStrLn " build [--build-plan file] [--sandbox rootdir] [--arg cabal-arg]"
148− putStrLn " test [--build-plan file] [--sandbox rootdir] [--arg cabal-arg] [--no-docs]"
stackage.cabal+1−27
@@ -13,25 +13,7 @@ cabal-version: >=1.10
1313
1414library
1515 default-language: Haskell2010
16− exposed-modules: Stackage.NarrowDatabase
17− Stackage.LoadDatabase
18− Stackage.ModuleNameConflict
19− Stackage.Util
20− Stackage.Types
21− Stackage.Config
22− Stackage.InstallInfo
23− Stackage.CheckPlan
24− Stackage.Tarballs
25− Stackage.Test
26− Stackage.Build
27− Stackage.Init
28− Stackage.BuildPlan
29− Stackage.CheckCabalVersion
30− Stackage.Select
31− Stackage.GhcPkg
32− Stackage.ServerFiles
33−
34− Stackage2.Prelude
16+ exposed-modules: Stackage2.Prelude
3517 Stackage2.BuildConstraints
3618 Stackage2.CorePackages
3719 Stackage2.PackageIndex
@@ -77,14 +59,6 @@ library
7759 , semigroups
7860 , xml-conduit
7961
80−executable stackage
81− default-language: Haskell2010
82− hs-source-dirs: app
83− main-is: stackage.hs
84− build-depends: base
85− , stackage
86− , containers
87−
8862executable stackage-nightly
8963 default-language: Haskell2010
9064 hs-source-dirs: app