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
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
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
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
packages, you would add:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,17 +5,17 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Stackage2.PerformBuild
module Stackage.PerformBuild
( performBuild
, PerformBuild (..)
, BuildException (..)
, pbDocDir
) where
import Stackage2.BuildConstraints
import Stackage2.PackageDescription
import Stackage2.BuildPlan
import Stackage2.Prelude hiding (pi)
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)

View File

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

View File

@ -2,7 +2,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Stackage2.ServerBundle
module Stackage.ServerBundle
( serverBundle
, epochTime
, bpAllPackages
@ -14,9 +14,9 @@ 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 Stackage2.BuildConstraints
import Stackage2.BuildPlan
import Stackage2.Prelude
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

View File

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

View File

@ -4,7 +4,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
module Stackage2.Upload
module Stackage.Upload
( UploadBundle (..)
, SnapshotIdent (..)
, uploadBundle
@ -20,9 +20,9 @@ import Data.Default.Class (Default (..))
import Filesystem (isDirectory, isFile)
import Network.HTTP.Client
import Network.HTTP.Client.MultipartFormData
import Stackage2.BuildPlan (BuildPlan)
import Stackage2.Prelude
import Stackage2.ServerBundle (bpAllPackages, docsListing)
import Stackage.BuildPlan (BuildPlan)
import Stackage.Prelude
import Stackage.ServerBundle (bpAllPackages, docsListing)
import System.IO.Temp (withSystemTempFile)
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
version: 0.1.0.0
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
license: MIT
license-file: LICENSE
@ -10,22 +10,25 @@ maintainer: michael@fpcomplete.com
category: Distribution
build-type: Simple
cabal-version: >=1.10
extra-source-files: README.md
ChangeLog.md
build-constraints.yaml
library
default-language: Haskell2010
exposed-modules: Stackage2.Prelude
Stackage2.BuildConstraints
Stackage2.CorePackages
Stackage2.PackageIndex
Stackage2.BuildPlan
Stackage2.CheckBuildPlan
Stackage2.UpdateBuildPlan
Stackage2.GithubPings
Stackage2.PackageDescription
Stackage2.ServerBundle
Stackage2.Upload
Stackage2.PerformBuild
Stackage2.CompleteBuild
exposed-modules: Stackage.Prelude
Stackage.BuildConstraints
Stackage.CorePackages
Stackage.PackageIndex
Stackage.BuildPlan
Stackage.CheckBuildPlan
Stackage.UpdateBuildPlan
Stackage.GithubPings
Stackage.PackageDescription
Stackage.ServerBundle
Stackage.Upload
Stackage.PerformBuild
Stackage.CompleteBuild
build-depends: base >= 4 && < 5
, containers
, Cabal >= 1.14
@ -59,26 +62,10 @@ library
, semigroups
, xml-conduit
executable stackage-nightly
executable stackage
default-language: Haskell2010
hs-source-dirs: app
main-is: stackage-nightly.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
main-is: stackage.hs
build-depends: base
, stackage
ghc-options: -rtsopts -threaded -with-rtsopts=-N
@ -88,9 +75,9 @@ test-suite spec
default-language: Haskell2010
hs-source-dirs: test
main-is: Spec.hs
other-modules: Stackage2.CorePackagesSpec
Stackage2.PackageIndexSpec
Stackage2.BuildPlanSpec
other-modules: Stackage.CorePackagesSpec
Stackage.PackageIndexSpec
Stackage.BuildPlanSpec
build-depends: base
, stackage
, hspec

View File

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

View File

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

View File

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