Cleanup in prep of release to Hackage

This commit is contained in:
Michael Snoyman 2014-12-15 08:10:16 +02:00
parent 9f6ede2c9c
commit 0e1a160477
23 changed files with 107 additions and 112 deletions

5
ChangeLog.md Normal file
View File

@ -0,0 +1,5 @@
## 0.1.0.0
First version of Stackage which is made available as its own package. The
codebase has been completely rewritten at this point, to be ready for generated
both Stackage Nightly and LTS Haskell distributions.

View File

@ -5,7 +5,7 @@ stackage
__NOTE__ This repository is for package authors to get their code into __NOTE__ This repository is for package authors to get their code into
Stackage. If you simply want to use Stackage as an end user, please follow the Stackage. If you simply want to use Stackage as an end user, please follow the
instructions on http://www.stackage.org/. instructions on [http://www.stackage.org/](http://www.stackage.org).
A note about the codebase: the goal is to minimize dependencies and have A note about the codebase: the goal is to minimize dependencies and have
the maximum range of supported compiler versions. Therefore, we avoid the maximum range of supported compiler versions. Therefore, we avoid
@ -16,7 +16,7 @@ Get your package included
------------------------- -------------------------
In order to get your package included in the set of stable packages, you should In order to get your package included in the set of stable packages, you should
send a pull request against this repository. In the `Stackage.Config` module, send a pull request against this repository. In the `build-constraints.yaml` file,
there's a function called `defaultStablePackages`. In general, to add a set of there's a function called `defaultStablePackages`. In general, to add a set of
packages, you would add: packages, you would add:

View File

