Compare commits

..

2 Commits

Author SHA1 Message Date
c846e52acb Cleanup during unpack failures as well 2021-10-10 20:48:33 +02:00
19e7f0df34 Use static cabal bindists for linux 2021-10-10 17:53:24 +02:00
7 changed files with 86 additions and 75 deletions

View File

@@ -1,8 +1,8 @@
stages: stages:
- linting - checks
- quick-tests - quick-test
- tests - test
- expensive-tests - expensive-test
- release - release
variables: variables:
@@ -232,7 +232,7 @@ variables:
######## stack test ######## ######## stack test ########
test:linux:stack: test:linux:stack:
stage: tests stage: test
before_script: before_script:
- ./.gitlab/before_script/linux/install_deps_minimal.sh - ./.gitlab/before_script/linux/install_deps_minimal.sh
script: script:
@@ -244,7 +244,7 @@ test:linux:stack:
######## bootstrap test ######## ######## bootstrap test ########
test:linux:bootstrap_script: test:linux:bootstrap_script:
stage: quick-tests stage: quick-test
before_script: before_script:
- ./.gitlab/before_script/linux/install_deps_minimal.sh - ./.gitlab/before_script/linux/install_deps_minimal.sh
script: script:
@@ -258,7 +258,7 @@ test:linux:bootstrap_script:
needs: [] needs: []
test:windows:bootstrap_powershell_script: test:windows:bootstrap_powershell_script:
stage: quick-tests stage: quick-test
script: script:
- ./scripts/bootstrap/bootstrap-haskell.ps1 -InstallDir $CI_PROJECT_DIR -BootstrapUrl $CI_PROJECT_DIR/bootstrap-haskell -InBash - ./scripts/bootstrap/bootstrap-haskell.ps1 -InstallDir $CI_PROJECT_DIR -BootstrapUrl $CI_PROJECT_DIR/bootstrap-haskell -InBash
after_script: after_script:
@@ -276,7 +276,7 @@ test:windows:bootstrap_powershell_script:
######## linux test ######## ######## linux test ########
test:linux: test:linux:
stage: tests stage: test
extends: .test_ghcup_version:linux extends: .test_ghcup_version:linux
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -284,7 +284,7 @@ test:linux:
needs: [] needs: []
test:linux:hls: test:linux:hls:
stage: expensive-tests stage: expensive-test
extends: extends:
- .test_ghcup_version - .test_ghcup_version
- .debian - .debian
@@ -301,7 +301,7 @@ test:linux:hls:
- ./.gitlab/script/ghcup_hls.sh - ./.gitlab/script/ghcup_hls.sh
test:linux:cross-armv7: test:linux:cross-armv7:
stage: expensive-tests stage: expensive-test
extends: extends:
- .test_ghcup_version - .test_ghcup_version
- .debian - .debian
@@ -319,22 +319,21 @@ test:linux:cross-armv7:
- ./.gitlab/script/ghcup_cross.sh - ./.gitlab/script/ghcup_cross.sh
test:linux:git:hadrian: test:linux:git:hadrian:
stage: expensive-tests stage: expensive-test
extends: extends:
- .test_ghcup_version - .test_ghcup_version
- .alpine:64bit - .debian
variables: variables:
GHC_VERSION: "8.8.4" GHC_VERSION: "8.10.7"
GHC_GIT_TAG: "ghc-8.10.7-release" GHC_GIT_TAG: "ghc-9.0.1-release"
GHC_GIT_VERSION: "8.10.7" GHC_GIT_VERSION: "9.0.1"
CABAL_VERSION: "3.6.2.0" CABAL_VERSION: "3.6.2.0"
CROSS: "" CROSS: ""
needs: [] needs: []
when: manual when: manual
allow_failure: true allow_failure: true
before_script: before_script:
- apk add --no-cache python3 autoconf automake - ./.gitlab/before_script/linux/install_deps.sh
- ./.gitlab/before_script/linux/alpine/install_deps.sh
script: script:
- ./.gitlab/script/ghcup_git.sh - ./.gitlab/script/ghcup_git.sh
@@ -342,7 +341,7 @@ test:linux:git:hadrian:
######## linux 32bit test ######## ######## linux 32bit test ########
test:linux:32bit: test:linux:32bit:
stage: tests stage: test
extends: .test_ghcup_version:linux32 extends: .test_ghcup_version:linux32
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -352,7 +351,7 @@ test:linux:32bit:
######## arm tests ######## ######## arm tests ########
test:linux:armv7: test:linux:armv7:
stage: tests stage: test
extends: .test_ghcup_version:armv7 extends: .test_ghcup_version:armv7
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -362,7 +361,7 @@ test:linux:armv7:
needs: [] needs: []
test:linux:aarch64: test:linux:aarch64:
stage: tests stage: test
extends: .test_ghcup_version:aarch64 extends: .test_ghcup_version:aarch64
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -374,7 +373,7 @@ test:linux:aarch64:
######## darwin test ######## ######## darwin test ########
test:mac: test:mac:
stage: tests stage: test
extends: .test_ghcup_version:darwin extends: .test_ghcup_version:darwin
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -382,7 +381,7 @@ test:mac:
needs: [] needs: []
test:mac:aarch64: test:mac:aarch64:
stage: tests stage: test
extends: .test_ghcup_version:darwin:aarch64 extends: .test_ghcup_version:darwin:aarch64
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -394,7 +393,7 @@ test:mac:aarch64:
######## freebsd test ######## ######## freebsd test ########
test:freebsd12: test:freebsd12:
stage: tests stage: test
extends: .test_ghcup_version:freebsd12 extends: .test_ghcup_version:freebsd12
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -404,7 +403,7 @@ test:freebsd12:
needs: [] needs: []
test:freebsd13: test:freebsd13:
stage: tests stage: test
extends: .test_ghcup_version:freebsd13 extends: .test_ghcup_version:freebsd13
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -416,7 +415,7 @@ test:freebsd13:
######## windows test ######## ######## windows test ########
test:windows: test:windows:
stage: tests stage: test
extends: .test_ghcup_version:windows extends: .test_ghcup_version:windows
variables: variables:
GHC_VERSION: "8.10.7" GHC_VERSION: "8.10.7"
@@ -588,7 +587,7 @@ release:windows:
######## hlint ######## ######## hlint ########
hlint: hlint:
stage: linting stage: checks
extends: extends:
- .debian - .debian
script: script:
@@ -603,7 +602,7 @@ hlint:
######## mkdocs ######## ######## mkdocs ########
mkdocs: mkdocs:
stage: linting stage: checks
extends: extends:
- .debian - .debian
before_script: before_script:
@@ -620,7 +619,7 @@ shellcheck:
image: "koalaman/shellcheck-alpine" image: "koalaman/shellcheck-alpine"
tags: tags:
- x86_64-linux - x86_64-linux
stage: linting stage: checks
script: script:
- shellcheck scripts/bootstrap/bootstrap-haskell - shellcheck scripts/bootstrap/bootstrap-haskell
allow_failure: true allow_failure: true

View File

@@ -41,20 +41,7 @@ cabal --version
eghcup debug-info eghcup debug-info
( eghcup compile ghc -j $(nproc) -g ${GHC_GIT_TAG} -b ${GHC_VERSION} -- --enable-unregisterised
cd /tmp
ecabal install --installdir="$CI_PROJECT_DIR/.local/bin" --overwrite-policy=always --install-method=copy --constraint="happy == 1.19.12" happy
ecabal install --installdir="$CI_PROJECT_DIR/.local/bin" --overwrite-policy=always --install-method=copy --constraint="alex == 3.2.6" alex
)
ls -la "$CI_PROJECT_DIR/.local/bin"
which alex
which happy
"$CI_PROJECT_DIR/.local/bin/alex" --version
"$CI_PROJECT_DIR/.local/bin/happy" --version
eghcup compile ghc -j $(nproc) -g ${GHC_GIT_TAG} -b ${GHC_VERSION} --hadrian -- --enable-unregisterised
eghcup set ghc ${GHC_GIT_VERSION} eghcup set ghc ${GHC_GIT_VERSION}
[ `$(eghcup whereis ghc ${GHC_GIT_VERSION}) --numeric-version` = "${GHC_GIT_VERSION}" ] [ `$(eghcup whereis ghc ${GHC_GIT_VERSION}) --numeric-version` = "${GHC_GIT_VERSION}" ]

