Skip to content

Commit

Permalink
Fix #5697 Move stack to lts-19.7 (GHC 9.0.2) from lts-17.15 (GHC 8.10.4)
Browse files Browse the repository at this point in the history
Also seeks to update the tests to use a current stable release GHC compiler.

`Stack.Test.runRepl` was not working, apparently because it was referring to a directory (`/tmp`, equivalent to `C:\tmp`) that did not exist.

Uses `Stack.Prelude.sinkProcessStderrStdout` in `Stack.PackageDump.ghcPkgCmdArgs` in attempt to avoid `ghc-pkg-9.0.2: startProcess: posix_spawnp: invalid argument (Bad file descriptor)` on macOS.

Also updates the scripts to `lts-19.7`. These have been tested with `stack script <script.hs> --no-run --compile --resolver=lts-19.7`.

Adds `*.exe` to `.gitignore` (an artefact on Windows of testing scripts).

Temporarily alter CI script to try and diagnose the macOS CI problem.

Temporarily alter `111-custom-snapshot/Main.hs` to provide more information, to try and diagnose the macOS CI problem.
  • Loading branch information
mpilgrem committed May 28, 2022
1 parent de309ad commit f2bdb11
Show file tree
Hide file tree
Showing 123 changed files with 194 additions and 146 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ jobs:
stack upgrade || curl -sSL https://get.haskellstack.org/ | sh -s - -f
# Report all ghc versions in the stack environment
if [[ "${{ matrix.os }}" == "windows-latest" ]]
then
stack exec -- where.exe ghc
else
stack exec -- which -a ghc
fi
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]
then
# Retry installing nix due to nondeterministic error
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.hi
*.o
*.exe
*.swp
*.tag
*~
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

Release notes:

* `stack` is now built with GHC 9.0.2 and depends on `Cabal-3.4.1.0`. This
change will cause a once-off rebuilding of any existing CompilerPaths cache
when the updated `stack` is first used.

**Changes since v2.7.5:**

Major changes:
Expand Down
6 changes: 3 additions & 3 deletions etc/scripts/build-stack-installer.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{- stack script
--resolver lts-14.27
--resolver lts-19.7
--install-ghc
--package nsis
-}
Expand Down Expand Up @@ -53,7 +53,7 @@ main = do
[ Description "Add installation directory to user %PATH% to allow running Stack in the console."
] $ do
setEnvVarPrepend HKCU "PATH" "$INSTDIR"

section "Set %STACK_ROOT% to recommended default"
[ Description "Set %STACK_ROOT% to C:\\sr to workaround issues with long paths."
] $ do
Expand All @@ -80,7 +80,7 @@ main = do
[ Description "Remove setting of %STACK_ROOT% to C:\\sr."
] $ do
deleteEnvVar HKCU "STACK_ROOT"

