void-packages/srcpkgs/stack/patches/fix-system-exit.patch
Jürgen Buchmüller fa54e07d7b
stack: fix build
Add naive patch to remedy deficienies of stack providing a
reproduciable build environment. The patch disambiguates
the use of exitError, exitSuccess, and exitWhat.

Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
2019-06-04 02:28:53 +02:00

147 lines
6.2 KiB
Diff

--- src/Stack/Clean.hs 2018-11-18 14:02:03.000000000 +0100
+++ src/Stack/Clean.hs 2019-06-03 19:51:07.175718943 +0200
@@ -27,7 +27,7 @@
clean :: HasEnvConfig env => CleanOpts -> RIO env ()
clean cleanOpts = do
failures <- mapM cleanDir =<< dirsToDelete cleanOpts
- when (or failures) $ liftIO exitFailure
+ when (or failures) $ liftIO System.Exit.exitFailure
where
cleanDir dir =
liftIO (ignoringAbsence (removeDirRecur dir) >> return False) `catchAny` \ex -> do
--- src/Stack/Setup.hs 2018-11-18 14:02:03.000000000 +0100
+++ src/Stack/Setup.hs 2019-06-03 23:56:53.426968944 +0200
@@ -1118,7 +1118,7 @@
"The following directories may now contain files, but won't be used by stack:" <> line <>
" -" <+> display tempDir <> line <>
" -" <+> display destDir <> line
- liftIO exitFailure
+ liftIO System.Exit.exitFailure
logSticky $
"Unpacking GHC into " <>
@@ -1310,7 +1310,7 @@
buildInGhcjsEnv envConfig $ defaultBuildOptsCLI { boptsCLITargets = bootDepsToInstall }
let failedToFindErr = do
logError "This shouldn't happen, because it gets built to the snapshot bin directory, which should be treated as being on the PATH."
- liftIO exitFailure
+ liftIO System.Exit.exitFailure
when shouldInstallCabal $ do
mcabal' <- withProcessContext menv' getCabalInstallVersion
case mcabal' of
--- src/Stack/Docker.hs 2018-11-18 14:02:03.000000000 +0100
+++ src/Stack/Docker.hs 2019-06-04 00:10:26.066037829 +0200
@@ -200,7 +200,7 @@
throwIO OnlyOnHostException
| inContainer ->
liftIO (do inner
- exitSuccess)
+ System.Exit.exitSuccess)
| not (dockerEnable (configDocker config)) ->
do fromMaybeAction mbefore
liftIO inner
@@ -205,7 +205,7 @@
do fromMaybeAction mbefore
liftIO inner
fromMaybeAction mafter
- liftIO exitSuccess
+ liftIO System.Exit.exitSuccess
| otherwise ->
do fromMaybeAction mrelease
runContainerAndExit
@@ -376,7 +376,7 @@
#endif
)
case e of
- Left (ProcessExitedUnsuccessfully _ ec) -> liftIO (exitWith ec)
+ Left (ProcessExitedUnsuccessfully _ ec) -> liftIO (System.Exit.exitWith ec)
Right () -> do after
liftIO System.Exit.exitSuccess
where
@@ -378,7 +378,7 @@
case e of
Left (ProcessExitedUnsuccessfully _ ec) -> liftIO (exitWith ec)
Right () -> do after
- liftIO exitSuccess
+ liftIO System.Exit.exitSuccess
where
-- This is using a hash of the Docker repository (without tag or digest) to ensure
-- binaries/libraries aren't shared between Docker and host (or incompatible Docker images)
--- src/Stack/Hoogle.hs 2018-11-18 14:02:03.000000000 +0100
+++ src/Stack/Hoogle.hs 2019-06-04 01:16:35.000374265 +0200
@@ -150,7 +150,7 @@
(hoogleArgs ++ databaseArg)
runProcess_
bail :: RIO EnvConfig a
- bail = liftIO (exitWith (ExitFailure (-1)))
+ bail = liftIO (System.Exit.exitWith (ExitFailure (-1)))
checkDatabaseExists = do
path <- hoogleDatabasePath
liftIO (doesFileExist path)
--- src/main/Main.hs 2018-11-18 14:02:03.000000000 +0100
+++ src/main/Main.hs 2019-06-04 01:37:16.148479474 +0200
@@ -203,10 +203,10 @@
-- This special handler stops "stack: " from being printed before the
-- exception
case fromException e of
- Just ec -> exitWith ec
+ Just ec -> System.Exit.exitWith ec
Nothing -> do
hPrint stderr e
- exitFailure
+ System.Exit.exitFailure
-- Vertically combine only the error component of the first argument with the
-- error component of the second.
@@ -638,7 +638,7 @@
hPutStrLn stderr "Error: When building with stack, you should not use the -prof GHC option"
hPutStrLn stderr "Instead, please use --library-profiling and --executable-profiling"
hPutStrLn stderr "See: https://github.com/commercialhaskell/stack/issues/1015"
- exitFailure
+ System.Exit.exitFailure
case boptsCLIFileWatch opts of
FileWatchPoll -> fileWatchPoll stderr inner
FileWatch -> fileWatch stderr inner
@@ -710,13 +710,13 @@
, flow "Can't find:"
, line <> invalidList
]
- liftIO exitFailure
+ liftIO System.Exit.exitFailure
when (null files && null dirs) $ do
prettyErrorL
[ styleShell "stack upload"
, flow "expects a list of sdist tarballs or package directories, but none were specified."
]
- liftIO exitFailure
+ liftIO System.Exit.exitFailure
config <- view configL
let hackageUrl = T.unpack $ configHackageBaseUrl config
getCreds <- liftIO (runOnce (Upload.loadCreds config))
@@ -768,7 +768,7 @@
, display stackYaml
, flow "contains no packages, so no sdist tarballs will be generated."
]
- liftIO exitFailure
+ liftIO System.Exit.exitFailure
return dirs
else mapM resolveDir' (sdoptsDirsToWorkWith sdistOpts)
forM_ dirs' $ \dir -> do
@@ -848,7 +848,7 @@
-- should never happen as we have already installed the packages
_ -> liftIO $ do
hPutStrLn stderr ("Could not find package id of package " ++ name)
- exitFailure
+ System.Exit.exitFailure
getPkgOpts wc pkgs =
map ("-package-id=" ++) <$> mapM (getPkgId wc) pkgs
@@ -869,7 +869,7 @@
return (T.unpack exe', args')
_ -> do
logError "No executables found."
- liftIO exitFailure
+ liftIO System.Exit.exitFailure
getGhcCmd prefix pkgs args = do
wc <- view $ actualCompilerVersionL.whichCompilerL