Skip to content
Snippets Groups Projects
Commit 76f9ba89 authored by Ben Gamari's avatar Ben Gamari :turtle:
Browse files

Build file containing cabal constraints

parent ac808bef
No related branches found
No related tags found
No related merge requests found
......@@ -104,7 +104,7 @@ EOF
packages from <a href="https://hackage.haskell.org/">Hackage</a> for use
with <a href="https://gitlab.haskell.org/ghc/ghc">GHC</a> prereleases.
<p>The source of this package repository is at <a href="https://gitlab.haskell.org/ghc/head.hackage">gitlab.haskell.org/ghc/head.hackage</a>.
<p>The source of this package repository is at <a href="https://gitlab.haskell.org/ghc/head.hackage">gitlab.haskell.org/ghc/head.hackage</a>.
<p>To use package repository with <code>cabal-install</code> add the following
to your project's <code>cabal.project.local</code> and run
......@@ -112,6 +112,11 @@ EOF
<pre><code>
$(cat repo/cabal.project.local)
</code></pre>
<p>Finally, you may want to add the <a
href="cabal.constraints">constraints</a> to your project to ensure that
cabal chooses the patched releases.
<p>If you find a package that doesn't build with a recent GHC
pre-release see the <a
href="https://gitlab.haskell.org/ghc/head.hackage#adding-a-patch">contributor
......@@ -133,6 +138,26 @@ $(cat repo/cabal.project.local)
EOF
}
split_pkg_version() {
package=$(echo $1 | sed 's/\(.\+\)-\([0-9]\+\(\.[0-9]\+\)*\)/\1/')
version=$(echo $1 | sed 's/\(.\+\)-\([0-9]\+\(\.[0-9]\+\)*\)/\2/')
}
build_constraints() {
cat <<EOF
allow-newer: *:base
allow-newer: *:template-haskell
allow-newer: *:time
allow-newer: *:Cabal
allow-newer: *:ghc
EOF
echo "constraints:"
for f in $(ls patches); do
split_pkg_version $(basename $(basename $f .patch) .cabal)
echo " $package ==$version"
done
}
# Build the hackage repository
build_repo() {
extract_keys_tarball
......@@ -155,6 +180,7 @@ build_repo() {
--template=template \
./repo
build_constraints > repo/cabal.constraints
build_index
}
......@@ -162,7 +188,9 @@ case $1 in
gen-keys) gen_keys_tarball ;;
extract-keys) extract_keys_tarball ;;
build-repo) build_repo ;;
build-index) build_index ;;
build-index)
build_constraints > repo/cabal.constraints
build_index ;;
*)
echo "Unknown command $1"
exit 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment