on 4377dec help sign in
stackage/README.md
112 lines 4.7 kB history raw
1stackage
2========
4"Stable Hackage," tools for creating a vetted set of packages from Hackage.
6__NOTE__ This repository is for package authors to get their code into
7Stackage. If you simply want to use Stackage as an end user, please follow the
8instructions on [http://www.stackage.org/](http://www.stackage.org).
10A note about the codebase: the goal is to minimize dependencies and have
11the maximum range of supported compiler versions. Therefore, we avoid
12anything "complicated." For example, instead of using the text package,
13we use Strings everywhere.
15Get your package included
16-------------------------
18In order to get your package included in the set of stable packages, you should
19send a pull request against this repository. In the [`build-constraints.yaml`](https://github.com/fpco/stackage/blob/master/build-constraints.yaml) file,
20there's a section called `packages`. In general, to add a set of
21packages, you would add:
23 "My Name myemail@example.com @mygithubuser":
24 - package1
25 - package2
26 - package3
28You can follow the examples of the other sets of packages in that function.
29Once you've done this, you can send a pull request to get your package
30included.
32__NOTE__: In order to ease the process of adding new packages, we no longer
33require new submissions to be tested on your own system before sending a pull
34request. If you believe your package works with the newest versions of all
35dependencies, you may send a pull request without testing first.
37You should also read the [maintainers
38agreement](https://github.com/fpco/stackage/wiki/Maintainers-Agreement).
40Build the package set
41---------------------
43Generally, building the package set should be done only by the Jenkins machine
44or by the official maintainers, as the process does require quite a bit of
45setup on the local machine. That said, you'll likely be able to get a stable
46build by running:
48 cabal update
49 cabal install stackage
50 stackage nightly
52## Processing
54The following describes at a high level the series of steps for processing
56### Nightlies
581. Get list of core packages
592. Get build constraints from list of maintained packages
603. Load up package index
614. Calculate build plan using newest versions of packages
625. Write out a YAML file with complete build plan
636. Verify that the build plan can be compiled
647. Perform the build
66### LTS
681. Load up most recent build plan
692. Convert build plan into constraints for next build
703. Continue from step (3) above
72## Code explanation
74We start off with *constraints*. Constraints state things like "package X has a
75given version range," who the maintainer is for a package, the description of
76the system/compiler being used, etc. `BuildConstraints` describes the build as
77a whole, whereas `PackageConstraints` describes the constraints on an
78individual package.
80There are two primary ways of getting a `BuildConstraints`.
81`defaultBuildConstraints` inspects the first GHC in the PATH environment variable to
82determine GHC version, core packages, core tools, etc. It then uses the
83`Stackage.Config` module to extract information on additional packages to be
84installed. The secondary approach is in `Stackage2.UpdateBuildPlan`, which will be
85discussed later.
87`BuildConstraints` does not specify a build completely. That is given by a
88`BuildPlan`, which is similarly broken down into `BuildPlan` and `PackagePlan`.
89In order to get a `BuildPlan`, we need two pieces of information: the
90`BuildConstraints`, and a package index. The package index (usually downloaded
91from Hackage) is a collection of all of the cabal files available.
93By applying a `BuildConstraints` to a package index (via `newBuildPlan`), we
94get a proposed `BuildPlan`. There is no guarantee that this `BuildPlan` is
95valid. To validate it, we use `checkBuildPlan`. A `BuildPlan` is an instance of
96both `ToJSON` and `FromJSON`, and therefore can be serialized to a file for
97later use.
99When dealing with LTS Haskell, we want to be able to take a `BuildPlan`, and
100update to a newer `BuildPlan` that keeps all packages at the same major
101version. `updateBuildConstraints` turns a `BuildPlan` into a new
102`BuildConstraints` with that restriction, and `updateBuildPlan` applies
103`newBuildPlan` to that result. As mentioned previously: this is *not* a
104validated result, and therefore `checkBuildPlan` must be used.
106A `BuildPlan` can be acted on. This is done to check that all packages compile
107together, run relevant test suites, test Haddock documentation is correct, and
108produce as artifacts both a self-contained GHC binary package database and a
109set of Haddock documentation. (Not yet implemented.)
111A `BuildPlan` may be converted into a bundle to be uploaded to Stackage Server.
112(Not yet implemented.)