From 8a127ccf83c8fddd12409a8d0d24b5c07cd3fb8e Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Sat, 16 Dec 2023 00:41:40 +0530 Subject: [PATCH] fixup: ghcup download --- packcheck.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/packcheck.sh b/packcheck.sh index 1ccd184..75dac26 100755 --- a/packcheck.sh +++ b/packcheck.sh @@ -637,17 +637,17 @@ EOF #} fetch_stack_osx() { - curl -sSkL https://www.stackage.org/stack/osx-x86_64 \ + curl --fail -sSkL https://www.stackage.org/stack/osx-x86_64 \ | tar xz --strip-components=1 -C $1 --include '*/stack' } fetch_stack_linux() { - curl -sSkL https://www.stackage.org/stack/linux-x86_64 \ + curl --fail -sSkL https://www.stackage.org/stack/linux-x86_64 \ | tar xz --strip-components=1 -C $1 --wildcards '*/stack' } fetch_stack_windows() { - curl -sSkL http://www.stackage.org/stack/windows-i386 \ + curl --fail -sSkL http://www.stackage.org/stack/windows-i386 \ | 7z x -si stack.exe } @@ -886,7 +886,16 @@ ghcup_install() { esac # Check available versions here: https://downloads.haskell.org/~ghcup/ - curl -sL -o $GHCUP_PATH https://downloads.haskell.org/~ghcup/$GHCUP_VER/${GHCUP_ARCH}-ghcup-$GHCUP_VER + mkdir -p $(dirname $GHCUP_PATH) + URL="https://downloads.haskell.org/~ghcup/$GHCUPVER/${GHCUP_ARCH}-ghcup-$GHCUPVER" + echo "Downloading $URL" + curl --fail -sL -o $GHCUP_PATH $URL + if test $? -ne 0 + then + rm -f $GHCUP_PATH + echo "Failed to download ghcup" + exit 1 + fi chmod +x $GHCUP_PATH fi @@ -940,11 +949,11 @@ ensure_ghc() { die "$msg" fi - if test -n "$GHCVER" + check_version_die $COMPILER $GHCVER + if test -n "$GHCVER" -a -n "$(need_stack)" then echo "GHCVER is specified, using '$STACKCMD --system-ghc'." echo "Clear GHCVER if you want to use stack supplied ghc." - check_version_die $COMPILER $GHCVER # If the user specified GHCVER then use it as system-ghc # Stack will still silently choose its own ghc if the ghc does not match # the snapshot. @@ -1597,7 +1606,7 @@ install_hlint() { trap cleanup EXIT echo $URL - retry_cmd curl --progress-bar --location -o$TEMP/$PACKAGE$EXT $URL + retry_cmd curl --fail --progress-bar --location -o$TEMP/$PACKAGE$EXT $URL mkdir -p ${OS_APP_HOME}/${OS_LOCAL_DIR}/bin/ if [ "$OS" = "windows" ]; then 7z x -y $TEMP/$PACKAGE$EXT -o${TEMP} hlint-$VERSION/hlint.exe > /dev/null