View File

@@ -434,6 +434,7 @@ install' _ (_, ListResult {..}) = do
, NoUpdate , NoUpdate
, TarDirDoesNotExist , TarDirDoesNotExist
, FileAlreadyExistsError , FileAlreadyExistsError
, ProcessError
] ]
run (do run (do

View File

@@ -1852,6 +1852,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
, NextVerNotFound , NextVerNotFound
, NoToolVersionSet , NoToolVersionSet
, FileAlreadyExistsError , FileAlreadyExistsError
, ProcessError
] ]
let runInstTool mInstPlatform action' = do let runInstTool mInstPlatform action' = do
@@ -1953,6 +1954,12 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
, NotInstalled , NotInstalled
, DirNotEmpty , DirNotEmpty
, ArchiveResult , ArchiveResult
, FileDoesNotExistError
, HadrianNotFound
, InvalidBuildConfig
, ProcessError
, CopyError
, BuildFailed
] ]
let runCompileHLS = let runCompileHLS =

View File

@@ -2239,13 +2239,11 @@ ghcupDownloads:
viArch: viArch:
A_64: A_64:
Linux_UnknownLinux: Linux_UnknownLinux:
unknown_versioning: unknown_versioning: &cabal-3410-64
dlUri: https://downloads.haskell.org/~cabal/cabal-install-3.4.1.0/cabal-install-3.4.1.0-x86_64-linux-deb10.tar.xz
dlHash: 019351d5ddc282f2195aca6d432699a31ad0ff75b01eeddff2402f5f3ca2104e
Linux_Alpine:
unknown_versioning:
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.4.1.0/cabal-install-3.4.1.0-x86_64-linux-alpine-static.tar.xz dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.4.1.0/cabal-install-3.4.1.0-x86_64-linux-alpine-static.tar.xz
dlHash: f8cae8b5e6346b56676f734de1afd9b4b5f27eab6ab87852c19a30f7850f17fe dlHash: f8cae8b5e6346b56676f734de1afd9b4b5f27eab6ab87852c19a30f7850f17fe
Linux_Alpine:
unknown_versioning: *cabal-3410-64
Darwin: Darwin:
unknown_versioning: unknown_versioning:
dlUri: https://downloads.haskell.org/~cabal/cabal-install-3.4.1.0/cabal-install-3.4.1.0-x86_64-darwin.tar.xz dlUri: https://downloads.haskell.org/~cabal/cabal-install-3.4.1.0/cabal-install-3.4.1.0-x86_64-darwin.tar.xz
@@ -2341,13 +2339,11 @@ ghcupDownloads:
viArch: viArch:
A_64: A_64:
Linux_UnknownLinux: Linux_UnknownLinux:
unknown_versioning: unknown_versioning: &cabal-3620-32
dlUri: https://downloads.haskell.org/~cabal/cabal-install-3.6.2.0/cabal-install-3.6.2.0-x86_64-linux-deb10.tar.xz
dlHash: 4759b56e9257e02f29fa374a6b25d6cb2f9d80c7e3a55d4f678a8e570925641c
Linux_Alpine:
unknown_versioning:
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.6.2.0/cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.6.2.0/cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz
dlHash: 7810d31f35ca7649355647abc6406ad2a3696648ce848e49409e86bd70f6a2c6 dlHash: 7810d31f35ca7649355647abc6406ad2a3696648ce848e49409e86bd70f6a2c6
Linux_Alpine:
unknown_versioning: *cabal-3620-32
Darwin: Darwin:
unknown_versioning: unknown_versioning:
dlUri: https://downloads.haskell.org/~cabal/cabal-install-3.6.2.0/cabal-install-3.6.2.0-x86_64-darwin.tar.xz dlUri: https://downloads.haskell.org/~cabal/cabal-install-3.6.2.0/cabal-install-3.6.2.0-x86_64-darwin.tar.xz

View File

