a build bot for cabal-powered projects
#9How scoutess can be implemented.
How scoutess can be implemented
Configs
Global
There should be a global hackage repo cache, available to any build, can be overridden.
Environment
- Compiler
- package-db with packages you don't want to recompile. Something big like gtk or OpenGL.
Sandbox
Once cabal install
gets sandboxes functionality, local repo may be unnecessary. But this pretty much does the same.
- A (link to) sources.txt where to get updates.
- package-db: where packages get installed
- local-repo: where sources are copied and .cabal index lives
- cabal config used for building in this repo. Can be substituted with flags though
- constraints to packages, as used by
cabal install
- build logs
Build
Build gets its sandbox, list of packages to build, additional package version constraints.
- Update global hackage repo cache index, by downloading it from hackage (if cache is stale).
- Update source repos and check for changes.
- Update local repo with updated sources.
- Re-initialize sandbox pacakge-db, so you don't get 'reinstalls are dangerous' and don't require -upgrade-dependencies flag which may update packages from environment.
- Compute -constraint flags to constraint packages to the ones in source repos. Hackage may contain different sources with same version as in repos (not everyone update .cabal file on every change). In that case maybe add .9999 to version, like socutess-0.1.9999 and constraint to it instead (also update cabal).
- run
cabal install --dry-run
with constraints to check if it resolves deps at all, and parse deps. Check for updated versions compared to last build, union with updates to repos. - if there were updates, then build using config from sandbox.
This can build any number of packages wherever they depend on each other or not.
Advanced builds
Build with latest packages from hackage
After first dry-run
check for latest versions in hackage cache index, and re-run dry-run
with latest constraints. May fail at deps computation. Updating .cabals to lift upper bounds can be hard, because of flags.
Building with lower/upper bounds
The hard part is computing correct bounds because .cabal can have flags. If possible to compute - just use constraints.