[commit: ghc] wip/nfs-locking: Don't use `new-build` for pre-2.1 Cabal (65bcdcb)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 01:02:04 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/65bcdcbe7dd61dace537fd956b5d5d40aed6d8c9/ghc

>---------------------------------------------------------------

commit 65bcdcbe7dd61dace537fd956b5d5d40aed6d8c9
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Tue Oct 17 23:38:17 2017 +0100

    Don't use `new-build` for pre-2.1 Cabal
    
    See #438


>---------------------------------------------------------------

65bcdcbe7dd61dace537fd956b5d5d40aed6d8c9
 build.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/build.sh b/build.sh
index 6c2c038..d2bdb85 100755
--- a/build.sh
+++ b/build.sh
@@ -42,9 +42,10 @@ CABVERSTR=$("$CABAL" --numeric-version)
 
 CABVER=( ${CABVERSTR//./ } )
 
-if [ "${CABVER[0]}" -eq 2 -o "${CABVER[0]}" -eq 1 -a "${CABVER[1]}" -ge 24 ]; then
-    # New enough cabal version detected, so
-    # let's use the superior 'cabal new-build' mode
+if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 1 ]; then
+    # New enough Cabal version detected, so let's use the superior new-build + new-run
+    # modes. Note that pre-2.1 Cabal does not support passing additional parameters
+    # to the executable (hadrian) after the separator '--', see #438.
 
     "$CABAL" new-build --disable-profiling --disable-documentation -j exe:hadrian
     "$CABAL" new-run hadrian --        \
@@ -53,8 +54,8 @@ if [ "${CABVER[0]}" -eq 2 -o "${CABVER[0]}" -eq 1 -a "${CABVER[1]}" -ge 24 ]; th
         "$@"
 
 else
-    # The logic below is quite fragile, but it's better than nothing for pre-1.24 cabals
-    echo "Old pre cabal 1.24 version detected. Falling back to legacy 'cabal sandbox' mode."
+    # The logic below is quite fragile, but it's better than nothing for pre-2.1 Cabal.
+    echo "Old pre cabal 2.1 version detected. Falling back to legacy 'cabal sandbox' mode."
 
     # Initialize sandbox if necessary
     if ! ( "$CABAL" sandbox hc-pkg list > /dev/null 2>&1); then



More information about the ghc-commits mailing list