@@ -205,6 +205,7 @@ installGHCBindist :: ( MonadFail m
, TarDirDoesNotExist , TarDirDoesNotExist
, DirNotEmpty , DirNotEmpty
, ArchiveResult , ArchiveResult
, ProcessError
] ]
m m
() ()
@@ -283,6 +284,7 @@ installPackedGHC :: ( MonadMask m
, TarDirDoesNotExist , TarDirDoesNotExist
, DirNotEmpty , DirNotEmpty
, ArchiveResult , ArchiveResult
, ProcessError
] m () ] m ()
installPackedGHC dl msubdir inst ver forceInstall = do installPackedGHC dl msubdir inst ver forceInstall = do
PlatformRequest {..} <- lift getPlatformReq PlatformRequest {..} <- lift getPlatformReq
@@ -292,7 +294,7 @@ installPackedGHC dl msubdir inst ver forceInstall = do
-- unpack -- unpack
tmpUnpack <- lift mkGhcupTmpDir tmpUnpack <- lift mkGhcupTmpDir
liftE $ unpackToDir tmpUnpack dl liftE $ cleanUpOnError tmpUnpack (unpackToDir tmpUnpack dl)
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
-- the subdir of the archive where we do the work -- the subdir of the archive where we do the work
@@ -402,12 +404,13 @@ installGHCBin :: ( MonadFail m
, TarDirDoesNotExist , TarDirDoesNotExist
, DirNotEmpty , DirNotEmpty
, ArchiveResult , ArchiveResult
, ProcessError
] ]
m m
() ()
installGHCBin ver isoFilepath forceInstall = do installGHCBin ver isoFilepath forceInstall = do
dlinfo <- liftE $ getDownloadInfo GHC ver dlinfo <- liftE $ getDownloadInfo GHC ver
installGHCBindist dlinfo ver isoFilepath forceInstall liftE $ installGHCBindist dlinfo ver isoFilepath forceInstall
-- | Like 'installCabalBin', except takes the 'DownloadInfo' as -- | Like 'installCabalBin', except takes the 'DownloadInfo' as
@@ -472,7 +475,7 @@ installCabalBindist dlinfo ver isoFilepath forceInstall = do
-- unpack -- unpack
tmpUnpack <- lift withGHCupTmpDir tmpUnpack <- lift withGHCupTmpDir
liftE $ unpackToDir tmpUnpack dl liftE $ cleanUpOnError tmpUnpack (unpackToDir tmpUnpack dl)
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
-- the subdir of the archive where we do the work -- the subdir of the archive where we do the work
@@ -614,7 +617,7 @@ installHLSBindist dlinfo ver isoFilepath forceInstall = do
-- unpack -- unpack
tmpUnpack <- lift withGHCupTmpDir tmpUnpack <- lift withGHCupTmpDir
liftE $ unpackToDir tmpUnpack dl liftE $ cleanUpOnError tmpUnpack (unpackToDir tmpUnpack dl)
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
-- the subdir of the archive where we do the work -- the subdir of the archive where we do the work
@@ -784,7 +787,7 @@ compileHLS targetHLS ghcs jobs ov isolateDir cabalProject cabalProjectLocal patc
-- unpack -- unpack
tmpUnpack <- lift mkGhcupTmpDir tmpUnpack <- lift mkGhcupTmpDir
liftE $ unpackToDir tmpUnpack dl liftE $ cleanUpOnError tmpUnpack (unpackToDir tmpUnpack dl)
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
workdir <- maybe (pure tmpUnpack) workdir <- maybe (pure tmpUnpack)
@@ -1001,7 +1004,7 @@ installStackBindist dlinfo ver isoFilepath forceInstall = do
-- unpack -- unpack
tmpUnpack <- lift withGHCupTmpDir tmpUnpack <- lift withGHCupTmpDir
liftE $ unpackToDir tmpUnpack dl liftE $ cleanUpOnError tmpUnpack (unpackToDir tmpUnpack dl)
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
-- the subdir of the archive where we do the work -- the subdir of the archive where we do the work
@@ -2114,6 +2117,12 @@ compileGHC :: ( MonadMask m
, NotInstalled , NotInstalled
, DirNotEmpty , DirNotEmpty
, ArchiveResult , ArchiveResult
, FileDoesNotExistError
, HadrianNotFound
, InvalidBuildConfig
, ProcessError
, CopyError
, BuildFailed
] ]
m m
GHCTargetVersion GHCTargetVersion
@@ -2135,7 +2144,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
-- unpack -- unpack
tmpUnpack <- lift mkGhcupTmpDir tmpUnpack <- lift mkGhcupTmpDir
liftE $ unpackToDir tmpUnpack dl liftE $ cleanUpOnError tmpUnpack (unpackToDir tmpUnpack dl)
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
workdir <- maybe (pure tmpUnpack) workdir <- maybe (pure tmpUnpack)

