From fc287203247c228dbabf5fbf762372fcf52012d5 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Wed, 27 Dec 2023 08:19:45 +0530 Subject: [PATCH] Set default ghc for cabal-docspec --- packcheck.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/packcheck.sh b/packcheck.sh index 9d9f5e2..69f1dab 100755 --- a/packcheck.sh +++ b/packcheck.sh @@ -944,6 +944,16 @@ ghcup_install() { fi } +ensure_default_ghc() { + local ghc + ghc="$(which_cmd ghc)" + if test -z "$ghc" -a -n "$GHCUP_VERSION" + then + echo "No default ghc found in PATH. Setting it using ghcup" + ghcup set ghc $GHCVER + fi +} + ensure_ghc() { local found local compiler @@ -1024,13 +1034,7 @@ ensure_ghc() { # cabal info command requires "ghc" to be in PATH if test -z "$DISABLE_SDIST_BUILD" then - local ghc - ghc="$(which_cmd ghc)" - if test -z "$ghc" -a -n "$GHCUP_VERSION" - then - echo "No default ghc found in PATH. Setting it using ghcup because SDIST_BUILD needs it" - ghcup set ghc $GHCVER - fi + ensure_default_ghc fi if test -n "$ENABLE_GHCJS" @@ -2104,6 +2108,7 @@ else die "Use DOCSPEC_URL option to install." fi fi + ensure_default_ghc run_verbose_errexit cabal-docspec --version run_verbose_errexit cabal-docspec $DOCSPEC_OPTIONS fi