stackage 0.1.0.0 → 0.2.0.0
raw patch · 15 files changed
+192/−224 lines, 15 filesdep ~time
Dependency ranges changed: time
Files
- ChangeLog.md +5/−0
- Stackage/BuildConstraints.hs +0/−3
- Stackage/BuildPlan.hs +3/−3
- Stackage/CheckBuildPlan.hs +9/−6
- Stackage/CompleteBuild.hs +6/−5
- Stackage/CorePackages.hs +3/−3
- Stackage/PackageDescription.hs +1/−1
- Stackage/PackageIndex.hs +1/−1
- Stackage/PerformBuild.hs +73/−54
- Stackage/Prelude.hs +0/−1
- Stackage/ServerBundle.hs +10/−10
- Stackage/UpdateBuildPlan.hs +3/−3
- Stackage/Upload.hs +8/−6
- build-constraints.yaml +68/−126
- stackage.cabal +2/−2
ChangeLog.md view
@@ -1,3 +1,8 @@+## 0.2.0.0++* Minor fixes+* `pbGlobalInstall`+ ## 0.1.0.0 First version of Stackage which is made available as its own package. The
Stackage/BuildConstraints.hs view
@@ -20,7 +20,6 @@ import Distribution.System (Arch, OS) import qualified Distribution.System import Distribution.Version (anyVersion)-import Distribution.Version (anyVersion) import Filesystem (isFile) import Network.HTTP.Client (Manager, httpLbs, responseBody) import Stackage.CorePackages@@ -143,8 +142,6 @@ -- FIXME consider not hard-coding the next two values siOS = Distribution.System.Linux siArch = Distribution.System.X86_64--loadBuildConstraints fp = decodeFileEither fp >>= either throwIO toBC data ConstraintFile = ConstraintFile { cfGlobalFlags :: Map FlagName Bool
Stackage/BuildPlan.hs view
@@ -29,9 +29,9 @@ import Stackage.Prelude data BuildPlan = BuildPlan- { bpSystemInfo :: SystemInfo- , bpTools :: Vector (PackageName, Version)- , bpPackages :: Map PackageName PackagePlan+ { bpSystemInfo :: SystemInfo+ , bpTools :: Vector (PackageName, Version)+ , bpPackages :: Map PackageName PackagePlan , bpGithubUsers :: Map Text (Set Text) } deriving (Show, Eq)
Stackage/CheckBuildPlan.hs view
@@ -9,11 +9,12 @@ ( checkBuildPlan ) where -import Control.Monad.Writer.Strict (Writer, execWriter, tell)-import Stackage.BuildConstraints-import Stackage.BuildPlan-import Stackage.PackageDescription-import Stackage.Prelude+import Control.Monad.Writer.Strict (Writer, execWriter, tell)+import qualified Data.Text as T+import Stackage.BuildConstraints+import Stackage.BuildPlan+import Stackage.PackageDescription+import Stackage.Prelude -- FIXME check cycles in dependencies, only looking at libraries and -- executables@@ -97,7 +98,9 @@ [ "- " , pkgUserShow1 pu , " ("- , display range+ -- add a space after < to avoid confusing Markdown processors (like+ -- Github's issue tracker)+ , T.replace "<" "< " $ display range , "). " , pkgUserShow2 pu ]
Stackage/CompleteBuild.hs view
@@ -6,11 +6,11 @@ , BumpType (..) , completeBuild ) where-import Data.Default.Class (def)-import Data.Semigroup (Max (..), Option (..))-import Data.Text.Read (decimal)+import Data.Default.Class (def)+import Data.Semigroup (Max (..), Option (..))+import Data.Text.Read (decimal) import Data.Time-import Data.Yaml (decodeFileEither, encodeFile)+import Data.Yaml (decodeFileEither, encodeFile) import Network.HTTP.Client import Stackage.BuildConstraints import Stackage.BuildPlan@@ -20,7 +20,7 @@ import Stackage.ServerBundle import Stackage.UpdateBuildPlan import Stackage.Upload-import System.IO (BufferMode (LineBuffering), hSetBuffering)+import System.IO (BufferMode (LineBuffering), hSetBuffering) data BuildType = Nightly | LTS BumpType deriving (Show, Read, Eq, Ord)@@ -148,6 +148,7 @@ , pbLogDir = logDir , pbLog = hPut stdout , pbJobs = 8+ , pbGlobalInstall = False } performBuild pb >>= mapM_ putStrLn
Stackage/CorePackages.hs view
@@ -6,10 +6,10 @@ , getGhcVersion ) where -import qualified Data.Text as T-import Filesystem (listDirectory)+import qualified Data.Text as T+import Filesystem (listDirectory) import Stackage.Prelude-import System.Directory (findExecutable)+import System.Directory (findExecutable) -- | Get a @Map@ of all of the core packages. Core packages are defined as -- packages which ship with GHC itself.
Stackage/PackageDescription.hs view
@@ -51,7 +51,7 @@ data DepInfo = DepInfo { diComponents :: Set Component- , diRange :: VersionRange+ , diRange :: VersionRange } deriving (Show, Eq)
Stackage/PackageIndex.hs view
@@ -90,7 +90,7 @@ return gpd parseNameVersion t1 = do- let (p', t2) = break (== '/') t1+ let (p', t2) = break (== '/') $ T.replace "\\" "/" t1 p <- simpleParse p' t3 <- maybe (throwM $ InvalidCabalPath t1 "no slash") return $ stripPrefix "/" t2
Stackage/PerformBuild.hs view
@@ -1,10 +1,10 @@ -- | Perform an actual build, generate a binary package database and a -- documentation directory in the process.-{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-} module Stackage.PerformBuild ( performBuild , PerformBuild (..)@@ -12,21 +12,25 @@ , pbDocDir ) where -import Stackage.BuildConstraints-import Stackage.PackageDescription-import Stackage.BuildPlan-import Stackage.Prelude hiding (pi)-import qualified Data.Map as Map-import Control.Concurrent.STM.TSem-import Data.NonNull (fromNullable)-import Control.Concurrent.Async (async)-import System.IO.Temp (withSystemTempDirectory)-import Filesystem (createTree, removeTree, isDirectory, rename, canonicalizePath, getWorkingDirectory)-import System.IO (withBinaryFile, IOMode (WriteMode))-import Filesystem.Path (parent)-import qualified Filesystem.Path as F-import System.Environment (getEnvironment)-import System.Directory (findExecutable)+import Control.Concurrent.Async (async)+import Control.Concurrent.STM.TSem+import Control.Monad.Writer.Strict (execWriter, tell)+import qualified Data.Map as Map+import Data.NonNull (fromNullable)+import Filesystem (canonicalizePath, createTree,+ getWorkingDirectory, isDirectory,+ removeTree, rename)+import Filesystem.Path (parent)+import qualified Filesystem.Path as F+import Stackage.BuildConstraints+import Stackage.BuildPlan+import Stackage.PackageDescription+import Stackage.Prelude hiding (pi)+import System.Directory (findExecutable)+import System.Environment (getEnvironment)+import System.IO (IOMode (WriteMode),+ withBinaryFile)+import System.IO.Temp (withSystemTempDirectory) data BuildException = BuildException (Map PackageName BuildFailure) [Text] deriving Typeable@@ -50,16 +54,18 @@ instance Exception BuildFailure data PerformBuild = PerformBuild- { pbPlan :: BuildPlan- , pbInstallDest :: FilePath- , pbLog :: ByteString -> IO ()- , pbLogDir :: FilePath- , pbJobs :: Int+ { pbPlan :: BuildPlan+ , pbInstallDest :: FilePath+ , pbLog :: ByteString -> IO ()+ , pbLogDir :: FilePath+ , pbJobs :: Int+ , pbGlobalInstall :: Bool+ -- ^ Register packages in the global database } data PackageInfo = PackageInfo- { piPlan :: PackagePlan- , piName :: PackageName+ { piPlan :: PackagePlan+ , piName :: PackageName , piResult :: TMVar Bool } @@ -100,13 +106,21 @@ isCore = (`member` siCorePackages (bpSystemInfo bp)) isCoreExe = (`member` siCoreExecutables (bpSystemInfo bp)) +withCounter :: TVar Int -> IO a -> IO a withCounter counter = bracket_ (atomically $ modifyTVar counter (+ 1)) (atomically $ modifyTVar counter (subtract 1)) +withTSem :: TSem -> IO a -> IO a withTSem sem = bracket_ (atomically $ waitTSem sem) (atomically $ signalTSem sem) -pbDatabase pb = pbInstallDest pb </> "pkgdb"+-- | Returns @Nothing@ if installing to a global database+pbDatabase :: PerformBuild -> Maybe FilePath+pbDatabase pb+ | pbGlobalInstall pb = Nothing+ | otherwise = Just $ pbInstallDest pb </> "pkgdb"++pbBinDir, pbLibDir, pbDataDir, pbDocDir :: PerformBuild -> FilePath pbBinDir pb = pbInstallDest pb </> "bin" pbLibDir pb = pbInstallDest pb </> "lib" pbDataDir pb = pbInstallDest pb </> "share"@@ -125,9 +139,10 @@ let removeTree' fp = whenM (isDirectory fp) (removeTree fp) mapM_ removeTree' [pbInstallDest, pbLogDir] - createTree $ parent $ pbDatabase pb- withCheckedProcess (proc "ghc-pkg" ["init", fpToString (pbDatabase pb)])- $ \ClosedStream Inherited Inherited -> return ()+ forM_ (pbDatabase pb) $ \db -> do+ createTree $ parent db+ withCheckedProcess (proc "ghc-pkg" ["init", fpToString db])+ $ \ClosedStream Inherited Inherited -> return () pbLog $ encodeUtf8 "Copying built-in Haddocks\n" copyBuiltInHaddocks (pbDocDir pb) @@ -157,8 +172,11 @@ , sbBuildDir = builddir , sbPackageInfo = pi , sbRegisterMutex = mutex- , sbModifiedEnv = ("HASKELL_PACKAGE_SANDBOX", fpToString $ pbDatabase pb)- : map fixEnv env+ , sbModifiedEnv = maybe+ id+ (\db -> (("HASKELL_PACKAGE_SANDBOX", fpToString db):))+ (pbDatabase pb)+ (map fixEnv env) , sbHaddockFiles = haddockFiles } @@ -185,17 +203,17 @@ #endif data SingleBuild = SingleBuild- { sbSem :: TSem- , sbErrsVar :: TVar (Map PackageName BuildFailure)- , sbWarningsVar :: TVar ([Text] -> [Text])- , sbActive :: TVar Int- , sbToolMap :: Map ExeName (Set PackageName)- , sbPackageMap :: Map PackageName PackageInfo- , sbBuildDir :: FilePath- , sbPackageInfo :: PackageInfo+ { sbSem :: TSem+ , sbErrsVar :: TVar (Map PackageName BuildFailure)+ , sbWarningsVar :: TVar ([Text] -> [Text])+ , sbActive :: TVar Int+ , sbToolMap :: Map ExeName (Set PackageName)+ , sbPackageMap :: Map PackageName PackageInfo+ , sbBuildDir :: FilePath+ , sbPackageInfo :: PackageInfo , sbRegisterMutex :: MVar ()- , sbModifiedEnv :: [(String, String)]- , sbHaddockFiles :: TVar (Map Text FilePath) -- ^ package-version, .haddock file+ , sbModifiedEnv :: [(String, String)]+ , sbHaddockFiles :: TVar (Map Text FilePath) -- ^ package-version, .haddock file } singleBuild :: PerformBuild -> SingleBuild -> IO ()@@ -251,27 +269,28 @@ testOut = pbLogDir </> fpFromText namever </> "test.out" testRunOut = pbLogDir </> fpFromText namever </> "test-run.out" - wf fp inner = do+ wf fp inner' = do createTree $ parent fp- withBinaryFile (fpToString fp) WriteMode inner+ withBinaryFile (fpToString fp) WriteMode inner' - configArgs =- [ "--package-db=clear"- , "--package-db=global"- , "--package-db=" ++ fpToText (pbDatabase pb)- , "--libdir=" ++ fpToText (pbLibDir pb)- , "--bindir=" ++ fpToText (pbBinDir pb)- , "--datadir=" ++ fpToText (pbDataDir pb)- , "--docdir=" ++ fpToText (pbDocDir pb)- , "--flags=" ++ flags- ]+ configArgs = ($ []) $ execWriter $ do+ tell' "--package-db=clear"+ tell' "--package-db=global"+ forM_ (pbDatabase pb) $ \db -> tell' $ "--package-db=" ++ fpToText db+ tell' $ "--libdir=" ++ fpToText (pbLibDir pb)+ tell' $ "--bindir=" ++ fpToText (pbBinDir pb)+ tell' $ "--datadir=" ++ fpToText (pbDataDir pb)+ tell' $ "--docdir=" ++ fpToText (pbDocDir pb)+ tell' $ "--flags=" ++ flags+ where+ tell' x = tell (x:) flags :: Text flags = unwords $ map go $ mapToList pcFlagOverrides where- go (name, isOn) = concat+ go (name', isOn) = concat [ if isOn then "" else "-"- , unFlagName name+ , unFlagName name' ] PackageConstraints {..} = ppConstraints $ piPlan sbPackageInfo
Stackage/Prelude.hs view
@@ -20,7 +20,6 @@ VersionRange) import Distribution.Version as X (withinRange) import qualified Distribution.Version as C-import System.Exit (ExitCode (ExitSuccess)) unPackageName :: PackageName -> Text unPackageName (PackageName str) = pack str
Stackage/ServerBundle.hs view
@@ -9,22 +9,22 @@ , docsListing ) where -import qualified Codec.Archive.Tar as Tar-import qualified Codec.Archive.Tar.Entry as Tar-import qualified Codec.Compression.GZip as GZip-import qualified Data.Yaml as Y-import Foreign.C.Types (CTime (CTime))+import qualified Codec.Archive.Tar as Tar+import qualified Codec.Archive.Tar.Entry as Tar+import qualified Codec.Compression.GZip as GZip+import qualified Data.Yaml as Y+import Filesystem (isFile)+import Foreign.C.Types (CTime (CTime)) import Stackage.BuildConstraints import Stackage.BuildPlan import Stackage.Prelude-import qualified System.PosixCompat.Time as PC-import qualified Text.XML as X-import Text.XML.Cursor-import Filesystem (isFile)+import qualified System.PosixCompat.Time as PC+import qualified Text.XML as X+import Text.XML.Cursor -- | Get current time epochTime :: IO Tar.EpochTime-epochTime = (\(CTime t) -> t) <$> PC.epochTime+epochTime = (\(CTime t) -> fromIntegral t) <$> PC.epochTime -- | All package/versions in a build plan, including core packages. --
Stackage/UpdateBuildPlan.hs view
@@ -8,9 +8,9 @@ , updateBuildPlan ) where -import qualified Data.Map as Map-import Distribution.Version (anyVersion, earlierVersion,- orLaterVersion)+import qualified Data.Map as Map+import Distribution.Version (anyVersion, earlierVersion,+ orLaterVersion) import Stackage.BuildConstraints import Stackage.BuildPlan import Stackage.Prelude
Stackage/Upload.hs view
@@ -20,9 +20,9 @@ import Filesystem (isDirectory, isFile) import Network.HTTP.Client import Network.HTTP.Client.MultipartFormData-import Stackage.BuildPlan (BuildPlan)+import Stackage.BuildPlan (BuildPlan) import Stackage.Prelude-import Stackage.ServerBundle (bpAllPackages, docsListing)+import Stackage.ServerBundle (bpAllPackages, docsListing) import System.IO.Temp (withSystemTempFile) newtype StackageServer = StackageServer { unStackageServer :: Text }@@ -90,6 +90,7 @@ , udSnapshot :: SnapshotIdent } +uploadDocs :: UploadDocs -> Manager -> IO (Response LByteString) uploadDocs (UploadDocs (StackageServer host) fp0 token ident) man = do fe <- isFile fp0 if fe@@ -172,13 +173,14 @@ } data UploadDocMap = UploadDocMap- { udmServer :: StackageServer+ { udmServer :: StackageServer , udmAuthToken :: Text- , udmSnapshot :: SnapshotIdent- , udmDocDir :: FilePath- , udmPlan :: BuildPlan+ , udmSnapshot :: SnapshotIdent+ , udmDocDir :: FilePath+ , udmPlan :: BuildPlan } +uploadDocMap :: UploadDocMap -> Manager -> IO (Response LByteString) uploadDocMap UploadDocMap {..} man = do docmap <- docsListing udmPlan udmDocDir req1 <- parseUrl $ unpack $ unStackageServer udmServer ++ "/upload-doc-map"
build-constraints.yaml view
@@ -1,31 +1,5 @@ # Constraints for brand new builds packages:- "Stackage upper bounds":- # cabal-install is buggy still.- - network < 2.6- - network-uri < 2.6-- # https://github.com/fpco/stackage/issues/288- - text < 1.2-- # Force a specific version that's compatible with transformers 0.3- - transformers-compat == 0.3.3.3-- # https://github.com/fpco/stackage/issues/291- - random < 1.0.1.3-- # https://github.com/fpco/stackage/issues/314- - hxt < 9.3.1.9-- # https://github.com/fpco/stackage/issues/318- - HaXml < 1.25-- # https://github.com/fpco/stackage/issues/319- - polyparse < 1.10-- # https://github.com/nikita-volkov/stm-containers/issues/3- - free < 4.10- "Michael Snoyman michael@snoyman.com @snoyberg": - bzlib-conduit - cabal-install < 1.19@@ -109,6 +83,7 @@ - random-source - shelly - smtLib+ - stackage - statistics-linreg - th-expand-syns - thyme@@ -626,6 +601,40 @@ - opaleye - product-profunctors + "Samplecount stefan@samplecount.com @kaoskorobase":+ - shake-language-c+ + "Marcin Mrotek <marcin.jan.mrotek@gmail.com>":+ - type-list++ "Stackage upper bounds":+ # https://github.com/fpco/stackage/issues/288+ - text < 1.2++ # Force a specific version that's compatible with transformers 0.3+ - transformers-compat == 0.3.3.3++ # https://github.com/fpco/stackage/issues/291+ - random < 1.0.1.3++ # https://github.com/fpco/stackage/issues/314+ - hxt < 9.3.1.9++ # https://github.com/fpco/stackage/issues/318+ - HaXml < 1.25++ # https://github.com/fpco/stackage/issues/319+ - polyparse < 1.10++ # https://github.com/nikita-volkov/stm-containers/issues/3+ - free < 4.10++ # https://github.com/fpco/stackage/issues/369+ - list-t < 0.4++ # https://github.com/fpco/stackage/issues/370+ - monad-control < 1+ # Global flags are applied to all packages global-flags: blaze_html_0_5: true@@ -636,7 +645,7 @@ new-base: true bytestring-in-base: false test-hlint: false- network-uri: false # network-uri: true+ network-uri: true # Package flags are applied to individual packages, and override the values of # global-flags@@ -644,6 +653,12 @@ mersenne-random-pure64: small_base: false + # Use system libraries to speed up compilation and get bug fixes+ persistent-sqlite:+ systemlib: true+ yaml:+ system-libyaml: true+ # By skipping a test suite, we do not pull in the build dependencies skipped-tests: - ReadArgs # old version of hspec@@ -667,8 +682,20 @@ # https://github.com/pa-ba/compdata/issues/4 - compdata - # https://github.com/fpco/stackage/issues/368- - lifted-base+ # Too lazy to keep the test dependencies up to date+ - base-prelude+ - cases+ - focus+ - hasql+ - hasql-backend+ - hasql-postgres+ - list-t+ - mtl-prelude+ - neat-interpolation+ - partial-handler+ - postgresql-binary+ - slave-thread+ - stm-containers # Tests which we should build and run, but which are expected to fail. We # should not fail a build based on a test failure for one of these packages.@@ -681,59 +708,30 @@ - text - setenv - # The version of GLUT included with the HP does not generate- # documentation correctly.- - GLUT- # https://github.com/bos/statistics/issues/42 - statistics # https://github.com/kazu-yamamoto/simple-sendfile/pull/10 - simple-sendfile - # http://hackage.haskell.org/trac/hackage/ticket/954- - diagrams-- # https://github.com/fpco/stackage/issues/24- - unix-time-- # With transformers 0.3, it doesn't provide any modules- - transformers-compat- # Tests require shell script and are incompatible with sandboxed package # databases - HTF - # https://github.com/simonmar/monad-par/issues/28- - monad-par- # Unfortunately network failures seem to happen haphazardly - network - # https://github.com/ekmett/hyphenation/issues/1- - hyphenation- # Test suite takes too long to run on some systems - punycode - # http://hub.darcs.net/stepcut/happstack/issue/1- - happstack-server- # Requires a Facebook app. - fb - # https://github.com/tibbe/hashable/issues/64- - hashable- # https://github.com/vincenthz/language-java/issues/10 - language-java - threads - crypto-conduit- - pandoc- - language-ecmascript- - hspec- - alex # https://github.com/basvandijk/concurrent-extra/issues/ - concurrent-extra@@ -741,42 +739,24 @@ # https://github.com/skogsbaer/xmlgen/issues/2 - xmlgen - # Something very strange going on with the test suite, I can't figure- # out how to fix it- - bson- # Requires a locally running PostgreSQL server with appropriate users - postgresql-simple - # Missing files- - websockets- # Some kind of Cabal bug when trying to run tests - thyme - shake - # https://github.com/jgm/pandoc-citeproc/issues/5- - pandoc-citeproc- # Problems with doctest and sandboxing - warp - wai-logger # https://github.com/fpco/stackage/issues/163 - hTalos- - seqloc # https://github.com/bos/math-functions/issues/25 - math-functions - # FIXME the test suite fails fairly regularly in builds, though I haven't- # discovered why yet- - crypto-numbers-- # Test suite is currently failing regularly, needs to be worked out still.- - lens- # Requires too old a version of test-framework - time @@ -785,22 +765,9 @@ - lockfree-queue - network-transport-tcp - # Pulls in monad-peel which does not compile- - monad-control- # https://github.com/fpco/stackage/issues/226 - options - # https://github.com/gtk2hs/gtk2hs/issues/36- - glib- - pango-- # https://github.com/acw/bytestring-progress/issues/3- - bytestring-progress-- # Seems to require 32-bit functions- - nettle- # Depends on a missing graphviz executable - graphviz @@ -810,26 +777,12 @@ # Not sure why... - singletons - - hspec2- - hspec-wai-- # https://github.com/fpco/stackage/issues/285- - diagrams-haddock- - scientific- - json-schema- # https://github.com/BioHaskell/octree/issues/4 - Octree - # No code until we upgrade to network 2.6- - network-uri- # https://github.com/goldfirere/th-desugar/issues/12 - th-desugar - # https://github.com/haskell/c2hs/issues/108- - c2hs- # https://github.com/jmillikin/haskell-filesystem/issues/3 - system-filepath @@ -844,31 +797,9 @@ # Requires locally running server - bloodhound - # Too lazy to keep the test dependencies up to date- - base-prelude- - cases- - focus- - hasql- - hasql-backend- - hasql-postgres- - list-t- - mtl-prelude- - neat-interpolation- - partial-handler- - postgresql-binary- - slave-thread- - stm-containers-- # https://github.com/gtk2hs/gtk2hs/issues/79- - gio- - gtk- # Requires SAT solver and old QuickCheck - ersatz - # https://github.com/ekmett/gl/issues/3- - gl- # Failing doctests - bits @@ -884,8 +815,19 @@ # weird problems with cabal test - cautious-file + # https://github.com/haskell/cabal/pull/2277+ - cabal-install++ # https://github.com/haskell/network-uri/issues/10+ - network-uri+ # Haddocks which are expected to fail. Same concept as expected test failures.-expected-haddock-failures: []+expected-haddock-failures:+ # https://github.com/acw/bytestring-progress/issues/4+ - bytestring-progress++ # https://github.com/ekmett/gl/issues/4+ - gl # Benchmarks which should not be built. Note that Stackage does *not* generally # build benchmarks. The difference here will be whether dependencies for these
stackage.cabal view
@@ -1,5 +1,5 @@ name: stackage-version: 0.1.0.0+version: 0.2.0.0 synopsis: "Stable Hackage," tools for creating a vetted set of packages from Hackage. description: Please see <http://www.stackage.org/package/stackage> for a description and documentation. homepage: https://github.com/fpco/stackage@@ -40,7 +40,7 @@ , transformers , process , old-locale- , time < 1.5+ , time , utf8-string , conduit-extra