|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | | -CHAP=./cardano-haskell-packages |
4 | | -# Download a shallow copy of CHaP |
5 | | -git clone --depth 1 git@github.com:IntersectMBO/cardano-haskell-packages.git $CHAP |
6 | | - |
7 | | -cd $CHAP || exit |
8 | 3 | # Save all the available packages from CHaP |
9 | | -CHAP_PACKAGES=$(./scripts/list-packages.sh) |
10 | | -cd - || exit |
11 | | -echo "The following packages are available in CHaP:" |
| 4 | +CHAP_PACKAGES=$(mktemp) |
| 5 | +trap 'rm -f "$CHAP_PACKAGES"' EXIT |
| 6 | + |
| 7 | +if tar --version | grep -q 'GNU tar' |
| 8 | +then |
| 9 | + tar () { command tar --wildcards "$@"; } |
| 10 | +fi |
| 11 | + |
| 12 | +curl -sSL https://chap.intersectmbo.org/01-index.tar.gz | |
| 13 | + tar -tz \*.cabal | |
| 14 | + cut -d/ -f1-2 | |
| 15 | + LANG=C sort -t/ -k1,1 -k2,2Vr | |
| 16 | + LANG=C sort -t/ -k1,1 -u -o "$CHAP_PACKAGES" |
| 17 | +echo "The complete CHaP package index is here:" |
12 | 18 | echo "$CHAP_PACKAGES" |
13 | 19 |
|
14 | 20 | # Save the paths to every `cardano-ledger` cabal file |
15 | | -CABAL_FILES=$(find . -wholename '*/eras/*.cabal' -o -wholename '*/libs/*.cabal') |
| 21 | +CABAL_FILES=$(git ls-files '*.cabal') |
16 | 22 |
|
17 | 23 | for i in $CABAL_FILES; |
18 | 24 | do |
|
29 | 35 | # Check if the package had a release with |
30 | 36 | # the most recent `CHANGELOG` version number |
31 | 37 | printf "Looking for %s with version %s in CHaP\n" "$PACKAGE" "$VERSION" |
32 | | - RESULT=$(echo "$CHAP_PACKAGES" | grep -o "$PACKAGE $VERSION") |
| 38 | + RESULT=$(grep -o "$PACKAGE/$VERSION" "$CHAP_PACKAGES") |
33 | 39 | if [[ -n "$RESULT" ]]; then |
34 | 40 | # A release was found and thus the `CHANGELOG` has to be bumped |
35 | 41 | # with the incremented patch version |
|
40 | 46 | fi |
41 | 47 | done |
42 | 48 |
|
43 | | -rm -rf $CHAP |
44 | | -printf "\n!!!!!!\n%s %s\n!!!!!!\n" \ |
45 | | - "WARNING! DO NOT BUMP THE VERSION NUMBER IN THE CABAL FILES" \ |
46 | | - "(unless its dependencies were bumped)!" |
| 49 | +if ! git diff -s --exit-code; then |
| 50 | + printf "\n!!!!!!\n%s %s\n!!!!!!\n" \ |
| 51 | + "WARNING! DO NOT BUMP THE VERSION NUMBER IN THE CABAL FILES" \ |
| 52 | + "(unless their dependencies were bumped)!" |
| 53 | + exit 1 |
| 54 | +fi |
0 commit comments