View File

@@ -74,7 +74,6 @@ import System.Win32.Console
import System.Win32.File hiding ( copyFile ) import System.Win32.File hiding ( copyFile )
import System.Win32.Types import System.Win32.Types
#endif #endif
import Text.PrettyPrint.HughesPJClass hiding ( (<>) )
import Text.Regex.Posix import Text.Regex.Posix
import URI.ByteString import URI.ByteString
@@ -926,11 +925,7 @@ getChangeLog dls tool (Right tag) =
-- --
-- 1. the build directory, depending on the KeepDirs setting -- 1. the build directory, depending on the KeepDirs setting
-- 2. the install destination, depending on whether the build failed -- 2. the install destination, depending on whether the build failed
runBuildAction :: ( Pretty (V e) runBuildAction :: ( MonadReader env m
, Show (V e)
, PopVariant BuildFailed e
, ToVariantMaybe BuildFailed e
, MonadReader env m
, HasDirs env , HasDirs env
, HasSettings env , HasSettings env
, MonadIO m , MonadIO m
@@ -943,26 +938,43 @@ runBuildAction :: ( Pretty (V e)
=> FilePath -- ^ build directory (cleaned up depending on Settings) => FilePath -- ^ build directory (cleaned up depending on Settings)
-> Maybe FilePath -- ^ dir to *always* clean up on exception -> Maybe FilePath -- ^ dir to *always* clean up on exception
-> Excepts e m a -> Excepts e m a
-> Excepts '[BuildFailed] m a -> Excepts e m a
runBuildAction bdir instdir action = do runBuildAction bdir instdir action = do
Settings {..} <- lift getSettings Settings {..} <- lift getSettings
let exAction = do let exAction = do
forM_ instdir $ \dir -> forM_ instdir $ \dir ->
lift $ hideError doesNotExistErrorType $ recyclePathForcibly dir hideError doesNotExistErrorType $ recyclePathForcibly dir
when (keepDirs == Never) when (keepDirs == Never)
$ lift $ rmBDir bdir $ rmBDir bdir
v <- v <-
flip onException exAction flip onException (lift exAction)
$ catchAllE $ onE_ exAction action
(\es -> do
exAction
throwE (BuildFailed bdir es)
) action
when (keepDirs == Never || keepDirs == Errors) $ lift $ rmBDir bdir when (keepDirs == Never || keepDirs == Errors) $ lift $ rmBDir bdir
pure v pure v
-- | Clean up the given directory if the action fails,
-- depending on the Settings.
cleanUpOnError :: ( MonadReader env m
, HasDirs env
, HasSettings env
, MonadIO m
, MonadMask m
, HasLog env
, MonadUnliftIO m
, MonadFail m
, MonadCatch m
)
=> FilePath -- ^ build directory (cleaned up depending on Settings)
-> Excepts e m a
-> Excepts e m a
cleanUpOnError bdir action = do
Settings {..} <- lift getSettings
let exAction = when (keepDirs == Never) $ rmBDir bdir
flip onException (lift exAction) $ onE_ exAction action
-- | Remove a build directory, ignoring if it doesn't exist and gracefully -- | Remove a build directory, ignoring if it doesn't exist and gracefully
-- printing other errors without crashing. -- printing other errors without crashing.
rmBDir :: (MonadReader env m, HasLog env, MonadUnliftIO m, MonadIO m) => FilePath -> m () rmBDir :: (MonadReader env m, HasLog env, MonadUnliftIO m, MonadIO m) => FilePath -> m ()