File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ # Usage: check-plan [PLAN.JSON]
6+ #
7+ # Check whether a cabal build plan is using the latest packages from CHaP
8+ #
9+ # The CHaP index is fetched using `curl`; the `cardano-haskell-packages` git repo isn't used
10+
11+ PLAN=${1-dist-newstyle/ cache/ plan.json}
12+
13+ PLAN_VERSIONS=$( mktemp)
14+ CHAP_VERSIONS=$( mktemp)
15+
16+ trap ' rm -f "$PLAN_VERSIONS" "$CHAP_VERSIONS"' EXIT
17+
18+ if tar --version | grep -q ' GNU tar'
19+ then
20+ tar () { command tar --wildcards " $@ " ; }
21+ fi
22+
23+ with-header ()
24+ {
25+ if read -r LINE
26+ then
27+ echo " $1 "
28+ echo " $LINE "
29+ cat
30+ fi
31+ }
32+
33+ jq -r '
34+ ."install-plan"[]
35+ | select(."pkg-src".repo.uri // "" | match("^https://chap.intersectmbo.org"; "i"))
36+ | "\(."pkg-name")/\(."pkg-version")"
37+ ' " $PLAN " |
38+ LANG=C sort -t/ -k1,1 -u -o " $PLAN_VERSIONS "
39+
40+ curl -sSL https://chap.intersectmbo.org/01-index.tar.gz |
41+ tar -tz \* .cabal |
42+ cut -d/ -f1-2 |
43+ LANG=C sort -t/ -k1,1 -k2,2Vr |
44+ LANG=C sort -t/ -k1,1 -u -o " $CHAP_VERSIONS "
45+
46+ LANG=C join -t/ -j1 " $PLAN_VERSIONS " " $CHAP_VERSIONS " |
47+ awk -F/ ' $2 != $3 {print}' |
48+ with-header " Package/Plan/CHaP" |
49+ column -t -s/
You can’t perform that action at this time.
0 commit comments