section "un.Compilers installed by stack"
[ Unselected
, Description "Remove %LOCALAPPDATA%/Programs/stack, which contains compilers that have been installed by Stack."
Expand Down
3 changes: 2 additions & 1 deletion etc/scripts/install-many-stack-releases.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env stack
{- stack script
--resolver lts-14.27
--resolver lts-19.7
--package base
--package directory
--package filepath
--package process
--package safe
--package temporary
--extra-dep process-1.6.14.0
-}

-- # Usage summary
Expand Down
4 changes: 3 additions & 1 deletion etc/scripts/release.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{- stack script
--resolver lts-14.27
--resolver lts-19.7
--install-ghc
--ghc-options -Wall
--package Cabal
Expand All @@ -21,6 +21,8 @@
--package text
--package zip-archive
--package zlib
--extra-dep Cabal-3.4.1.0
--extra-dep proces-1.6.14.0
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
Expand Down
5 changes: 4 additions & 1 deletion src/Stack/PackageDump.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ ghcPkgCmdArgs pkgexe@(GhcPkgExe pkgPath) cmd mpkgDbs sink = do
case reverse mpkgDbs of
(pkgDb:_) -> createDatabase pkgexe pkgDb -- TODO maybe use some retry logic instead?
_ -> return ()
sinkProcessStdout (toFilePath pkgPath) args sink'
-- Using `sinkProcessStderrStdout` rather than `sinkProcessStdout` because
-- the latter should not be used for long-running processes or ones with
-- lots of output.
snd <$> sinkProcessStderrStdout (toFilePath pkgPath) args CL.sinkNull sink'
where
args = concat
[ case mpkgDbs of
Expand Down
10 changes: 7 additions & 3 deletions stack-ghc-902.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# GHC 9.0.2
# GHC 9.0.2, Cabal-3.4.1.0, pantry-0.5.5, process-1.6.13.2 and rio-0.1.22.0
resolver: lts-19.7

packages:
Expand All @@ -22,10 +22,14 @@ ghc-options:
"$locals": -fhide-source-paths

extra-deps:
# mustache absent from lts-19.7
- mustache-2.4.1@sha256:dc92ddbf90e3a64c3f2ec7785cf2937d6dcf6ffcebbc38ad9c8b33b6a70bb298,3180
# Required becase a GHC boot package (process) is an extra-dep
- Cabal-3.4.1.0@sha256:48e64c97688149fac15445803830177248f15a9b1a783389efed5e375d70d2d0,31402
# lts-19.7 is limited to hpack-0.34.7
- hpack-0.35.0@sha256:8cd6146fae269390f41dc7237ebd2c479074d4163806d349a41f5a7751d6cea5,4726
# mustache absent from lts-19.7
- mustache-2.4.1@sha256:dc92ddbf90e3a64c3f2ec7785cf2937d6dcf6ffcebbc38ad9c8b33b6a70bb298,3180
# lts-19.7 provides process-1.6.13.2, which excludes certain macOS fixes
- process-1.6.14.0@sha256:b6ad76fd3f4bf133cdc2dc9176e23447f2a0a8e9316047d53154cd11f871446d,2845

drop-packages:
# See https://github.com/commercialhaskell/stack/pull/4712
Expand Down
16 changes: 11 additions & 5 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
resolver: lts-17.15
# GHC 9.0.2, Cabal-3.4.1.0, pantry-0.5.5, process-1.6.13.2 and rio-0.1.22.0
resolver: lts-19.7

packages:
- .

extra-deps:
- hpack-0.35.0@rev:0
- pantry-0.5.3@rev:0
- rio-0.1.21.0@rev:0

# Required becase a GHC boot package (process) is an extra-dep
- Cabal-3.4.1.0@sha256:48e64c97688149fac15445803830177248f15a9b1a783389efed5e375d70d2d0,31402
# lts-19.7 is limited to hpack-0.34.7
- hpack-0.35.0@sha256:8cd6146fae269390f41dc7237ebd2c479074d4163806d349a41f5a7751d6cea5,4726
# mustache absent from lts-19.7
- mustache-2.4.1@sha256:dc92ddbf90e3a64c3f2ec7785cf2937d6dcf6ffcebbc38ad9c8b33b6a70bb298,3180
# lts-19.7 provides process-1.6.13.2, which excludes certain macOS fixes
- process-1.6.14.0@sha256:b6ad76fd3f4bf133cdc2dc9176e23447f2a0a8e9316047d53154cd11f871446d,2845

docker:
enable: false
Expand All @@ -19,6 +24,7 @@ nix:
packages:
- zlib
- unzip

flags:
stack:
developer-mode: true
Expand Down
10 changes: 8 additions & 2 deletions test/integration/lib/StackTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Control.Monad.IO.Class
import Control.Monad.Trans.Reader
import Control.Concurrent
import Control.Exception
import Data.Maybe
import System.Environment
import System.Directory
import System.IO
Expand Down Expand Up @@ -119,7 +120,12 @@ runRepl cmd args actions = do
hSetBuffering rStdout NoBuffering
hSetBuffering rStderr NoBuffering

_ <- forkIO $ withFile "/tmp/stderr" WriteMode
tempDir <- if isWindows
then fromMaybe "" <$> lookupEnv "TEMP"
else return "/tmp"
let tempFP = tempDir ++ "/stderr"

_ <- forkIO $ withFile tempFP WriteMode
$ \err -> do
hSetBuffering err NoBuffering
forever $ catch (hGetChar rStderr >>= hPutChar err)
Expand Down Expand Up @@ -273,7 +279,7 @@ isMacOSX = os == "darwin"
-- the main @stack.yaml@.
--
defaultResolverArg :: String
defaultResolverArg = "--resolver=lts-14.27"
defaultResolverArg = "--resolver=lts-19.7"

-- | Remove a file and ignore any warnings about missing files.
removeFileIgnore :: HasCallStack => FilePath -> IO ()
Expand Down
4 changes: 3 additions & 1 deletion test/integration/tests/111-custom-snapshot/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import StackTest

main :: IO ()
main = stack ["build"]
main = do
stack ["--verbose", "build"] -- More information, to try to diagnose the
-- macos-latest CI problem.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
compiler: ghc-8.6.5
compiler: ghc-9.0.2
name: my-snapshot
packages:
- mtl-2.2.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2
name: test-snapshot-2
packages:
- stm-2.5.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-14.27
resolver: lts-19.7
name: snapshot-modify-lts
drop-packages:
- zlib
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
resolver: lts-14.27
resolver: lts-19.7
name: local-snapshot
packages:
- archive: package-0.1.2.3.tar.gz
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
resolver: lts-14.27
resolver: lts-19.7
name: remote-snapshot
packages:
- archive: https://s3.amazonaws.com/hackage.fpcomplete.com/package/ghc-prim-0.5.3.tar.gz
- archive: https://s3.amazonaws.com/hackage.fpcomplete.com/package/ghc-prim-0.7.0.tar.gz
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-14.27
resolver: lts-19.7
packages:
- '.'
extra-deps: []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2

extra-deps:
- acme-dont-1.1@rev:0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2

extra-deps:
- acme-dont-1.1@rev:0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2

extra-deps:
- acme-dont-1.1@rev:0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2

extra-deps:
- acme-dont-1.1@rev:0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-14.27
resolver: lts-19.7
packages:
- '.'
extra-deps: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ extra-deps:
- location: https://hackage.haskell.org/package/half-0.2.2.3/half-0.2.2.3.tar.gz
sha256: 85c244c80d1c889a3d79073a6f5a99d9e769dbe3c574ca11d992b2b4f7599a5c
size: 6050
resolver: lts-14.27
resolver: lts-19.7
2 changes: 1 addition & 1 deletion test/integration/tests/2195-depend-on-exe/files/stack.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
resolver: lts-14.27
resolver: lts-19.7
6 changes: 3 additions & 3 deletions test/integration/tests/2433-ghc-by-version/files/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -exuo pipefail

export PATH=$(pwd)/fake-path:$("$STACK_EXE" path --resolver ghc-8.6.5 --compiler-bin):$PATH
export PATH=$(pwd)/fake-path:$("$STACK_EXE" path --resolver ghc-9.0.2 --compiler-bin):$PATH
export STACK_ROOT=$(pwd)/fake-root

which ghc

"$STACK_EXE" --system-ghc --no-install-ghc --resolver ghc-8.6.5 ghc -- --info
"$STACK_EXE" --system-ghc --no-install-ghc --resolver ghc-8.6.5 runghc foo.hs
"$STACK_EXE" --system-ghc --no-install-ghc --resolver ghc-9.0.2 ghc -- --info
"$STACK_EXE" --system-ghc --no-install-ghc --resolver ghc-9.0.2 runghc foo.hs
2 changes: 1 addition & 1 deletion test/integration/tests/2465-init-no-packages/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import Control.Monad (unless)
main :: IO ()
main = do
removeFileIgnore "stack.yaml"
stack ["init", "--resolver", "ghc-8.6.5"]
stack ["init", "--resolver", "ghc-9.0.2"]
exists <- doesFileExist "stack.yaml"
unless exists $ error "stack.yaml not created!"
2 changes: 1 addition & 1 deletion test/integration/tests/2781-shadow-bug/files/stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2
packages:
- foo
- bar
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2
packages:
- foo
- bar
Expand Down
2 changes: 1 addition & 1 deletion test/integration/tests/32-unlisted-module/files/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ flags: {}
packages:
- '.'
extra-deps: []
resolver: lts-14.27
resolver: lts-19.7
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
resolver: lts-14.27
resolver: lts-19.7
packages:
- '.'
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ flags: {}
packages:
- '.'
extra-deps: []
resolver: lts-14.27
resolver: lts-19.7
Original file line number Diff line number Diff line change
@@ -1 +1 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
compiler: ghc-8.6.5
compiler: ghc-9.0.2
name: my-snapshot

packages:
Expand All @@ -8,4 +8,3 @@ packages:
flags:
dinamo:
debug: true

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2
name: custom1
packages:
- stm-2.5.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2
name: custom2
packages:
- stm-2.5.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-14.27
resolver: lts-19.7
extra-deps:
- bytestring-0.10.10.0@sha256:06b2e84f1bc9ab71a162c0ca9e88358dd6bbe5cb7fdda2d6d34b6863c367ec95,8944
- binary-0.8.8.0@sha256:e9387a7ef2b34c6a23b09664c306e37cc01ae2cb4e4511a1c96ffb14008c24b0,6262
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-14.27
resolver: lts-19.7

packages:
- ./local-mmorph
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2

packages: []

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
resolver: lts-14.27
resolver: lts-19.7
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ flags: {}
packages:
- '.'
extra-deps: []
resolver: lts-14.27
resolver: lts-19.7
2 changes: 1 addition & 1 deletion test/integration/tests/366-non-root-dir/files/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ flags: {}
packages:
- '.'
extra-deps: []
resolver: lts-14.27
resolver: lts-19.7
Original file line number Diff line number Diff line change
@@ -1 +1 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
resolver: lts-14.27
resolver: lts-19.7
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: ghc-8.6.5
resolver: ghc-9.0.2
packages:
- ./bad-bounds.tar

Expand Down
Loading

0 comments on commit f2bdb11

Please sign in to comment.