diff --git a/.gitlab/ghcup-run.files b/.gitlab/ghcup-run.files new file mode 100644 index 0000000..144914a --- /dev/null +++ b/.gitlab/ghcup-run.files @@ -0,0 +1,37 @@ +. +./cabal +./ghc +./ghc-8.10.7 +./ghc-pkg +./ghc-pkg-8.10.7 +./ghci +./ghci-8.10.7 +./haddock +./haddock-8.10.7 +./haskell-language-server-8.10.6 +./haskell-language-server-8.10.6~1.6.1.0 +./haskell-language-server-8.10.7 +./haskell-language-server-8.10.7~1.6.1.0 +./haskell-language-server-8.6.5 +./haskell-language-server-8.6.5~1.6.1.0 +./haskell-language-server-8.8.4 +./haskell-language-server-8.8.4~1.6.1.0 +./haskell-language-server-9.0.1 +./haskell-language-server-9.0.1~1.6.1.0 +./haskell-language-server-9.0.2 +./haskell-language-server-9.0.2~1.6.1.0 +./haskell-language-server-9.2.1 +./haskell-language-server-9.2.1~1.6.1.0 +./haskell-language-server-wrapper +./haskell-language-server-wrapper-1.6.1.0 +./hp2ps +./hp2ps-8.10.7 +./hpc +./hpc-8.10.7 +./hsc2hs +./hsc2hs-8.10.7 +./runghc +./runghc-8.10.7 +./runhaskell +./runhaskell-8.10.7 +./stack diff --git a/.gitlab/ghcup-run.files.windows b/.gitlab/ghcup-run.files.windows new file mode 100644 index 0000000..46f33e9 --- /dev/null +++ b/.gitlab/ghcup-run.files.windows @@ -0,0 +1,81 @@ +./ +./cabal +./cabal.shim +./ghc-8.10.7.exe +./ghc-8.10.7.shim +./ghc-pkg-8.10.7.exe +./ghc-pkg-8.10.7.shim +./ghc-pkg.exe +./ghc-pkg.shim +./ghc.exe +./ghc.shim +./ghci-8.10.7.exe +./ghci-8.10.7.shim +./ghci.exe +./ghci.shim +./ghcii-8.10.7.sh-8.10.7.exe +./ghcii-8.10.7.sh-8.10.7.shim +./ghcii-8.10.7.sh.exe +./ghcii-8.10.7.sh.shim +./ghcii.sh-8.10.7.exe +./ghcii.sh-8.10.7.shim +./ghcii.sh.exe +./ghcii.sh.shim +./haddock-8.10.7.exe +./haddock-8.10.7.shim +./haddock.exe +./haddock.shim +./haskell-language-server-8.10.6.exe +./haskell-language-server-8.10.6.shim +./haskell-language-server-8.10.6~1.6.1.0.exe +./haskell-language-server-8.10.6~1.6.1.0.shim +./haskell-language-server-8.10.7.exe +./haskell-language-server-8.10.7.shim +./haskell-language-server-8.10.7~1.6.1.0.exe +./haskell-language-server-8.10.7~1.6.1.0.shim +./haskell-language-server-8.6.5.exe +./haskell-language-server-8.6.5.shim +./haskell-language-server-8.6.5~1.6.1.0.exe +./haskell-language-server-8.6.5~1.6.1.0.shim +./haskell-language-server-8.8.4.exe +./haskell-language-server-8.8.4.shim +./haskell-language-server-8.8.4~1.6.1.0.exe +./haskell-language-server-8.8.4~1.6.1.0.shim +./haskell-language-server-9.0.1.exe +./haskell-language-server-9.0.1.shim +./haskell-language-server-9.0.1~1.6.1.0.exe +./haskell-language-server-9.0.1~1.6.1.0.shim +./haskell-language-server-9.0.2.exe +./haskell-language-server-9.0.2.shim +./haskell-language-server-9.0.2~1.6.1.0.exe +./haskell-language-server-9.0.2~1.6.1.0.shim +./haskell-language-server-9.2.1.exe +./haskell-language-server-9.2.1.shim +./haskell-language-server-9.2.1~1.6.1.0.exe +./haskell-language-server-9.2.1~1.6.1.0.shim +./haskell-language-server-wrapper-1.6.1.0.exe +./haskell-language-server-wrapper-1.6.1.0.shim +./haskell-language-server-wrapper.exe +./haskell-language-server-wrapper.shim +./hp2ps-8.10.7.exe +./hp2ps-8.10.7.shim +./hp2ps.exe +./hp2ps.shim +./hpc-8.10.7.exe +./hpc-8.10.7.shim +./hpc.exe +./hpc.shim +./hsc2hs-8.10.7.exe +./hsc2hs-8.10.7.shim +./hsc2hs.exe +./hsc2hs.shim +./runghc-8.10.7.exe +./runghc-8.10.7.shim +./runghc.exe +./runghc.shim +./runhaskell-8.10.7.exe +./runhaskell-8.10.7.shim +./runhaskell.exe +./runhaskell.shim +./stack +./stack.shim diff --git a/.gitlab/script/ghcup_version.sh b/.gitlab/script/ghcup_version.sh index e005d40..e8c91f8 100755 --- a/.gitlab/script/ghcup_version.sh +++ b/.gitlab/script/ghcup_version.sh @@ -107,12 +107,18 @@ eghcup set cabal ${CABAL_VERSION} [ `$(eghcup whereis cabal ${CABAL_VERSION}) --numeric-version` = "${CABAL_VERSION}" ] [ `eghcup run --cabal ${CABAL_VERSION} -- cabal --numeric-version` = "${CABAL_VERSION}" ] -eghcup run --ghc 8.10.7 --cabal 3.4.0.0 --hls 1.6.1.0 --stack 2.7.3 --install --bindir "$(pwd)/.bin" -expected=$(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup-run.files" | sort) -actual=$(cd ".bin" && find | sort) -[ "${actual}" = "${expected}" ] -unset actual expected -rm -rf .bin +if [ "${ARCH}" = "64" ] ; then + eghcup run --ghc 8.10.7 --cabal 3.4.1.0 --hls 1.6.1.0 --stack 2.7.3 --install --bindir "$(pwd)/.bin" + if [ "${OS}" == "WINDOWS" ] ; then + expected=$(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup-run.files.windows" | sort) + else + expected=$(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup-run.files" | sort) + fi + actual=$(cd ".bin" && find | sort) + [ "${actual}" = "${expected}" ] + unset actual expected + rm -rf .bin +fi cabal --version diff --git a/app/ghcup/GHCup/OptParse/Run.hs b/app/ghcup/GHCup/OptParse/Run.hs index 4433a89..b042930 100644 --- a/app/ghcup/GHCup/OptParse/Run.hs +++ b/app/ghcup/GHCup/OptParse/Run.hs @@ -209,19 +209,27 @@ run RunOptions{..} runAppState leanAppstate runLogger = do liftIO $ createDirRecursive' bdir liftIO $ canonicalizePath bdir Nothing -> liftIO (getTemporaryDirectory >>= \tmp -> createTempDirectory tmp "ghcup") - r <- addToolsToDir tmp + r <- do + addToolsToDir tmp case r of VRight _ -> do case runCOMMAND of - [] -> liftIO $ putStr tmp + [] -> do + liftIO $ putStr tmp + pure ExitSuccess (cmd:args) -> do newEnv <- liftIO $ addToPath tmp #ifndef IS_WINDOWS - liftIO $ SPP.executeFile cmd True args (Just newEnv) + void $ liftIO $ SPP.executeFile cmd True args (Just newEnv) + pure ExitSuccess #else - liftE $ lEM @_ @'[ProcessError] $ exec cmd args Nothing (Just newEnv) + r' <- runLeanRUN leanAppstate $ liftE $ lEM @_ @'[ProcessError] $ exec cmd args Nothing (Just newEnv) + case r' of + VRight _ -> pure ExitSuccess + VLeft e -> do + runLogger $ logError $ T.pack $ prettyShow e + pure $ ExitFailure 28 #endif - pure ExitSuccess VLeft e -> do runLogger $ logError $ T.pack $ prettyShow e pure $ ExitFailure 27 @@ -304,11 +312,11 @@ run RunOptions{..} runAppState leanAppstate runLogger = do Cabal -> do bin <- liftE $ whereIsTool Cabal v cbin <- liftIO $ canonicalizePath bin - lift $ createLink (relativeSymlink tmp cbin) (tmp "cabal") + lift $ createLink (relativeSymlink tmp cbin) (tmp ("cabal" <.> exeExt)) Stack -> do bin <- liftE $ whereIsTool Stack v cbin <- liftIO $ canonicalizePath bin - lift $ createLink (relativeSymlink tmp cbin) (tmp "stack") + lift $ createLink (relativeSymlink tmp cbin) (tmp ("stack" <.> exeExt)) HLS -> do Dirs {..} <- getDirs let v' = _tvVersion v diff --git a/lib/GHCup.hs b/lib/GHCup.hs index da8fed8..49bd93a 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -1110,7 +1110,7 @@ setGHC ver sghc mBinDir = do -- first delete the old symlinks (this fixes compatibility issues -- with old ghcup) - when (mBinDir == Nothing) $ + when (isNothing mBinDir) $ case sghc of SetGHCOnly -> liftE $ rmPlainGHC (_tvTarget ver) SetGHC_XY -> liftE $ rmMajorGHCSymlinks ver @@ -1139,7 +1139,7 @@ setGHC ver sghc mBinDir = do destL <- binarySymLinkDestination binDir fileWithExt lift $ createLink destL fullF - when (mBinDir == Nothing) $ do + when (isNothing mBinDir) $ do -- create symlink for share dir when (isNothing . _tvTarget $ ver) $ lift $ symlinkShareDir ghcdir verS @@ -1263,7 +1263,7 @@ setHLS ver shls mBinDir = do pure f -- first delete the old symlinks - when (mBinDir == Nothing) $ + when (isNothing mBinDir) $ case shls of -- not for legacy SetHLS_XYZ -> liftE $ rmMinorHLSSymlinks ver @@ -1300,7 +1300,7 @@ setHLS ver shls mBinDir = do lift $ createLink destL wrapper - when (mBinDir == Nothing) $ + when (isNothing mBinDir) $ lift warnAboutHlsCompatibility diff --git a/lib/GHCup/Utils/File/Common.hs b/lib/GHCup/Utils/File/Common.hs index a3ff8a2..4818fa9 100644 --- a/lib/GHCup/Utils/File/Common.hs +++ b/lib/GHCup/Utils/File/Common.hs @@ -1,6 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE ViewPatterns #-} module GHCup.Utils.File.Common ( module GHCup.Utils.File.Common