@@ -1449,9 +1449,9 @@ buildGhcFromSource getSetupInfo' installed (CompilerRepository url) commitId fla
1449
1449
<> display flavour
1450
1450
<> " ` flavour. It can take a long time (more than one hour)..."
1451
1451
1452
- -- We need to provide an absolute path to the script since
1453
- -- the process package only sets working directory _after_
1454
- -- discovering the executable
1452
+ -- We need to provide an absolute path to the script since the process
1453
+ -- package only sets working directory _after_ discovering the
1454
+ -- executable.
1455
1455
proc (toFilePath hadrianPath) hadrianArgs runProcess_
1456
1456
1457
1457
-- find the bindist and install it
@@ -1676,7 +1676,8 @@ sysRelease =
1676
1676
ensureDockerStackExe :: HasConfig env => Platform -> RIO env (Path Abs File )
1677
1677
ensureDockerStackExe containerPlatform = do
1678
1678
config <- view configL
1679
- containerPlatformDir <- runReaderT platformOnlyRelDir (containerPlatform,PlatformVariantNone )
1679
+ containerPlatformDir <-
1680
+ runReaderT platformOnlyRelDir (containerPlatform,PlatformVariantNone )
1680
1681
let programsPath = configLocalProgramsBase config </> containerPlatformDir
1681
1682
tool = Tool (PackageIdentifier (mkPackageName " stack" ) stackVersion)
1682
1683
stackExeDir <- installDir programsPath tool
@@ -1700,7 +1701,7 @@ ensureDockerStackExe containerPlatform = do
1700
1701
1701
1702
-- | Get all executables on the path that might match the wanted compiler
1702
1703
sourceSystemCompilers ::
1703
- (HasProcessContext env , HasLogFunc env )
1704
+ (HasLogFunc env , HasProcessContext env )
1704
1705
=> WantedCompiler
1705
1706
-> ConduitT i (Path Abs File ) (RIO env ) ()
1706
1707
sourceSystemCompilers wanted = do
@@ -1742,10 +1743,11 @@ getSetupInfo = do
1742
1743
logJSONWarnings urlOrFile warnings
1743
1744
pure si
1744
1745
1745
- getInstalledTool :: [Tool ] -- ^ already installed
1746
- -> PackageName -- ^ package to find
1747
- -> (Version -> Bool ) -- ^ which versions are acceptable
1748
- -> Maybe Tool
1746
+ getInstalledTool ::
1747
+ [Tool ] -- ^ already installed
1748
+ -> PackageName -- ^ package to find
1749
+ -> (Version -> Bool ) -- ^ which versions are acceptable
1750
+ -> Maybe Tool
1749
1751
getInstalledTool installed name goodVersion = Tool <$>
1750
1752
maximumByMaybe (comparing pkgVersion) (filterTools name goodVersion installed)
1751
1753
@@ -1774,26 +1776,30 @@ downloadAndInstallTool programsDir downloadInfo tool installer = do
1774
1776
liftIO $ ignoringAbsence (removeDirRecur tempDir)
1775
1777
pure tool
1776
1778
1777
- downloadAndInstallCompiler :: (HasBuildConfig env , HasGHCVariant env )
1778
- => CompilerBuild
1779
- -> SetupInfo
1780
- -> WantedCompiler
1781
- -> VersionCheck
1782
- -> Maybe String
1783
- -> RIO env Tool
1779
+ downloadAndInstallCompiler ::
1780
+ (HasBuildConfig env , HasGHCVariant env )
1781
+ => CompilerBuild
1782
+ -> SetupInfo
1783
+ -> WantedCompiler
1784
+ -> VersionCheck
1785
+ -> Maybe String
1786
+ -> RIO env Tool
1784
1787
downloadAndInstallCompiler ghcBuild si wanted@ (WCGhc version) versionCheck mbindistURL = do
1785
1788
ghcVariant <- view ghcVariantL
1786
1789
(selectedVersion, downloadInfo) <- case mbindistURL of
1787
1790
Just bindistURL -> do
1788
1791
case ghcVariant of
1789
1792
GHCCustom _ -> pure ()
1790
1793
_ -> prettyThrowM RequireCustomGHCVariant
1791
- pure (version, GHCDownloadInfo mempty mempty DownloadInfo
1792
- { downloadInfoUrl = T. pack bindistURL
1793
- , downloadInfoContentLength = Nothing
1794
- , downloadInfoSha1 = Nothing
1795
- , downloadInfoSha256 = Nothing
1796
- })
1794
+ pure
1795
+ ( version
1796
+ , GHCDownloadInfo mempty mempty DownloadInfo
1797
+ { downloadInfoUrl = T. pack bindistURL
1798
+ , downloadInfoContentLength = Nothing
1799
+ , downloadInfoSha1 = Nothing
1800
+ , downloadInfoSha256 = Nothing
1801
+ }
1802
+ )
1797
1803
_ -> do
1798
1804
ghcKey <- getGhcKey ghcBuild
1799
1805
case Map. lookup ghcKey $ siGHCs si of
@@ -1812,8 +1818,8 @@ downloadAndInstallCompiler ghcBuild si wanted@(WCGhc version) versionCheck mbind
1812
1818
GHCStandard -> []
1813
1819
v -> [" (" <> fromString (ghcVariantName v) <> " )" ]
1814
1820
<> case ghcBuild of
1815
- CompilerBuildStandard -> []
1816
- b -> [" (" <> fromString (compilerBuildName b) <> " )" ]
1821
+ CompilerBuildStandard -> []
1822
+ b -> [" (" <> fromString (compilerBuildName b) <> " )" ]
1817
1823
<> [ flow " to an isolated location. This will not interfere with any \
1818
1824
\system-level installation."
1819
1825
]
@@ -1831,13 +1837,14 @@ downloadAndInstallCompiler _ _ WCGhcjs{} _ _ = throwIO GhcjsNotSupported
1831
1837
downloadAndInstallCompiler _ _ WCGhcGit {} _ _ =
1832
1838
prettyThrowIO DownloadAndInstallCompilerError
1833
1839
1834
- getWantedCompilerInfo :: (Ord k , MonadThrow m )
1835
- => Text
1836
- -> VersionCheck
1837
- -> WantedCompiler
1838
- -> (k -> ActualCompiler )
1839
- -> Map k a
1840
- -> m (k , a )
1840
+ getWantedCompilerInfo ::
1841
+ (Ord k , MonadThrow m )
1842
+ => Text
1843
+ -> VersionCheck
1844
+ -> WantedCompiler
1845
+ -> (k -> ActualCompiler )
1846
+ -> Map k a
1847
+ -> m (k , a )
1841
1848
getWantedCompilerInfo key versionCheck wanted toCV pairs_ =
1842
1849
case mpair of
1843
1850
Just pair -> pure pair
@@ -1856,13 +1863,13 @@ getWantedCompilerInfo key versionCheck wanted toCV pairs_ =
1856
1863
1857
1864
-- | Download and install the first available compiler build.
1858
1865
downloadAndInstallPossibleCompilers ::
1859
- (HasGHCVariant env , HasBuildConfig env )
1860
- => [CompilerBuild ]
1861
- -> SetupInfo
1862
- -> WantedCompiler
1863
- -> VersionCheck
1864
- -> Maybe String
1865
- -> RIO env (Tool , CompilerBuild )
1866
+ (HasGHCVariant env , HasBuildConfig env )
1867
+ => [CompilerBuild ]
1868
+ -> SetupInfo
1869
+ -> WantedCompiler
1870
+ -> VersionCheck
1871
+ -> Maybe String
1872
+ -> RIO env (Tool , CompilerBuild )
1866
1873
downloadAndInstallPossibleCompilers possibleCompilers si wanted versionCheck mbindistURL =
1867
1874
go possibleCompilers Nothing
1868
1875
where
@@ -1911,9 +1918,7 @@ getGhcKey ghcBuild = do
1911
1918
<> T. pack (ghcVariantSuffix ghcVariant)
1912
1919
<> T. pack (compilerBuildSuffix ghcBuild)
1913
1920
1914
- getOSKey :: (MonadThrow m )
1915
- => Platform
1916
- -> m Text
1921
+ getOSKey :: (MonadThrow m ) => Platform -> m Text
1917
1922
getOSKey platform =
1918
1923
case platform of
1919
1924
Platform I386 Cabal. Linux -> pure " linux32"
@@ -1963,8 +1968,8 @@ downloadOrUseLocal downloadLabel downloadInfo destination =
1963
1968
} = downloadInfo
1964
1969
when (isJust contentLength) $
1965
1970
prettyWarnS
1966
- " `content-length` is not checked and should not be specified when \
1967
- \`url` is a file path."
1971
+ " `content-length` is not checked and should not be specified when \
1972
+ \`url` is a file path."
1968
1973
when (isJust sha1) $
1969
1974
prettyWarnS
1970
1975
" `sha1` is not checked and should not be specified when `url` is a \
@@ -2012,14 +2017,15 @@ data ArchiveType
2012
2017
| TarGz
2013
2018
| SevenZ
2014
2019
2015
- installGHCPosix :: HasConfig env
2016
- => GHCDownloadInfo
2017
- -> SetupInfo
2018
- -> Path Abs File
2019
- -> ArchiveType
2020
- -> Path Abs Dir
2021
- -> Path Abs Dir
2022
- -> RIO env ()
2020
+ installGHCPosix ::
2021
+ HasConfig env
2022
+ => GHCDownloadInfo
2023
+ -> SetupInfo
2024
+ -> Path Abs File
2025
+ -> ArchiveType
2026
+ -> Path Abs Dir
2027
+ -> Path Abs Dir
2028
+ -> RIO env ()
2023
2029
installGHCPosix downloadInfo _ archiveFile archiveType tempDir destDir = do
2024
2030
platform <- view platformL
2025
2031
menv0 <- view processContextL
@@ -2130,27 +2136,29 @@ instance Alternative (CheckDependency env) where
2130
2136
Left _ -> y
2131
2137
Right x' -> pure $ Right x'
2132
2138
2133
- installGHCWindows :: HasBuildConfig env
2134
- => SetupInfo
2135
- -> Path Abs File
2136
- -> ArchiveType
2137
- -> Path Abs Dir
2138
- -> Path Abs Dir
2139
- -> RIO env ()
2139
+ installGHCWindows ::
2140
+ HasBuildConfig env
2141
+ => SetupInfo
2142
+ -> Path Abs File
2143
+ -> ArchiveType
2144
+ -> Path Abs Dir
2145
+ -> Path Abs Dir
2146
+ -> RIO env ()
2140
2147
installGHCWindows si archiveFile archiveType _tempDir destDir = do
2141
2148
withUnpackedTarball7z " GHC" si archiveFile archiveType destDir
2142
2149
prettyInfoL
2143
2150
[ flow " GHC installed to"
2144
2151
, pretty destDir <> " ."
2145
2152
]
2146
2153
2147
- installMsys2Windows :: HasBuildConfig env
2148
- => SetupInfo
2149
- -> Path Abs File
2150
- -> ArchiveType
2151
- -> Path Abs Dir
2152
- -> Path Abs Dir
2153
- -> RIO env ()
2154
+ installMsys2Windows ::
2155
+ HasBuildConfig env
2156
+ => SetupInfo
2157
+ -> Path Abs File
2158
+ -> ArchiveType
2159
+ -> Path Abs Dir
2160
+ -> Path Abs Dir
2161
+ -> RIO env ()
2154
2162
installMsys2Windows si archiveFile archiveType _tempDir destDir = do
2155
2163
exists <- liftIO $ D. doesDirectoryExist $ toFilePath destDir
2156
2164
when exists $
@@ -2159,10 +2167,9 @@ installMsys2Windows si archiveFile archiveType _tempDir destDir = do
2159
2167
2160
2168
withUnpackedTarball7z " MSYS2" si archiveFile archiveType destDir
2161
2169
2162
-
2163
2170
-- I couldn't find this officially documented anywhere, but you need to run
2164
- -- the MSYS shell once in order to initialize some pacman stuff. Once that
2165
- -- run happens, you can just run commands as usual.
2171
+ -- the MSYS shell once in order to initialize some pacman stuff. Once that run
2172
+ -- happens, you can just run commands as usual.
2166
2173
menv0 <- view processContextL
2167
2174
newEnv0 <- modifyEnvVars menv0 $ Map. insert " MSYSTEM" " MSYS"
2168
2175
newEnv <- either throwM pure $ augmentPathMap
@@ -2179,15 +2186,16 @@ installMsys2Windows si archiveFile archiveType _tempDir destDir = do
2179
2186
-- Install git. We could install other useful things in the future too.
2180
2187
-- runCmd (Cmd (Just destDir) "pacman" menv ["-Sy", "--noconfirm", "git"]) Nothing
2181
2188
2182
- -- | Unpack a compressed tarball using 7zip. Expects a single directory in
2183
- -- the unpacked results, which is renamed to the destination directory.
2184
- withUnpackedTarball7z :: HasBuildConfig env
2185
- => String -- ^ Name of tool, used in error messages
2186
- -> SetupInfo
2187
- -> Path Abs File -- ^ Path to archive file
2188
- -> ArchiveType
2189
- -> Path Abs Dir -- ^ Destination directory.
2190
- -> RIO env ()
2189
+ -- | Unpack a compressed tarball using 7zip. Expects a single directory in the
2190
+ -- unpacked results, which is renamed to the destination directory.
2191
+ withUnpackedTarball7z ::
2192
+ HasBuildConfig env
2193
+ => String -- ^ Name of tool, used in error messages
2194
+ -> SetupInfo
2195
+ -> Path Abs File -- ^ Path to archive file
2196
+ -> ArchiveType
2197
+ -> Path Abs Dir -- ^ Destination directory.
2198
+ -> RIO env ()
2191
2199
withUnpackedTarball7z name si archiveFile archiveType destDir = do
2192
2200
suffix <-
2193
2201
case archiveType of
@@ -2225,9 +2233,10 @@ expectSingleUnpackedDir archiveFile destDir = do
2225
2233
-- | Download 7z as necessary, and get a function for unpacking things.
2226
2234
--
2227
2235
-- Returned function takes an unpack directory and archive.
2228
- setup7z :: (HasBuildConfig env , MonadIO m )
2229
- => SetupInfo
2230
- -> RIO env (Path Abs Dir -> Path Abs File -> m () )
2236
+ setup7z ::
2237
+ (HasBuildConfig env , MonadIO m )
2238
+ => SetupInfo
2239
+ -> RIO env (Path Abs Dir -> Path Abs File -> m () )
2231
2240
setup7z si = do
2232
2241
dir <- view $ configL. to configLocalPrograms
2233
2242
ensureDir dir
@@ -2278,11 +2287,12 @@ setup7z si = do
2278
2287
liftIO $ prettyThrowM (ProblemWhileDecompressing archive)
2279
2288
_ -> prettyThrowM SetupInfoMissingSevenz
2280
2289
2281
- chattyDownload :: HasTerm env
2282
- => Text -- ^ label
2283
- -> DownloadInfo -- ^ URL, content-length, sha1, and sha256
2284
- -> Path Abs File -- ^ destination
2285
- -> RIO env ()
2290
+ chattyDownload ::
2291
+ HasTerm env
2292
+ => Text -- ^ label
2293
+ -> DownloadInfo -- ^ URL, content-length, sha1, and sha256
2294
+ -> Path Abs File -- ^ destination
2295
+ -> RIO env ()
2286
2296
chattyDownload label downloadInfo path = do
2287
2297
let url = downloadInfoUrl downloadInfo
2288
2298
req <- parseUrlThrow $ T. unpack url
@@ -2324,8 +2334,10 @@ chattyDownload label downloadInfo path = do
2324
2334
mtotalSize = downloadInfoContentLength downloadInfo
2325
2335
2326
2336
-- | Perform a basic sanity check of GHC
2327
- sanityCheck :: (HasProcessContext env , HasLogFunc env )
2328
- => Path Abs File -> RIO env ()
2337
+ sanityCheck ::
2338
+ (HasLogFunc env , HasProcessContext env )
2339
+ => Path Abs File
2340
+ -> RIO env ()
2329
2341
sanityCheck ghc = withSystemTempDir " stack-sanity-check" $ \ dir -> do
2330
2342
let fp = toFilePath $ dir </> relFileMainHs
2331
2343
liftIO $ S. writeFile fp $ T. encodeUtf8 $ T. pack $ unlines
@@ -2355,7 +2367,8 @@ removeHaskellEnvVars =
2355
2367
-- https://github.com/commercialhaskell/stack/issues/3444
2356
2368
Map. delete " GHCRTS"
2357
2369
2358
- -- | Get map of environment variables to set to change the GHC's encoding to UTF-8
2370
+ -- | Get map of environment variables to set to change the GHC's encoding to
2371
+ -- UTF-8.
2359
2372
getUtf8EnvVars ::
2360
2373
(HasPlatform env , HasProcessContext env , HasTerm env )
2361
2374
=> ActualCompiler
@@ -2505,7 +2518,7 @@ data HaskellStackOrg = HaskellStackOrg
2505
2518
deriving Show
2506
2519
2507
2520
downloadStackReleaseInfo ::
2508
- (HasPlatform env , HasLogFunc env )
2521
+ (HasLogFunc env , HasPlatform env )
2509
2522
=> Maybe String -- GitHub org
2510
2523
-> Maybe String -- GitHub repo
2511
2524
-> Maybe String -- ^ optional version
@@ -2615,8 +2628,9 @@ downloadStackReleaseInfoGitHub morg mrepo mver = liftIO $ do
2615
2628
then pure $ SRIGitHub $ getResponseBody res
2616
2629
else prettyThrowIO $ StackReleaseInfoNotFound url
2617
2630
2618
- preferredPlatforms :: (MonadReader env m , HasPlatform env , MonadThrow m )
2619
- => m [(Bool , String )]
2631
+ preferredPlatforms ::
2632
+ (MonadReader env m , HasPlatform env , MonadThrow m )
2633
+ => m [(Bool , String )]
2620
2634
preferredPlatforms = do
2621
2635
Platform arch' os' <- view platformL
2622
2636
(isWindows, os) <-
0 commit comments