From d4417fba9c5db5fbbbcaac4315c52c0a6c1af652 Mon Sep 17 00:00:00 2001 From: "Paolo G. Giarrusso" Date: Sat, 6 Aug 2016 13:48:28 +0200 Subject: [PATCH 1/2] Only use gtar on OpenBSD for xz archives (#2283) Since OpenBSD's tar does not support xz, use only `gtar` there. Stick to `tar` elsewhere. The UX is not perfect but it's already useful. --- src/Stack/Setup.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index d70b7d58be..76555d2188 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -819,10 +819,16 @@ installGHCPosix version _ archiveFile archiveType destDir = do TarBz2 -> return "bzip2" TarGz -> return "gzip" SevenZ -> error "Don't know how to deal with .7z files on non-Windows" + -- Slight hack: OpenBSD's tar doesn't support xz. + -- https://github.com/commercialhaskell/stack/issues/2283#issuecomment-237980986 + let tarDep = + case (platform, archiveType) of + (Platform _ Cabal.OpenBSD, TarXz) -> checkDependency "gtar" + _ -> checkDependency "tar" (zipTool, makeTool, tarTool) <- checkDependencies $ (,,) <$> checkDependency zipTool' <*> (checkDependency "gmake" <|> checkDependency "make") - <*> checkDependency "tar" + <*> tarDep $logDebug $ "ziptool: " <> T.pack zipTool $logDebug $ "make: " <> T.pack makeTool From 0ae54114de8c5427858c5997b64e6b7365244962 Mon Sep 17 00:00:00 2001 From: "Paolo G. Giarrusso" Date: Mon, 8 Aug 2016 18:48:16 +0200 Subject: [PATCH 2/2] stack setup: Specify decompressor to tar This supports non-GNU tar programs that do not decompress archives automatically, such as the OpenBSD one. --- src/Stack/Setup.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index 76555d2188..0b8ad69faa 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -813,11 +813,11 @@ installGHCPosix version _ archiveFile archiveType destDir = do menv0 <- getMinimalEnvOverride menv <- mkEnvOverride platform (removeHaskellEnvVars (unEnvOverride menv0)) $logDebug $ "menv = " <> T.pack (show (unEnvOverride menv)) - zipTool' <- + (zipTool', compOpt) <- case archiveType of - TarXz -> return "xz" - TarBz2 -> return "bzip2" - TarGz -> return "gzip" + TarXz -> return ("xz", 'J') + TarBz2 -> return ("bzip2", 'j') + TarGz -> return ("gzip", 'z') SevenZ -> error "Don't know how to deal with .7z files on non-Windows" -- Slight hack: OpenBSD's tar doesn't support xz. -- https://github.com/commercialhaskell/stack/issues/2283#issuecomment-237980986 @@ -842,7 +842,7 @@ installGHCPosix version _ archiveFile archiveType destDir = do $logSticky $ T.concat ["Unpacking GHC into ", T.pack . toFilePath $ root, " ..."] $logDebug $ "Unpacking " <> T.pack (toFilePath archiveFile) - readInNull root tarTool menv ["xf", toFilePath archiveFile] Nothing + readInNull root tarTool menv [compOpt : "xf", toFilePath archiveFile] Nothing $logSticky "Configuring GHC ..." readInNull dir (toFilePath $ dir $(mkRelFile "configure"))