From 4546e332f7cea76264f9b4d9ce7a1c9621bbe5bf Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 2 Feb 2024 17:31:09 +0800 Subject: [PATCH] Support GHC-9.6 wrt #979 --- cabal.ghc8107.project | 9 +++++++-- cabal.ghc8107.project.freeze | 9 +++++---- cabal.ghc902.project | 9 +++++++-- cabal.ghc902.project.freeze | 9 +++++---- cabal.ghc928.project | 9 +++++++-- cabal.ghc928.project.freeze | 9 +++++---- cabal.ghc948.project | 9 +++++++-- cabal.ghc948.project.freeze | 9 +++++---- cabal.project | 9 +++++++-- cabal.project.freeze | 2 -- ghcup.cabal | 4 ++-- lib/GHCup/Prelude/Process/Posix.hs | 12 +++++++++++- 12 files changed, 68 insertions(+), 31 deletions(-) delete mode 100644 cabal.project.freeze diff --git a/cabal.ghc8107.project b/cabal.ghc8107.project index 6feb966e..774fda86 100644 --- a/cabal.ghc8107.project +++ b/cabal.ghc8107.project @@ -10,7 +10,9 @@ else flags: +tui +tar constraints: http-io-streams -brotli, - any.aeson >= 2.0.1.0 + any.aeson >= 2.0.1.0, + transformers < 0.6, + mtl < 2.3 if os(mingw32) if impl(ghc >= 9.4) @@ -44,12 +46,15 @@ package aeson flags: +ordered-keymap package streamly - flags: +use-unliftio + flags: +use-unliftio -streamly-core package * test-show-details: direct allow-newer: cabal-install-parsers:tar +if impl(ghc >= 9.6) + allow-newer: cabal-install-parsers:base, streamly:base, streamly:ghc-prim, streamly-core:unicode-data, semigroupoids:base, Cabal:unix, unicode-data:base + with-compiler: ghc-8.10.7 diff --git a/cabal.ghc8107.project.freeze b/cabal.ghc8107.project.freeze index 5bcf0686..16f24ee3 100644 --- a/cabal.ghc8107.project.freeze +++ b/cabal.ghc8107.project.freeze @@ -102,7 +102,8 @@ constraints: any.Cabal ==3.6.3.0, any.haskell-lexer ==1.1.1, any.haskus-utils-data ==1.4, any.haskus-utils-types ==1.5.1, - any.haskus-utils-variant ==3.3, + any.haskus-utils-variant ==3.4, + haskus-utils-variant +unliftio, any.heaps ==0.4, any.hsc2hs ==0.68.10, hsc2hs -in-ghc-tree, @@ -111,7 +112,7 @@ constraints: any.Cabal ==3.6.3.0, any.hspec-discover ==2.10.10, any.hspec-expectations ==0.8.2, any.hspec-golden-aeson ==0.9.0.0, - any.http-io-streams ==0.1.6.3, + any.http-io-streams ==0.1.6.4, http-io-streams -brotli +fast-xor, any.indexed-profunctors ==0.1.1.1, any.indexed-traversable ==0.1.3, @@ -121,7 +122,7 @@ constraints: any.Cabal ==3.6.3.0, integer-logarithms -check-bounds +integer-gmp, any.io-streams ==1.5.2.2, io-streams +network -nointeractivetests +zlib, - any.language-c ==0.9.2, + any.language-c ==0.9.3, language-c -allwarnings +iecfpextension +usebytestrings, any.libarchive ==3.0.4.2, libarchive -cross -low-memory +no-exe -system-libarchive, @@ -253,4 +254,4 @@ constraints: any.Cabal ==3.6.3.0, any.zlib ==0.6.3.0, zlib -bundled-c-zlib -non-blocking-ffi -pkg-config, any.zlib-bindings ==0.1.1.5 -index-state: hackage.haskell.org 2024-01-19T19:48:54Z +index-state: hackage.haskell.org 2024-02-02T07:31:11Z diff --git a/cabal.ghc902.project b/cabal.ghc902.project index 1c2b4ec8..75d4a589 100644 --- a/cabal.ghc902.project +++ b/cabal.ghc902.project @@ -10,7 +10,9 @@ else flags: +tui +tar constraints: http-io-streams -brotli, - any.aeson >= 2.0.1.0 + any.aeson >= 2.0.1.0, + transformers < 0.6, + mtl < 2.3 if os(mingw32) if impl(ghc >= 9.4) @@ -44,12 +46,15 @@ package aeson flags: +ordered-keymap package streamly - flags: +use-unliftio + flags: +use-unliftio -streamly-core package * test-show-details: direct allow-newer: cabal-install-parsers:tar +if impl(ghc >= 9.6) + allow-newer: cabal-install-parsers:base, streamly:base, streamly:ghc-prim, streamly-core:unicode-data, semigroupoids:base, Cabal:unix, unicode-data:base + with-compiler: ghc-9.0.2 diff --git a/cabal.ghc902.project.freeze b/cabal.ghc902.project.freeze index 4aeab767..0466fd67 100644 --- a/cabal.ghc902.project.freeze +++ b/cabal.ghc902.project.freeze @@ -108,7 +108,8 @@ constraints: any.Cabal ==3.6.3.0, any.haskell-lexer ==1.1.1, any.haskus-utils-data ==1.4, any.haskus-utils-types ==1.5.1, - any.haskus-utils-variant ==3.3, + any.haskus-utils-variant ==3.4, + haskus-utils-variant +unliftio, any.heaps ==0.4, any.hsc2hs ==0.68.10, hsc2hs -in-ghc-tree, @@ -117,7 +118,7 @@ constraints: any.Cabal ==3.6.3.0, any.hspec-discover ==2.10.10, any.hspec-expectations ==0.8.2, any.hspec-golden-aeson ==0.9.0.0, - any.http-io-streams ==0.1.6.3, + any.http-io-streams ==0.1.6.4, http-io-streams -brotli +fast-xor, any.indexed-profunctors ==0.1.1.1, any.indexed-traversable ==0.1.3, @@ -126,7 +127,7 @@ constraints: any.Cabal ==3.6.3.0, integer-logarithms -check-bounds +integer-gmp, any.io-streams ==1.5.2.2, io-streams +network -nointeractivetests +zlib, - any.language-c ==0.9.2, + any.language-c ==0.9.3, language-c -allwarnings +iecfpextension +usebytestrings, any.libyaml-streamly ==0.2.2, libyaml-streamly -no-unicode -system-libyaml, @@ -266,4 +267,4 @@ constraints: any.Cabal ==3.6.3.0, any.zlib-bindings ==0.1.1.5, any.zstd ==0.1.3.0, zstd +standalone -index-state: hackage.haskell.org 2024-01-19T19:48:54Z +index-state: hackage.haskell.org 2024-02-02T07:31:11Z diff --git a/cabal.ghc928.project b/cabal.ghc928.project index ad6097a5..6b964540 100644 --- a/cabal.ghc928.project +++ b/cabal.ghc928.project @@ -10,7 +10,9 @@ else flags: +tui +tar constraints: http-io-streams -brotli, - any.aeson >= 2.0.1.0 + any.aeson >= 2.0.1.0, + transformers < 0.6, + mtl < 2.3 if os(mingw32) if impl(ghc >= 9.4) @@ -44,12 +46,15 @@ package aeson flags: +ordered-keymap package streamly - flags: +use-unliftio + flags: +use-unliftio -streamly-core package * test-show-details: direct allow-newer: cabal-install-parsers:tar +if impl(ghc >= 9.6) + allow-newer: cabal-install-parsers:base, streamly:base, streamly:ghc-prim, streamly-core:unicode-data, semigroupoids:base, Cabal:unix, unicode-data:base + with-compiler: ghc-9.2.8 diff --git a/cabal.ghc928.project.freeze b/cabal.ghc928.project.freeze index 50649579..99a49059 100644 --- a/cabal.ghc928.project.freeze +++ b/cabal.ghc928.project.freeze @@ -108,7 +108,8 @@ constraints: any.Cabal ==3.6.3.0, any.haskell-lexer ==1.1.1, any.haskus-utils-data ==1.4, any.haskus-utils-types ==1.5.1, - any.haskus-utils-variant ==3.3, + any.haskus-utils-variant ==3.4, + haskus-utils-variant +unliftio, any.heaps ==0.4, any.hsc2hs ==0.68.10, hsc2hs -in-ghc-tree, @@ -117,7 +118,7 @@ constraints: any.Cabal ==3.6.3.0, any.hspec-discover ==2.10.10, any.hspec-expectations ==0.8.2, any.hspec-golden-aeson ==0.9.0.0, - any.http-io-streams ==0.1.6.3, + any.http-io-streams ==0.1.6.4, http-io-streams -brotli +fast-xor, any.indexed-profunctors ==0.1.1.1, any.indexed-traversable ==0.1.3, @@ -126,7 +127,7 @@ constraints: any.Cabal ==3.6.3.0, integer-logarithms -check-bounds +integer-gmp, any.io-streams ==1.5.2.2, io-streams +network -nointeractivetests +zlib, - any.language-c ==0.9.2, + any.language-c ==0.9.3, language-c -allwarnings +iecfpextension +usebytestrings, any.libyaml-streamly ==0.2.2, libyaml-streamly -no-unicode -system-libyaml, @@ -266,4 +267,4 @@ constraints: any.Cabal ==3.6.3.0, any.zlib-bindings ==0.1.1.5, any.zstd ==0.1.3.0, zstd +standalone -index-state: hackage.haskell.org 2024-01-19T19:48:54Z +index-state: hackage.haskell.org 2024-02-02T07:31:11Z diff --git a/cabal.ghc948.project b/cabal.ghc948.project index e78003b7..998ea638 100644 --- a/cabal.ghc948.project +++ b/cabal.ghc948.project @@ -10,7 +10,9 @@ else flags: +tui +tar constraints: http-io-streams -brotli, - any.aeson >= 2.0.1.0 + any.aeson >= 2.0.1.0, + transformers < 0.6, + mtl < 2.3 if os(mingw32) if impl(ghc >= 9.4) @@ -44,12 +46,15 @@ package aeson flags: +ordered-keymap package streamly - flags: +use-unliftio + flags: +use-unliftio -streamly-core package * test-show-details: direct allow-newer: cabal-install-parsers:tar +if impl(ghc >= 9.6) + allow-newer: cabal-install-parsers:base, streamly:base, streamly:ghc-prim, streamly-core:unicode-data, semigroupoids:base, Cabal:unix, unicode-data:base + with-compiler: ghc-9.4.8 diff --git a/cabal.ghc948.project.freeze b/cabal.ghc948.project.freeze index 04d576cd..bf9e6fca 100644 --- a/cabal.ghc948.project.freeze +++ b/cabal.ghc948.project.freeze @@ -107,7 +107,8 @@ constraints: any.Cabal ==3.6.3.0 || ==3.8.1.0, any.haskell-lexer ==1.1.1, any.haskus-utils-data ==1.4, any.haskus-utils-types ==1.5.1, - any.haskus-utils-variant ==3.3, + any.haskus-utils-variant ==3.4, + haskus-utils-variant +unliftio, any.heaps ==0.4, any.hsc2hs ==0.68.10, hsc2hs -in-ghc-tree, @@ -116,7 +117,7 @@ constraints: any.Cabal ==3.6.3.0 || ==3.8.1.0, any.hspec-discover ==2.10.10, any.hspec-expectations ==0.8.2, any.hspec-golden-aeson ==0.9.0.0, - any.http-io-streams ==0.1.6.3, + any.http-io-streams ==0.1.6.4, http-io-streams -brotli +fast-xor, any.indexed-profunctors ==0.1.1.1, any.indexed-traversable ==0.1.3, @@ -125,7 +126,7 @@ constraints: any.Cabal ==3.6.3.0 || ==3.8.1.0, integer-logarithms -check-bounds +integer-gmp, any.io-streams ==1.5.2.2, io-streams +network -nointeractivetests +zlib, - any.language-c ==0.9.2, + any.language-c ==0.9.3, language-c -allwarnings +iecfpextension +usebytestrings, any.libyaml-streamly ==0.2.2, libyaml-streamly -no-unicode -system-libyaml, @@ -264,4 +265,4 @@ constraints: any.Cabal ==3.6.3.0 || ==3.8.1.0, any.zlib-bindings ==0.1.1.5, any.zstd ==0.1.3.0, zstd +standalone -index-state: hackage.haskell.org 2024-01-19T19:48:54Z +index-state: hackage.haskell.org 2024-02-02T07:31:11Z diff --git a/cabal.project b/cabal.project index 37aae738..d0e862ff 100644 --- a/cabal.project +++ b/cabal.project @@ -10,7 +10,9 @@ else flags: +tui +tar constraints: http-io-streams -brotli, - any.aeson >= 2.0.1.0 + any.aeson >= 2.0.1.0, + transformers < 0.6, + mtl < 2.3 if os(mingw32) if impl(ghc >= 9.4) @@ -44,10 +46,13 @@ package aeson flags: +ordered-keymap package streamly - flags: +use-unliftio + flags: +use-unliftio -streamly-core package * test-show-details: direct allow-newer: cabal-install-parsers:tar +if impl(ghc >= 9.6) + allow-newer: cabal-install-parsers:base, streamly:base, streamly:ghc-prim, streamly-core:unicode-data, semigroupoids:base, Cabal:unix, unicode-data:base + diff --git a/cabal.project.freeze b/cabal.project.freeze deleted file mode 100644 index d80b08b5..00000000 --- a/cabal.project.freeze +++ /dev/null @@ -1,2 +0,0 @@ --- windows picks weird version -constraints: any.hsc2hs ==0.68.8 diff --git a/ghcup.cabal b/ghcup.cabal index 3230d561..597d25a7 100644 --- a/ghcup.cabal +++ b/ghcup.cabal @@ -77,7 +77,7 @@ common app-common-depends , directory ^>=1.3.6.0 , filepath ^>=1.4.2.1 , haskus-utils-types ^>=1.5 - , haskus-utils-variant ^>=3.3 + , haskus-utils-variant ^>=3.3 || ^>=3.4 , megaparsec >=8.0.0 && <9.3 , mtl ^>=2.2 , optparse-applicative >=0.15.1.0 && <0.18 @@ -187,7 +187,7 @@ library , filepath ^>=1.4.2.1 , file-uri ^>=0.1.0.0 , haskus-utils-types ^>=1.5 - , haskus-utils-variant ^>=3.3 + , haskus-utils-variant ^>=3.3 || ^>=3.4 , lzma-static ^>=5.2.5.3 , megaparsec >=8.0.0 && <9.3 , mtl ^>=2.2 diff --git a/lib/GHCup/Prelude/Process/Posix.hs b/lib/GHCup/Prelude/Process/Posix.hs index 6089be6b..9a7e5148 100644 --- a/lib/GHCup/Prelude/Process/Posix.hs +++ b/lib/GHCup/Prelude/Process/Posix.hs @@ -3,6 +3,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE CApiFFI #-} +{-# LANGUAGE CPP #-} {-| Module : GHCup.Utils.File.Posix @@ -98,7 +99,12 @@ execLogged exe args chdir lfile env = do Dirs {..} <- getDirs logDebug $ T.pack $ "Running " <> exe <> " with arguments " <> show args let logfile = fromGHCupPath logsDir lfile <> ".log" - liftIO $ bracket (openFd logfile WriteOnly (Just newFilePerms) defaultFileFlags{ append = True }) + liftIO $ bracket +#if MIN_VERSION_unix(2,8,0) + (openFd logfile WriteOnly defaultFileFlags{ append = True, creat = Just newFilePerms }) +#else + (openFd logfile WriteOnly (Just newFilePerms) defaultFileFlags{ append = True }) +#endif closeFd (action verbose noColor) where @@ -339,7 +345,11 @@ cleanup fds = for_ fds $ \fd -> handleIO (\_ -> pure ()) $ closeFd fd -- | Create a new regular file in write-only mode. The file must not exist. createRegularFileFd :: FileMode -> FilePath -> IO Fd createRegularFileFd fm dest = +#if MIN_VERSION_unix(2,8,0) + openFd dest WriteOnly defaultFileFlags{ exclusive = True, creat = Just fm } +#else openFd dest WriteOnly (Just fm) defaultFileFlags{ exclusive = True } +#endif -- | Thin wrapper around `executeFile`.