@ -3,7 +3,7 @@
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-} {-# LANGUAGE TupleSections #-}
-- | The constraints on package selection for a new build plan. -- | The constraints on package selection for a new build plan.
module Stackage2.BuildConstraints module Stackage.BuildConstraints
( BuildConstraints (..) ( BuildConstraints (..)
, PackageConstraints (..) , PackageConstraints (..)
, TestState (..) , TestState (..)
@ -23,8 +23,8 @@ import Distribution.Version (anyVersion)
import Distribution.Version (anyVersion) import Distribution.Version (anyVersion)
import Filesystem (isFile) import Filesystem (isFile)
import Network.HTTP.Client (Manager, httpLbs, responseBody) import Network.HTTP.Client (Manager, httpLbs, responseBody)
import Stackage2.CorePackages import Stackage.CorePackages
import Stackage2.Prelude import Stackage.Prelude
data TestState = ExpectSuccess data TestState = ExpectSuccess
| ExpectFailure | ExpectFailure

View File

@ -9,7 +9,7 @@
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
-- | Representation of a concrete build plan, and how to generate a new one -- | Representation of a concrete build plan, and how to generate a new one
-- based on constraints. -- based on constraints.
module Stackage2.BuildPlan module Stackage.BuildPlan
( BuildPlan (..) ( BuildPlan (..)
, PackagePlan (..) , PackagePlan (..)
, newBuildPlan , newBuildPlan
@ -22,11 +22,11 @@ import qualified Data.Map as Map
import qualified Data.Set as Set import qualified Data.Set as Set
import qualified Distribution.Compiler import qualified Distribution.Compiler
import Distribution.PackageDescription import Distribution.PackageDescription
import Stackage2.BuildConstraints import Stackage.BuildConstraints
import Stackage2.GithubPings import Stackage.GithubPings
import Stackage2.PackageDescription import Stackage.PackageDescription
import Stackage2.PackageIndex import Stackage.PackageIndex
import Stackage2.Prelude import Stackage.Prelude
data BuildPlan = BuildPlan data BuildPlan = BuildPlan
{ bpSystemInfo :: SystemInfo { bpSystemInfo :: SystemInfo

View File

@ -5,15 +5,15 @@
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE ViewPatterns #-}
-- | Confirm that a build plan has a consistent set of dependencies. -- | Confirm that a build plan has a consistent set of dependencies.
module Stackage2.CheckBuildPlan module Stackage.CheckBuildPlan
( checkBuildPlan ( checkBuildPlan
) where ) where
import Control.Monad.Writer.Strict (Writer, execWriter, tell) import Control.Monad.Writer.Strict (Writer, execWriter, tell)
import Stackage2.BuildConstraints import Stackage.BuildConstraints
import Stackage2.BuildPlan import Stackage.BuildPlan
import Stackage2.PackageDescription import Stackage.PackageDescription
import Stackage2.Prelude import Stackage.Prelude
-- FIXME check cycles in dependencies, only looking at libraries and -- FIXME check cycles in dependencies, only looking at libraries and
-- executables -- executables

View File

@ -1,7 +1,7 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
module Stackage2.CompleteBuild module Stackage.CompleteBuild
( BuildType (..) ( BuildType (..)
, BumpType (..) , BumpType (..)
, completeBuild , completeBuild
@ -12,14 +12,14 @@ import Data.Text.Read (decimal)
import Data.Time import Data.Time
import Data.Yaml (decodeFileEither, encodeFile) import Data.Yaml (decodeFileEither, encodeFile)
import Network.HTTP.Client import Network.HTTP.Client
import Stackage2.BuildConstraints import Stackage.BuildConstraints
import Stackage2.BuildPlan import Stackage.BuildPlan
import Stackage2.CheckBuildPlan import Stackage.CheckBuildPlan
import Stackage2.PerformBuild import Stackage.PerformBuild
import Stackage2.Prelude import Stackage.Prelude
import Stackage2.ServerBundle import Stackage.ServerBundle
import Stackage2.UpdateBuildPlan import Stackage.UpdateBuildPlan
import Stackage2.Upload import Stackage.Upload
import System.IO (BufferMode (LineBuffering), hSetBuffering) import System.IO (BufferMode (LineBuffering), hSetBuffering)
data BuildType = Nightly | LTS BumpType data BuildType = Nightly | LTS BumpType

View File

@ -1,6 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Stackage2.CorePackages module Stackage.CorePackages
( getCorePackages ( getCorePackages
, getCoreExecutables , getCoreExecutables
, getGhcVersion , getGhcVersion
@ -8,7 +8,7 @@ module Stackage2.CorePackages
import qualified Data.Text as T import qualified Data.Text as T
import Filesystem (listDirectory) import Filesystem (listDirectory)
import Stackage2.Prelude 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 -- | Get a @Map@ of all of the core packages. Core packages are defined as

View File

@ -1,13 +1,13 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE ViewPatterns #-}
module Stackage2.GithubPings module Stackage.GithubPings
( getGithubPings ( getGithubPings
) where ) where
import Distribution.PackageDescription import Distribution.PackageDescription
import Stackage2.BuildConstraints import Stackage.BuildConstraints
import Stackage2.Prelude import Stackage.Prelude
-- | Determine accounts to be pinged on Github based on various metadata in the -- | Determine accounts to be pinged on Github based on various metadata in the
-- package description. -- package description.

View File

@ -9,7 +9,7 @@
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
-- | Manipulate @GenericPackageDescription@ from Cabal into something more -- | Manipulate @GenericPackageDescription@ from Cabal into something more
-- useful for us. -- useful for us.
module Stackage2.PackageDescription module Stackage.PackageDescription
( SimpleDesc (..) ( SimpleDesc (..)
, toSimpleDesc , toSimpleDesc
, CheckCond (..) , CheckCond (..)
@ -25,7 +25,7 @@ import Distribution.Compiler (CompilerFlavor)
import Distribution.Package (Dependency (..)) import Distribution.Package (Dependency (..))
import Distribution.PackageDescription import Distribution.PackageDescription
import Distribution.System (Arch, OS) import Distribution.System (Arch, OS)
import Stackage2.Prelude import Stackage.Prelude
data Component = CompLibrary data Component = CompLibrary
| CompExecutable | CompExecutable

View File

@ -5,7 +5,7 @@
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE ViewPatterns #-}
-- | Dealing with the 00-index file and all its cabal files. -- | Dealing with the 00-index file and all its cabal files.
module Stackage2.PackageIndex module Stackage.PackageIndex
( sourcePackageIndex ( sourcePackageIndex
, UnparsedCabalFile (..) , UnparsedCabalFile (..)
, getLatestDescriptions , getLatestDescriptions
@ -20,7 +20,7 @@ import Distribution.PackageDescription (package,
import Distribution.PackageDescription.Parse (ParseResult (..), import Distribution.PackageDescription.Parse (ParseResult (..),
parsePackageDescription) parsePackageDescription)
import Distribution.ParseUtils (PError) import Distribution.ParseUtils (PError)
import Stackage2.Prelude import Stackage.Prelude
import System.Directory (getAppUserDataDirectory) import System.Directory (getAppUserDataDirectory)
-- | Name of the 00-index.tar downloaded from Hackage. -- | Name of the 00-index.tar downloaded from Hackage.

View File

@ -5,17 +5,17 @@
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Stackage2.PerformBuild module Stackage.PerformBuild
( performBuild ( performBuild
, PerformBuild (..) , PerformBuild (..)
, BuildException (..) , BuildException (..)
, pbDocDir , pbDocDir
) where ) where
import Stackage2.BuildConstraints import Stackage.BuildConstraints
import Stackage2.PackageDescription import Stackage.PackageDescription
import Stackage2.BuildPlan import Stackage.BuildPlan
import Stackage2.Prelude hiding (pi) import Stackage.Prelude hiding (pi)
import qualified Data.Map as Map import qualified Data.Map as Map
import Control.Concurrent.STM.TSem import Control.Concurrent.STM.TSem
import Data.NonNull (fromNullable) import Data.NonNull (fromNullable)

View File

@ -3,9 +3,9 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
module Stackage2.Prelude module Stackage.Prelude
( module X ( module X
, module Stackage2.Prelude , module Stackage.Prelude
) where ) where
import ClassyPrelude.Conduit as X import ClassyPrelude.Conduit as X

View File

@ -2,7 +2,7 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
module Stackage2.ServerBundle module Stackage.ServerBundle
( serverBundle ( serverBundle
, epochTime , epochTime
, bpAllPackages , bpAllPackages
@ -14,9 +14,9 @@ import qualified Codec.Archive.Tar.Entry as Tar
import qualified Codec.Compression.GZip as GZip import qualified Codec.Compression.GZip as GZip
import qualified Data.Yaml as Y import qualified Data.Yaml as Y
import Foreign.C.Types (CTime (CTime)) import Foreign.C.Types (CTime (CTime))
import Stackage2.BuildConstraints import Stackage.BuildConstraints
import Stackage2.BuildPlan import Stackage.BuildPlan
import Stackage2.Prelude import Stackage.Prelude
import qualified System.PosixCompat.Time as PC import qualified System.PosixCompat.Time as PC
import qualified Text.XML as X import qualified Text.XML as X
import Text.XML.Cursor import Text.XML.Cursor

View File

@ -3,7 +3,7 @@
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
-- | Take an existing build plan and bump all packages to the newest version in -- | Take an existing build plan and bump all packages to the newest version in
-- the same major version number. -- the same major version number.
module Stackage2.UpdateBuildPlan module Stackage.UpdateBuildPlan
( updateBuildConstraints ( updateBuildConstraints
, updateBuildPlan , updateBuildPlan
) where ) where
@ -11,9 +11,9 @@ module Stackage2.UpdateBuildPlan
import qualified Data.Map as Map import qualified Data.Map as Map
import Distribution.Version (anyVersion, earlierVersion, import Distribution.Version (anyVersion, earlierVersion,
orLaterVersion) orLaterVersion)
import Stackage2.BuildConstraints import Stackage.BuildConstraints
import Stackage2.BuildPlan import Stackage.BuildPlan
import Stackage2.Prelude import Stackage.Prelude
updateBuildPlan :: BuildPlan -> IO BuildPlan updateBuildPlan :: BuildPlan -> IO BuildPlan
updateBuildPlan = newBuildPlan . updateBuildConstraints updateBuildPlan = newBuildPlan . updateBuildConstraints

View File

@ -4,7 +4,7 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-} {-# LANGUAGE TupleSections #-}
module Stackage2.Upload module Stackage.Upload
( UploadBundle (..) ( UploadBundle (..)
, SnapshotIdent (..) , SnapshotIdent (..)
, uploadBundle , uploadBundle
@ -20,9 +20,9 @@ import Data.Default.Class (Default (..))
import Filesystem (isDirectory, isFile) import Filesystem (isDirectory, isFile)
import Network.HTTP.Client import Network.HTTP.Client
import Network.HTTP.Client.MultipartFormData import Network.HTTP.Client.MultipartFormData
import Stackage2.BuildPlan (BuildPlan) import Stackage.BuildPlan (BuildPlan)
import Stackage2.Prelude import Stackage.Prelude
import Stackage2.ServerBundle (bpAllPackages, docsListing) import Stackage.ServerBundle (bpAllPackages, docsListing)
import System.IO.Temp (withSystemTempFile) import System.IO.Temp (withSystemTempFile)
newtype StackageServer = StackageServer { unStackageServer :: Text } newtype StackageServer = StackageServer { unStackageServer :: Text }

View File

@ -1,4 +0,0 @@
import Stackage2.CompleteBuild
main :: IO ()
main = completeBuild (LTS Major)

View File

@ -1,4 +0,0 @@
import Stackage2.CompleteBuild
main :: IO ()
main = completeBuild (LTS Minor)

View File

@ -1,4 +0,0 @@
import Stackage2.CompleteBuild
main :: IO ()
main = completeBuild Nightly

15
app/stackage.hs Normal file
View File

@ -0,0 +1,15 @@
import Stackage.CompleteBuild
import System.Environment (getArgs)
main :: IO ()
main = do
args <- getArgs
case args of
[x] | Just y <- lookup x m -> completeBuild y
_ -> error $ "Expected one argument, one of: " ++ unwords (map fst m)
where
m =
[ ("nightly", Nightly)
, ("lts-major", LTS Major)
, ("lts-minor", LTS Minor)
]

View File

@ -1,7 +1,7 @@
name: stackage name: stackage
version: 0.1.0.0 version: 0.1.0.0
synopsis: "Stable Hackage," tools for creating a vetted set of packages from Hackage. synopsis: "Stable Hackage," tools for creating a vetted set of packages from Hackage.
-- description: description: Please see <http://www.stackage.org/package/stackage> for a description and documentation.
homepage: https://github.com/fpco/stackage homepage: https://github.com/fpco/stackage
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
@ -10,22 +10,25 @@ maintainer: michael@fpcomplete.com
category: Distribution category: Distribution
build-type: Simple build-type: Simple
cabal-version: >=1.10 cabal-version: >=1.10
extra-source-files: README.md
ChangeLog.md
build-constraints.yaml
library library
default-language: Haskell2010 default-language: Haskell2010
exposed-modules: Stackage2.Prelude exposed-modules: Stackage.Prelude
Stackage2.BuildConstraints Stackage.BuildConstraints
Stackage2.CorePackages Stackage.CorePackages
Stackage2.PackageIndex Stackage.PackageIndex
Stackage2.BuildPlan Stackage.BuildPlan
Stackage2.CheckBuildPlan Stackage.CheckBuildPlan
Stackage2.UpdateBuildPlan Stackage.UpdateBuildPlan
Stackage2.GithubPings Stackage.GithubPings
Stackage2.PackageDescription Stackage.PackageDescription
Stackage2.ServerBundle Stackage.ServerBundle
Stackage2.Upload Stackage.Upload
Stackage2.PerformBuild Stackage.PerformBuild
Stackage2.CompleteBuild Stackage.CompleteBuild
build-depends: base >= 4 && < 5 build-depends: base >= 4 && < 5
, containers , containers
, Cabal >= 1.14 , Cabal >= 1.14
@ -59,26 +62,10 @@ library
, semigroups , semigroups
, xml-conduit , xml-conduit
executable stackage-nightly executable stackage
default-language: Haskell2010 default-language: Haskell2010
hs-source-dirs: app hs-source-dirs: app
main-is: stackage-nightly.hs main-is: stackage.hs
build-depends: base
, stackage
ghc-options: -rtsopts -threaded -with-rtsopts=-N
executable lts-minor-bump
default-language: Haskell2010
hs-source-dirs: app
main-is: lts-minor-bump.hs
build-depends: base
, stackage
ghc-options: -rtsopts -threaded -with-rtsopts=-N
executable lts-major-bump
default-language: Haskell2010
hs-source-dirs: app
main-is: lts-major-bump.hs
build-depends: base build-depends: base
, stackage , stackage
ghc-options: -rtsopts -threaded -with-rtsopts=-N ghc-options: -rtsopts -threaded -with-rtsopts=-N
@ -88,9 +75,9 @@ test-suite spec
default-language: Haskell2010 default-language: Haskell2010
hs-source-dirs: test hs-source-dirs: test
main-is: Spec.hs main-is: Spec.hs
other-modules: Stackage2.CorePackagesSpec other-modules: Stackage.CorePackagesSpec
Stackage2.PackageIndexSpec Stackage.PackageIndexSpec
Stackage2.BuildPlanSpec Stackage.BuildPlanSpec
build-depends: base build-depends: base
, stackage , stackage
, hspec , hspec

View File

@ -1,10 +1,10 @@
{-# LANGUAGE OverloadedStrings, NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings, NoImplicitPrelude #-}
module Stackage2.BuildPlanSpec (spec) where module Stackage.BuildPlanSpec (spec) where
import Stackage2.BuildPlan import Stackage.BuildPlan
import Stackage2.Prelude import Stackage.Prelude
import Stackage2.BuildConstraints import Stackage.BuildConstraints
import Stackage2.UpdateBuildPlan import Stackage.UpdateBuildPlan
import Test.Hspec import Test.Hspec
import qualified Data.Yaml as Y import qualified Data.Yaml as Y
import Distribution.Version (anyVersion) import Distribution.Version (anyVersion)
@ -12,7 +12,7 @@ import qualified Data.Map as Map
spec :: Spec spec :: Spec
spec = it "works" $ do spec = it "works" $ do
bc <- defaultBuildConstraints bc <- defaultBuildConstraints (error "manager should not be used")
bp <- newBuildPlan bc bp <- newBuildPlan bc
let bs = Y.encode bp let bs = Y.encode bp
ebp' = Y.decodeEither bs ebp' = Y.decodeEither bs

View File

@ -1,8 +1,8 @@
{-# LANGUAGE OverloadedStrings, NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings, NoImplicitPrelude #-}
module Stackage2.CorePackagesSpec (spec) where module Stackage.CorePackagesSpec (spec) where
import Stackage2.CorePackages import Stackage.CorePackages
import Stackage2.Prelude import Stackage.Prelude
import Test.Hspec import Test.Hspec
spec :: Spec spec :: Spec

View File

@ -1,8 +1,8 @@
{-# LANGUAGE OverloadedStrings, NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings, NoImplicitPrelude #-}
module Stackage2.PackageIndexSpec (spec) where module Stackage.PackageIndexSpec (spec) where
import Stackage2.PackageIndex import Stackage.PackageIndex
import Stackage2.Prelude import Stackage.Prelude
import Test.Hspec import Test.Hspec
import Distribution.Package (packageId) import Distribution.Package (packageId)