aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci/update-stack-resolvers.sh
blob: 9f6ce6854ca173652eede39b287d51cc9ff4477f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Example:
#     $ scripts/ci/update-stack-resolvers.sh | tee tests/stack-resolvers

STACKAGE_SNAPSHOTS_REPO=https://github.com/commercialhaskell/stackage-snapshots

tmp=/tmp/stack-resolvers
mkdir -p "$tmp"

wget -q -O- "$STACKAGE_SNAPSHOTS_REPO"/archive/master.tar.gz \
        | tar -xvz --strip-components=1 --show-transformed-names \
        | tee "$tmp"/all-resolvers.list

< "$tmp"/all-resolvers.list \
  sed -rn 's_((lts)/([0-9]+)/([0-9]+)\.yaml)_\1 \2-\3.\4 \2-\3_p' \
        | sort -V -r | uniq -f 2 > "$tmp"/resolvers.list

while read -r path lts _; do
        ghc=$(cat $path | sed -rn 's/^ *compiler: +ghc-([0-9.]+)/\1/p')
        printf '%-10s %s\n' "$ghc" "$lts"
done < "$tmp"/resolvers.list