From 146ac38549e767d92de15b3f2d118c8f729d05b3 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 12 Jul 2020 16:48:25 +0200 Subject: [PATCH 1/8] Add 8.10.1 freebsd bindist --- ghcup-0.0.2.json | 7 +++++++ lib/GHCup/Data/GHCupDownloads.hs | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ghcup-0.0.2.json b/ghcup-0.0.2.json index f3245cb..63ee310 100644 --- a/ghcup-0.0.2.json +++ b/ghcup-0.0.2.json @@ -698,6 +698,13 @@ "dlUri": "https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-x86_64-alpine3.10-linux-integer-simple.tar.xz" } }, + "FreeBSD": { + "unknown_versioning": { + "dlHash": "52d27dbf9de82005dde9bfc521bff612e381b5228af194259c2306d2b75825c2", + "dlSubdir": "ghc-8.10.1", + "dlUri": "https://downloads.haskell.org/ghc/8.10.1/ghc-8.10.1-x86_64-portbld-freebsd.tar.xz" + } + }, "Linux_Debian": { "unknown_versioning": { "dlHash": "d1cf7886f27af070f3b7dbe1975a78b43ef2d32b86362cbe953e79464fe70761", diff --git a/lib/GHCup/Data/GHCupDownloads.hs b/lib/GHCup/Data/GHCupDownloads.hs index dd2e2fc..230989f 100644 --- a/lib/GHCup/Data/GHCupDownloads.hs +++ b/lib/GHCup/Data/GHCupDownloads.hs @@ -2,7 +2,10 @@ {-# LANGUAGE QuasiQuotes #-} -module GHCup.Data.GHCupDownloads where +module GHCup.Data.GHCupDownloads + ( ghcupDownloads + ) +where import GHCup.Types import GHCup.Utils.Version.QQ @@ -887,6 +890,11 @@ ghc_8101_64_alpine = DownloadInfo "cb13b645d103e2fba2eb8dfcc4e5f2fbd9550c00c4df42f342b4210436dcb8a8" +ghc_8101_64_freebsd :: DownloadInfo +ghc_8101_64_freebsd = DownloadInfo + [uri|https://downloads.haskell.org/ghc/8.10.1/ghc-8.10.1-x86_64-portbld-freebsd.tar.xz|] + (Just [rel|ghc-8.10.1|]) + "52d27dbf9de82005dde9bfc521bff612e381b5228af194259c2306d2b75825c2" @@ -1840,7 +1848,7 @@ ghcupDownloads = M.fromList , (Just [vers|7|], ghc_8101_64_centos) ] ) - , ( Linux RedHat, M.fromList [(Nothing, ghc_8101_64_centos)]) + , (Linux RedHat, M.fromList [(Nothing, ghc_8101_64_centos)]) , ( Linux AmazonLinux , M.fromList [(Nothing, ghc_8101_64_centos)] ) @@ -1861,6 +1869,7 @@ ghcupDownloads = M.fromList ) , (Darwin , M.fromList [(Nothing, ghc_8101_64_darwin)]) , (Linux Alpine, M.fromList [(Nothing, ghc_8101_64_alpine)]) + , (FreeBSD , M.fromList [(Nothing, ghc_8101_64_freebsd)]) ] ) , ( A_32 From 531b82a40665268a0962e7eb3d9469add9694722 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 12 Jul 2020 21:14:51 +0200 Subject: [PATCH 2/8] Add ghc-8.8.3 freebsd bindist --- ghcup-0.0.2.json | 7 +++++++ lib/GHCup/Data/GHCupDownloads.hs | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/ghcup-0.0.2.json b/ghcup-0.0.2.json index 63ee310..f5e1392 100644 --- a/ghcup-0.0.2.json +++ b/ghcup-0.0.2.json @@ -2009,6 +2009,13 @@ "dlUri": "https://github.com/redneb/ghc-alt-libc/releases/download/ghc-8.8.3-musl/ghc-8.8.3-x86_64-unknown-linux-musl.tar.xz" } }, + "FreeBSD": { + "unknown_versioning": { + "dlHash": "569719075b4d14b3875a899df522090ae31e6fe085e6dffe518e875b09a2f0be", + "dlSubdir": "ghc-8.8.3", + "dlUri": "https://files.hasufell.de/ghc/ghc-8.8.3-x86_64-portbld-freebsd.tar.xz" + } + }, "Linux_Debian": { "unknown_versioning": { "dlHash": "42fde2ef5a143e1e6b47ae8875162ea2d4d54b06f0f7fa32ee4f0eb86f2be7ad", diff --git a/lib/GHCup/Data/GHCupDownloads.hs b/lib/GHCup/Data/GHCupDownloads.hs index 230989f..58c1cbd 100644 --- a/lib/GHCup/Data/GHCupDownloads.hs +++ b/lib/GHCup/Data/GHCupDownloads.hs @@ -832,6 +832,11 @@ ghc_883_32_musl = DownloadInfo (Just [rel|ghc-8.8.3|]) "7a5f41646d06777e75636291a1855d60a0984552bbdf33c3d107565d302f38a4" +ghc_883_64_freebsd :: DownloadInfo +ghc_883_64_freebsd = DownloadInfo + [uri|https://files.hasufell.de/ghc/ghc-8.8.3-x86_64-portbld-freebsd.tar.xz|] + (Just [rel|ghc-8.8.3|]) + "569719075b4d14b3875a899df522090ae31e6fe085e6dffe518e875b09a2f0be" @@ -1804,6 +1809,7 @@ ghcupDownloads = M.fromList ) , (Darwin , M.fromList [(Nothing, ghc_883_64_darwin)]) , (Linux Alpine, M.fromList [(Nothing, ghc_883_64_musl)]) + , (FreeBSD , M.fromList [(Nothing, ghc_883_64_freebsd)]) ] ) , ( A_32 From 7e7c357e47b4eafe631c383e2a78e32bdc691b7c Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 12 Jul 2020 21:39:08 +0200 Subject: [PATCH 3/8] Fix freebsd CI --- .gitlab/before_script/freebsd/install_deps.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.gitlab/before_script/freebsd/install_deps.sh b/.gitlab/before_script/freebsd/install_deps.sh index 1d8c6b0..d628f3f 100755 --- a/.gitlab/before_script/freebsd/install_deps.sh +++ b/.gitlab/before_script/freebsd/install_deps.sh @@ -11,15 +11,8 @@ mkdir -p "${TMPDIR}" curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-portbld-freebsd-ghcup > ./ghcup-bin chmod +x ghcup-bin -mkdir -p "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin -# ./ghcup-bin install ${GHC_VERSION} -# ./ghcup-bin install-cabal ${CABAL_VERSION} -# ./ghcup-bin set ${GHC_VERSION} - -# install cabal-3.2.0.0 -curl -sSfL -o cabal-install-3.2.0.0-x86_64-portbld-freebsd.tar.xz 'https://hasufell.de/d/d3e215db133e4fcaa61e/files/?p=/cabal-install-3.2.0.0-x86_64-portbld-freebsd.tar.xz&dl=1' -tar xf cabal-install-3.2.0.0-x86_64-portbld-freebsd.tar.xz -cp cabal "${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin/cabal" -chmod +x "${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin/cabal" +./ghcup-bin install ${GHC_VERSION} +./ghcup-bin install-cabal ${CABAL_VERSION} +./ghcup-bin set ${GHC_VERSION} exit 0 From 50424c28017c0eb9304888e8cfde12fe4342816f Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 12 Jul 2020 22:29:50 +0200 Subject: [PATCH 4/8] Allow to build with tar-bytestring on e.g. 32bit --- .gitlab/script/ghcup_release.sh | 2 +- app/ghcup/BrickMain.hs | 21 ++++++++++++++++++++- app/ghcup/Main.hs | 8 ++++++++ ghcup.cabal | 26 +++++++++++++++++++++++--- lib/GHCup.hs | 10 ++++++++++ lib/GHCup/Utils.hs | 22 +++++++++++++++++++++- 6 files changed, 83 insertions(+), 6 deletions(-) diff --git a/.gitlab/script/ghcup_release.sh b/.gitlab/script/ghcup_release.sh index 402fbe4..da0d839 100755 --- a/.gitlab/script/ghcup_release.sh +++ b/.gitlab/script/ghcup_release.sh @@ -17,7 +17,7 @@ ecabal update if [ "${OS}" = "LINUX" ] ; then if [ "${BIT}" = "32" ] ; then - ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' + ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui -ftar else ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui fi diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index 7a6ab8a..a8d8840 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TypeApplications #-} @@ -19,7 +20,9 @@ import Brick.Widgets.Border import Brick.Widgets.Border.Style import Brick.Widgets.Center import Brick.Widgets.List +#if !defined(TAR) import Codec.Archive +#endif import Control.Exception.Safe import Control.Monad.Logger import Control.Monad.Reader @@ -196,7 +199,23 @@ install' AppState {..} (_, ListResult {..}) = do . flip runReaderT settings . runResourceT . runE - @'[AlreadyInstalled, UnknownArchive, ArchiveResult, DistroNotFound, FileDoesNotExistError, CopyError, NoCompatibleArch, NoDownload, NotInstalled, NoCompatiblePlatform, BuildFailed, TagNotFound, DigestError, DownloadFailed, NoUpdate] + @'[AlreadyInstalled + , UnknownArchive +#if !defined(TAR) + , ArchiveResult +#endif + , DistroNotFound + , FileDoesNotExistError + , CopyError + , NoCompatibleArch + , NoDownload + , NotInstalled + , NoCompatiblePlatform + , BuildFailed + , TagNotFound + , DigestError + , DownloadFailed + , NoUpdate] (run $ do case lTool of diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index 1206013..68d73fb 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -28,7 +28,9 @@ import GHCup.Utils.Prelude import GHCup.Utils.String.QQ import GHCup.Version +#if !defined(TAR) import Codec.Archive +#endif import Control.Exception.Safe #if !MIN_VERSION_base(4,13,0) import Control.Monad.Fail ( MonadFail ) @@ -909,7 +911,9 @@ Report bugs at |] . runE @'[ AlreadyInstalled , UnknownArchive +#if !defined(TAR) , ArchiveResult +#endif , DistroNotFound , FileDoesNotExistError , CopyError @@ -969,7 +973,9 @@ Report bugs at |] , NotFoundInPATH , PatchFailed , UnknownArchive +#if !defined(TAR) , ArchiveResult +#endif ] let runCompileCabal = @@ -989,7 +995,9 @@ Report bugs at |] , NotInstalled , PatchFailed , UnknownArchive +#if !defined(TAR) , ArchiveResult +#endif ] let runUpgrade = diff --git a/ghcup.cabal b/ghcup.cabal index 0b890a9..5e18790 100644 --- a/ghcup.cabal +++ b/ghcup.cabal @@ -31,6 +31,11 @@ flag internal-downloader default: False manual: True +flag tar + description: Use tar-bytestring instead of libarchive + default: False + manual: True + common HsOpenSSL build-depends: HsOpenSSL >=0.11.4.18 @@ -169,6 +174,9 @@ common table-layout common template-haskell build-depends: template-haskell >=2.7 +common tar-bytestring + build-depends: tar-bytestring >=0.6.3.1 + common terminal-progress-bar build-depends: terminal-progress-bar >=0.4.1 @@ -253,7 +261,6 @@ library , hpath-filepath , hpath-io , hpath-posix - , libarchive , lzma , megaparsec , monad-logger @@ -315,13 +322,21 @@ library if flag(internal-downloader) import: - , HsOpenSSL + HsOpenSSL , http-io-streams , io-streams , terminal-progress-bar exposed-modules: GHCup.Download.IOStreams cpp-options: -DINTERNAL_DOWNLOADER + if flag(tar) + import: + tar-bytestring + cpp-options: -DTAR + else + import: + libarchive + executable ghcup import: config @@ -331,7 +346,6 @@ executable ghcup , haskus-utils-variant , hpath , hpath-io - , libarchive , megaparsec , monad-logger , mtl @@ -368,6 +382,12 @@ executable ghcup other-modules: BrickMain cpp-options: -DBRICK + if flag(tar) + cpp-options: -DTAR + else + import: + libarchive + executable ghcup-gen import: config diff --git a/lib/GHCup.hs b/lib/GHCup.hs index 3e46466..80d46ea 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -27,7 +27,9 @@ import GHCup.Utils.String.QQ import GHCup.Utils.Version.QQ import GHCup.Version +#if !defined(TAR) import Codec.Archive ( ArchiveResult ) +#endif import Control.Applicative import Control.Exception.Safe import Control.Monad @@ -97,7 +99,9 @@ installGHCBin :: ( MonadFail m , NoDownload , NotInstalled , UnknownArchive +#if !defined(TAR) , ArchiveResult +#endif ] m () @@ -167,7 +171,9 @@ installCabalBin :: ( MonadMask m , NoDownload , NotInstalled , UnknownArchive +#if !defined(TAR) , ArchiveResult +#endif ] m () @@ -613,7 +619,9 @@ compileGHC :: ( MonadMask m , NotFoundInPATH , PatchFailed , UnknownArchive +#if !defined(TAR) , ArchiveResult +#endif ] m () @@ -792,7 +800,9 @@ compileCabal :: ( MonadReader Settings m , NotInstalled , PatchFailed , UnknownArchive +#if !defined(TAR) , ArchiveResult +#endif ] m () diff --git a/lib/GHCup/Utils.hs b/lib/GHCup/Utils.hs index cabea40..e137b63 100644 --- a/lib/GHCup/Utils.hs +++ b/lib/GHCup/Utils.hs @@ -24,7 +24,9 @@ import GHCup.Utils.MegaParsec import GHCup.Utils.Prelude import GHCup.Utils.String.QQ +#if !defined(TAR) import Codec.Archive +#endif import Control.Applicative import Control.Exception.Safe import Control.Monad @@ -59,13 +61,18 @@ import System.Posix.Files.ByteString ( readSymbolicLink ) import Text.Regex.Posix import URI.ByteString +#if defined(TAR) +import qualified Codec.Archive.Tar as Tar +#endif import qualified Codec.Compression.BZip as BZip import qualified Codec.Compression.GZip as GZip import qualified Codec.Compression.Lzma as Lzma import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import qualified Data.Map.Strict as Map +#if !defined(TAR) import qualified Data.Text as T +#endif import qualified Data.Text.Encoding as E import qualified Text.Megaparsec as MP @@ -312,17 +319,30 @@ getLatestGHCFor major' minor' dls = do unpackToDir :: (MonadLogger m, MonadIO m, MonadThrow m) => Path Abs -- ^ destination dir -> Path Abs -- ^ archive path - -> Excepts '[UnknownArchive, ArchiveResult] m () + -> Excepts '[UnknownArchive +#if !defined(TAR) + , ArchiveResult +#endif + ] m () unpackToDir dest av = do fp <- (decUTF8Safe . toFilePath) <$> basename av let dfp = decUTF8Safe . toFilePath $ dest lift $ $(logInfo) [i|Unpacking: #{fp} to #{dfp}|] fn <- toFilePath <$> basename av +#if defined(TAR) + let untar :: MonadIO m => BL.ByteString -> Excepts '[] m () + untar = liftIO . Tar.unpack (toFilePath dest) . Tar.read +#else let untar :: MonadIO m => BL.ByteString -> Excepts '[ArchiveResult] m () untar = lEM . liftIO . runArchiveM . unpackToDirLazy (T.unpack . decUTF8Safe . toFilePath $ dest) +#endif +#if defined(TAR) + rf :: MonadIO m => Path Abs -> Excepts '[] m BL.ByteString +#else rf :: MonadIO m => Path Abs -> Excepts '[ArchiveResult] m BL.ByteString +#endif rf = liftIO . readFile -- extract, depending on file extension From 30b4d399b96d6a4bb128a973b8c644a1d4034ae6 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Mon, 13 Jul 2020 00:40:00 +0200 Subject: [PATCH 5/8] Add -ftui to travis build --- .travis/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/build.sh b/.travis/build.sh index 0d12d2c..f213b0e 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -18,7 +18,7 @@ ghcup set 8.8.3 ## install ghcup cabal update -cabal build --constraint="zlib static" --constraint="lzma static" +cabal build --constraint="zlib static" --constraint="lzma static" -ftui cp "$(cabal new-exec --verbose=0 --offline sh -- -c 'command -v ghcup')" . strip -s ghcup cp ghcup "./${ARTIFACT}" From 1a64527e148aa4a906721cd59fece7f06de39323 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Mon, 13 Jul 2020 11:52:34 +0200 Subject: [PATCH 6/8] Improve verbosity --- app/ghcup-gen/Validate.hs | 2 +- app/ghcup/BrickMain.hs | 1 + app/ghcup/Main.hs | 1 + lib/GHCup.hs | 20 +++++++-------- lib/GHCup/Types.hs | 1 + lib/GHCup/Utils.hs | 9 ++++--- lib/GHCup/Utils/File.hs | 51 ++++++++++++++++++++++++++------------- 7 files changed, 54 insertions(+), 31 deletions(-) diff --git a/app/ghcup-gen/Validate.hs b/app/ghcup-gen/Validate.hs index a06fc74..bd1ee0e 100644 --- a/app/ghcup-gen/Validate.hs +++ b/app/ghcup-gen/Validate.hs @@ -179,7 +179,7 @@ validateTarballs dls = do where downloadAll dli = do - let settings = Settings True False Never Curl + let settings = Settings True False Never Curl False let runLogger = myLoggerT LoggerConfig { lcPrintDebug = True , colorOutter = B.hPut stderr , rawOutter = (\_ -> pure ()) diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index a8d8840..f47fd64 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -299,6 +299,7 @@ settings' = unsafePerformIO , noVerify = False , keepDirs = Never , downloader = Curl + , verbose = False } ) diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index 68d73fb..c03cc8d 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -808,6 +808,7 @@ toSettings Options {..} = noVerify = optNoVerify keepDirs = optKeepDirs downloader = optsDownloader + verbose = optVerbose in Settings { .. } diff --git a/lib/GHCup.hs b/lib/GHCup.hs index 80d46ea..e9e7bad 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -133,19 +133,19 @@ installGHCBin bDls ver mpfReq = do where -- | Install an unpacked GHC distribution. This only deals with the GHC build system and nothing else. - installGHC' :: (MonadLogger m, MonadIO m) + installGHC' :: (MonadReader Settings m, MonadThrow m, MonadLogger m, MonadIO m) => Path Abs -- ^ Path to the unpacked GHC bindist (where the configure script resides) -> Path Abs -- ^ Path to install to -> Excepts '[ProcessError] m () installGHC' path inst = do lift $ $(logInfo) "Installing GHC (this may take a while)" - lEM $ liftIO $ execLogged "./configure" + lEM $ execLogged "./configure" False ["--prefix=" <> toFilePath inst] [rel|ghc-configure|] (Just path) Nothing - lEM $ liftIO $ make ["install"] (Just path) + lEM $ make ["install"] (Just path) pure () @@ -672,7 +672,7 @@ BUILD_SPHINX_PDF = NO HADDOCK_DOCS = NO Stage1Only = YES|] - compile :: (MonadCatch m, MonadLogger m, MonadIO m) + compile :: (MonadReader Settings m, MonadThrow m, MonadCatch m, MonadLogger m, MonadIO m) => Either (Path Rel) (Path Abs) -> Path Abs -> Path Abs @@ -700,7 +700,7 @@ Stage1Only = YES|] Left bver -> do spaths <- catMaybes . fmap parseAbs <$> liftIO getSearchPath (liftIO $ searchPath spaths bver) !? NotFoundInPATH bver - lEM $ liftIO $ execLogged + lEM $ execLogged "./configure" False ( ["--prefix=" <> toFilePath ghcdir] @@ -714,7 +714,7 @@ Stage1Only = YES|] (Just workdir) (Just (("GHC", toFilePath bghcPath) : cEnv)) | otherwise -> do - lEM $ liftIO $ execLogged + lEM $ execLogged "./configure" False ( [ "--prefix=" <> toFilePath ghcdir @@ -739,11 +739,11 @@ Stage1Only = YES|] liftIO $ writeFile (build_mk workdir) (Just newFilePerms) defaultConf lift $ $(logInfo) [i|Building (this may take a while)...|] - lEM $ liftIO $ make (maybe [] (\j -> ["-j" <> fS (show j)]) jobs) + lEM $ make (maybe [] (\j -> ["-j" <> fS (show j)]) jobs) (Just workdir) lift $ $(logInfo) [i|Installing...|] - lEM $ liftIO $ make ["install"] (Just workdir) + lEM $ make ["install"] (Just workdir) markSrcBuilt ghcdir workdir = do let dest = (ghcdir ghcUpSrcBuiltFile) @@ -848,7 +848,7 @@ compileCabal dls tver bghc jobs patchdir = do pure () where - compile :: (MonadThrow m, MonadLogger m, MonadIO m, MonadResource m) + compile :: (MonadReader Settings m, MonadThrow m, MonadLogger m, MonadIO m, MonadResource m) => Path Abs -> Excepts '[ProcessError , PatchFailed] m (Path Abs) compile workdir = do @@ -881,7 +881,7 @@ compileCabal dls tver bghc jobs patchdir = do newEnv <- lift $ addToCurrentEnv (("PREFIX", toFilePath tmp) : ghcEnv) lift $ $(logDebug) [i|Environment: #{newEnv}|] - lEM $ liftIO $ execLogged "./bootstrap.sh" + lEM $ execLogged "./bootstrap.sh" False (maybe [] (\j -> ["-j", fS (show j)]) jobs) [rel|cabal-bootstrap|] diff --git a/lib/GHCup/Types.hs b/lib/GHCup/Types.hs index 5fda585..5e2a7b2 100644 --- a/lib/GHCup/Types.hs +++ b/lib/GHCup/Types.hs @@ -152,6 +152,7 @@ data Settings = Settings , noVerify :: Bool , keepDirs :: KeepDirs , downloader :: Downloader + , verbose :: Bool } deriving Show diff --git a/lib/GHCup/Utils.hs b/lib/GHCup/Utils.hs index e137b63..8a9f5f3 100644 --- a/lib/GHCup/Utils.hs +++ b/lib/GHCup/Utils.hs @@ -473,10 +473,13 @@ ghcUpSrcBuiltFile = [rel|.ghcup_src_built|] -- | Calls gmake if it exists in PATH, otherwise make. -make :: [ByteString] -> Maybe (Path Abs) -> IO (Either ProcessError ()) +make :: (MonadThrow m, MonadIO m, MonadReader Settings m) + => [ByteString] + -> Maybe (Path Abs) + -> m (Either ProcessError ()) make args workdir = do - spaths <- catMaybes . fmap parseAbs <$> getSearchPath - has_gmake <- isJust <$> searchPath spaths [rel|gmake|] + spaths <- catMaybes . fmap parseAbs <$> (liftIO getSearchPath) + has_gmake <- isJust <$> (liftIO $ searchPath spaths [rel|gmake|]) let mymake = if has_gmake then "gmake" else "make" execLogged mymake True args [rel|ghc-make|] workdir Nothing diff --git a/lib/GHCup/Utils/File.hs b/lib/GHCup/Utils/File.hs index 52a8c3e..90f2b28 100644 --- a/lib/GHCup/Utils/File.hs +++ b/lib/GHCup/Utils/File.hs @@ -1,16 +1,19 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TemplateHaskell #-} module GHCup.Utils.File where import GHCup.Utils.Dirs import GHCup.Utils.Prelude +import GHCup.Types import Control.Concurrent import Control.Exception ( evaluate ) import Control.Exception.Safe import Control.Monad +import Control.Monad.Reader import Data.ByteString ( ByteString ) import Data.Foldable import Data.Functor @@ -101,19 +104,21 @@ executeOut path args chdir = captureOutStreams $ do SPPB.executeFile (toFilePath path) True args Nothing -execLogged :: ByteString -- ^ thing to execute +execLogged :: (MonadReader Settings m, MonadIO m, MonadThrow m) + => ByteString -- ^ thing to execute -> Bool -- ^ whether to search PATH for the thing -> [ByteString] -- ^ args for the thing -> Path Rel -- ^ log filename -> Maybe (Path Abs) -- ^ optionally chdir into this -> Maybe [(ByteString, ByteString)] -- ^ optional environment - -> IO (Either ProcessError ()) + -> m (Either ProcessError ()) execLogged exe spath args lfile chdir env = do - ldir <- ghcupLogsDir + Settings{..} <- ask + ldir <- liftIO ghcupLogsDir logfile <- (ldir ) <$> parseRel (toFilePath lfile <> ".log") - bracket (createFile (toFilePath logfile) newFilePerms) closeFd action + liftIO $ bracket (createFile (toFilePath logfile) newFilePerms) closeFd (action verbose) where - action fd = do + action verbose fd = do actionWithPipes $ \(stdoutRead, stdoutWrite) -> do -- start the thread that logs to stdout in a region done <- newEmptyMVar @@ -122,7 +127,7 @@ execLogged exe spath args lfile chdir env = do $ EX.handle (\(_ :: StopThread) -> pure ()) $ EX.handle (\(_ :: IOException) -> pure ()) $ flip finally (putMVar done ()) - $ printToRegion fd stdoutRead 6 + $ (if verbose then tee fd stdoutRead else printToRegion fd stdoutRead 6) -- fork our subprocess pid <- SPPB.forkProcess $ do @@ -151,6 +156,17 @@ execLogged exe spath args lfile chdir env = do closeFd stdoutRead pure e + tee fileFd fdIn = do + flip finally (readTilEOF lineAction fdIn) -- make sure the last few lines don't get cut off + $ do + hideError eofErrorType $ readTilEOF lineAction fdIn + forever (threadDelay 5000) + + where + lineAction bs' = do + void $ SPIB.fdWrite fileFd (bs' <> "\n") + void $ SPIB.fdWrite stdOutput (bs' <> "\n") + -- Reads fdIn and logs the output in a continous scrolling area -- of 'size' terminal lines. Also writes to a log file. printToRegion fileFd fdIn size = do @@ -170,6 +186,7 @@ execLogged exe spath args lfile chdir env = do where -- action to perform line by line + -- TODO: do this with vty for efficiency lineAction ref rs bs' = do modifyIORef' ref (swapRegs bs') regs <- readIORef ref @@ -193,18 +210,18 @@ execLogged exe spath args lfile chdir env = do trim w bs | BS.length bs > w && w > 5 = BS.take (w - 4) bs <> "..." | otherwise = bs - -- read an entire line from the file descriptor (removes the newline char) - readLine fd' = do - bs <- SPIB.fdRead fd' 1 - if - | bs == "\n" -> pure "" - | bs == "" -> pure "" - | otherwise -> fmap (bs <>) $ readLine fd' + -- read an entire line from the file descriptor (removes the newline char) + readLine fd' = do + bs <- SPIB.fdRead fd' 1 + if + | bs == "\n" -> pure "" + | bs == "" -> pure "" + | otherwise -> fmap (bs <>) $ readLine fd' - readTilEOF action' fd' = do - bs <- readLine fd' - void $ action' bs - readTilEOF action' fd' + readTilEOF action' fd' = do + bs <- readLine fd' + void $ action' bs + readTilEOF action' fd' -- | Capture the stdout and stderr of the given action, which From ef8e3bd94001777942cd93f422e5cf352f42bdd1 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Mon, 13 Jul 2020 18:27:21 +0200 Subject: [PATCH 7/8] Reduce number of os/dl lookups --- app/ghcup/BrickMain.hs | 32 ++++++++--------- app/ghcup/Main.hs | 82 +++++++++++++++++------------------------- lib/GHCup.hs | 64 +++++++++++---------------------- 3 files changed, 68 insertions(+), 110 deletions(-) diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index f47fd64..307f353 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -50,6 +50,7 @@ import qualified Data.Vector as V data AppState = AppState { lr :: LR , dls :: GHCupDownloads + , pfreq :: PlatformRequest } type LR = GenericList String Vector ListResult @@ -154,9 +155,9 @@ eventHandler st (VtyEvent (Vty.EvResize _ _)) = continue st eventHandler st (VtyEvent (Vty.EvKey (Vty.KChar 'q') _)) = halt st eventHandler st (VtyEvent (Vty.EvKey Vty.KEsc _)) = halt st eventHandler AppState {..} (VtyEvent (Vty.EvKey (Vty.KUp) _)) = - continue (AppState (listMoveUp lr) dls) + continue (AppState (listMoveUp lr) dls pfreq) eventHandler AppState {..} (VtyEvent (Vty.EvKey (Vty.KDown) _)) = - continue (AppState (listMoveDown lr) dls) + continue (AppState (listMoveDown lr) dls pfreq) eventHandler as (VtyEvent (Vty.EvKey (Vty.KChar c) _)) = case find (\(c', _, _) -> c' == c) keyHandlers of Nothing -> continue as @@ -178,7 +179,7 @@ withIOAction action as = case listSelectedElement (lr as) of Right _ -> do apps <- (fmap . fmap) (\AppState {..} -> AppState { lr = listMoveTo ix lr, .. }) - getAppState + $ getAppState Nothing (pfreq as) case apps of Right nas -> do putStrLn "Press enter to continue" @@ -219,9 +220,9 @@ install' AppState {..} (_, ListResult {..}) = do (run $ do case lTool of - GHC -> liftE $ installGHCBin dls lVer Nothing - Cabal -> liftE $ installCabalBin dls lVer Nothing - GHCup -> liftE $ upgradeGHCup dls Nothing False $> () + GHC -> liftE $ installGHCBin dls lVer pfreq + Cabal -> liftE $ installCabalBin dls lVer pfreq + GHCup -> liftE $ upgradeGHCup dls Nothing False pfreq $> () ) >>= \case VRight _ -> pure $ Right () @@ -314,15 +315,15 @@ logger' = unsafePerformIO ) -brickMain :: Settings -> Maybe URI -> LoggerConfig -> IO () -brickMain s muri l = do +brickMain :: Settings -> Maybe URI -> LoggerConfig -> GHCupDownloads -> PlatformRequest -> IO () +brickMain s muri l av pfreq' = do writeIORef uri' muri writeIORef settings' s -- logger interpreter writeIORef logger' l let runLogger = myLoggerT l - eApps <- getAppState + eApps <- getAppState (Just av) pfreq' case eApps of Right as -> defaultMain app (selectLatest as) $> () Left e -> do @@ -337,8 +338,8 @@ brickMain s muri l = do $ (listElements lr) -getAppState :: IO (Either String AppState) -getAppState = do +getAppState :: Maybe GHCupDownloads -> PlatformRequest -> IO (Either String AppState) +getAppState mg pfreq' = do muri <- readIORef uri' settings <- readIORef settings' l <- readIORef logger' @@ -348,13 +349,12 @@ getAppState = do runLogger . flip runReaderT settings . runE - @'[JSONError, DownloadFailed, FileDoesNotExistError, NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] + @'[JSONError, DownloadFailed, FileDoesNotExistError] $ do - (GHCupInfo _ dls) <- liftE - $ getDownloadsF (maybe GHCupURL OwnSource muri) + dls <- maybe (fmap _ghcupDownloads $ liftE $ getDownloadsF (maybe GHCupURL OwnSource muri)) pure mg - lV <- liftE $ listVersions dls Nothing Nothing - pure $ (AppState (list "Tool versions" (V.fromList lV) 1) dls) + lV <- lift $ listVersions dls Nothing Nothing pfreq' + pure $ (AppState (list "Tool versions" (V.fromList lV) 1) dls pfreq') case r of VRight a -> pure $ Right a diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index c03cc8d..0d5a3af 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -915,13 +915,10 @@ Report bugs at |] #if !defined(TAR) , ArchiveResult #endif - , DistroNotFound , FileDoesNotExistError , CopyError - , NoCompatibleArch , NoDownload , NotInstalled - , NoCompatiblePlatform , BuildFailed , TagNotFound , DigestError @@ -946,7 +943,7 @@ Report bugs at |] , TagNotFound ] - let runListGHC = runLogger . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] + let runListGHC = runLogger let runRm = runLogger . flip runReaderT settings . runE @'[NotInstalled] @@ -965,11 +962,8 @@ Report bugs at |] @'[ AlreadyInstalled , BuildFailed , DigestError - , DistroNotFound , DownloadFailed , GHCupSetError - , NoCompatibleArch - , NoCompatiblePlatform , NoDownload , NotFoundInPATH , PatchFailed @@ -988,10 +982,7 @@ Report bugs at |] , BuildFailed , CopyError , DigestError - , DistroNotFound , DownloadFailed - , NoCompatibleArch - , NoCompatiblePlatform , NoDownload , NotInstalled , PatchFailed @@ -1007,9 +998,6 @@ Report bugs at |] . runResourceT . runE @'[ DigestError - , DistroNotFound - , NoCompatiblePlatform - , NoCompatibleArch , NoDownload , NoUpdate , FileDoesNotExistError @@ -1018,9 +1006,19 @@ Report bugs at |] ] - --------------------------- - -- Getting download info -- - --------------------------- + ---------------------------------------- + -- Getting download and platform info -- + ---------------------------------------- + + pfreq <- ( + runLogger . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] . liftE $ platformRequest + ) >>= \case + VRight r -> pure r + VLeft e -> do + runLogger + ($(logError) [i|Error determining Platform: #{e}|]) + exitWith (ExitFailure 2) + (GHCupInfo treq dls) <- ( runLogger @@ -1035,14 +1033,8 @@ Report bugs at |] runLogger ($(logError) [i|Error fetching download info: #{e}|]) exitWith (ExitFailure 2) - (runLogger - . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] $ checkForUpdates dls - ) - >>= \case - VRight _ -> pure () - VLeft e -> do - runLogger - ($(logError) [i|Error checking for upgrades: #{e}|]) + runLogger $ checkForUpdates dls pfreq + ----------------------- @@ -1052,7 +1044,7 @@ Report bugs at |] let installGHC InstallOptions{..} = (runInstTool $ do v <- liftE $ fromVersion dls instVer GHC - liftE $ installGHCBin dls (_tvVersion v) instPlatform -- FIXME: ugly sharing of tool version + liftE $ installGHCBin dls (_tvVersion v) (fromMaybe pfreq instPlatform) -- FIXME: ugly sharing of tool version ) >>= \case VRight _ -> do @@ -1086,7 +1078,7 @@ Report bugs at |] let installCabal InstallOptions{..} = (runInstTool $ do v <- liftE $ fromVersion dls instVer Cabal - liftE $ installCabalBin dls (_tvVersion v) instPlatform -- FIXME: ugly sharing of tool version + liftE $ installCabalBin dls (_tvVersion v) (fromMaybe pfreq instPlatform) -- FIXME: ugly sharing of tool version ) >>= \case VRight _ -> do @@ -1159,7 +1151,7 @@ Report bugs at |] res <- case optCommand of #if defined(BRICK) - Interactive -> liftIO $ brickMain settings optUrlSource loggerConfig >> pure ExitSuccess + Interactive -> liftIO $ brickMain settings optUrlSource loggerConfig dls pfreq >> pure ExitSuccess #endif Install (Right iopts) -> do runLogger ($(logWarn) [i|This is an old-style command for installing GHC. Use 'ghcup install ghc' instead.|]) @@ -1178,16 +1170,10 @@ Report bugs at |] List (ListOptions {..}) -> (runListGHC $ do - l <- listVersions dls lTool lCriteria - pure l + l <- listVersions dls lTool lCriteria pfreq + liftIO $ printListResult lRawFormat l + pure ExitSuccess ) - >>= \case - VRight r -> do - liftIO $ printListResult lRawFormat r - pure ExitSuccess - VLeft e -> do - runLogger ($(logError) [i|#{e}|]) - pure $ ExitFailure 6 Rm (Right rmopts) -> do runLogger ($(logWarn) [i|This is an old-style command for removing GHC. Use 'ghcup rm ghc' instead.|]) @@ -1214,6 +1200,7 @@ Report bugs at |] buildConfig patchDir addConfArgs + pfreq ) >>= \case VRight _ -> do @@ -1238,7 +1225,7 @@ Make sure to clean up #{tmpdir} afterwards.|]) Compile (CompileCabal CabalCompileOptions {..}) -> (runCompileCabal $ do - liftE $ compileCabal dls targetVer bootstrapGhc jobs patchDir + liftE $ compileCabal dls targetVer bootstrapGhc jobs patchDir pfreq ) >>= \case VRight _ -> do @@ -1269,7 +1256,7 @@ Make sure to clean up #{tmpdir} afterwards.|]) bdir <- liftIO $ ghcupBinDir pure (Just (bdir [rel|ghcup|])) - (runUpgrade $ (liftE $ upgradeGHCup dls target force)) >>= \case + (runUpgrade $ (liftE $ upgradeGHCup dls target force pfreq)) >>= \case VRight v' -> do let pretty_v = prettyVer v' runLogger $ $(logInfo) @@ -1415,37 +1402,32 @@ printListResult raw lr = do checkForUpdates :: (MonadCatch m, MonadLogger m, MonadThrow m, MonadIO m, MonadFail m, MonadLogger m) => GHCupDownloads - -> Excepts - '[ NoCompatiblePlatform - , NoCompatibleArch - , DistroNotFound - ] - m - () -checkForUpdates dls = do + -> PlatformRequest + -> m () +checkForUpdates dls pfreq = do forM_ (getLatest dls GHCup) $ \l -> do (Right ghc_ver) <- pure $ version $ prettyPVP ghcUpVer when (l > ghc_ver) - $ lift $ $(logWarn) + $ $(logWarn) [i|New GHCup version available: #{prettyVer l}. To upgrade, run 'ghcup upgrade'|] forM_ (getLatest dls GHC) $ \l -> do mghc_ver <- latestInstalled GHC forM mghc_ver $ \ghc_ver -> when (l > ghc_ver) - $ lift $ $(logWarn) + $ $(logWarn) [i|New GHC version available: #{prettyVer l}. To upgrade, run 'ghcup install ghc #{prettyVer l}'|] forM_ (getLatest dls Cabal) $ \l -> do mcabal_ver <- latestInstalled Cabal forM mcabal_ver $ \cabal_ver -> when (l > cabal_ver) - $ lift $ $(logWarn) + $ $(logWarn) [i|New Cabal version available: #{prettyVer l}. To upgrade, run 'ghcup install cabal #{prettyVer l}'|] where latestInstalled tool = (fmap lVer . lastMay) - <$> (listVersions dls (Just tool) (Just ListInstalled)) + <$> (listVersions dls (Just tool) (Just ListInstalled) pfreq) prettyDebugInfo :: DebugInfo -> String diff --git a/lib/GHCup.hs b/lib/GHCup.hs index e9e7bad..7bc9f1b 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -87,15 +87,12 @@ installGHCBin :: ( MonadFail m ) => GHCupDownloads -> Version - -> Maybe PlatformRequest -- ^ if Nothing, looks up current host platform + -> PlatformRequest -> Excepts '[ AlreadyInstalled , BuildFailed , DigestError - , DistroNotFound , DownloadFailed - , NoCompatibleArch - , NoCompatiblePlatform , NoDownload , NotInstalled , UnknownArchive @@ -105,12 +102,11 @@ installGHCBin :: ( MonadFail m ] m () -installGHCBin bDls ver mpfReq = do +installGHCBin bDls ver pfreq@(PlatformRequest {..}) = do let tver = (mkTVer ver) lift $ $(logDebug) [i|Requested to install GHC with #{ver}|] whenM (liftIO $ ghcInstalled tver) $ (throwE $ AlreadyInstalled GHC ver) - pfreq@(PlatformRequest {..}) <- maybe (liftE $ platformRequest) pure mpfReq -- download (or use cached version) dlinfo <- lE $ getDownloadInfo GHC ver pfreq bDls @@ -159,15 +155,12 @@ installCabalBin :: ( MonadMask m ) => GHCupDownloads -> Version - -> Maybe PlatformRequest -- ^ if Nothing, looks up current host platform + -> PlatformRequest -> Excepts '[ AlreadyInstalled , CopyError , DigestError - , DistroNotFound , DownloadFailed - , NoCompatibleArch - , NoCompatiblePlatform , NoDownload , NotInstalled , UnknownArchive @@ -177,7 +170,7 @@ installCabalBin :: ( MonadMask m ] m () -installCabalBin bDls ver mpfReq = do +installCabalBin bDls ver pfreq@(PlatformRequest {..}) = do lift $ $(logDebug) [i|Requested to install cabal version #{ver}|] bindir <- liftIO ghcupBinDir @@ -191,8 +184,6 @@ installCabalBin bDls ver mpfReq = do ) $ (throwE $ AlreadyInstalled Cabal ver) - pfreq@(PlatformRequest {..}) <- maybe (liftE $ platformRequest) pure mpfReq - -- download (or use cached version) dlinfo <- lE $ getDownloadInfo Cabal ver pfreq bDls dl <- liftE $ downloadCached dlinfo Nothing @@ -386,31 +377,25 @@ listVersions :: ( MonadCatch m => GHCupDownloads -> Maybe Tool -> Maybe ListCriteria - -> Excepts - '[ NoCompatiblePlatform - , NoCompatibleArch - , DistroNotFound - ] - m - [ListResult] -listVersions av lt criteria = do - pfreq <- platformRequest + -> PlatformRequest + -> m [ListResult] +listVersions av lt criteria pfreq = do case lt of Just t -> do -- get versions from GHCupDownloads let avTools = availableToolVersions av t - lr <- filter' <$> forM (Map.toList avTools) (liftIO . toListResult pfreq t) + lr <- filter' <$> forM (Map.toList avTools) (liftIO . toListResult t) case t of -- append stray GHCs GHC -> do - slr <- lift $ strayGHCs avTools + slr <- strayGHCs avTools pure $ (sort (slr ++ lr)) _ -> pure lr Nothing -> do - ghcvers <- listVersions av (Just GHC) criteria - cabalvers <- listVersions av (Just Cabal) criteria - ghcupvers <- listVersions av (Just GHCup) criteria + ghcvers <- listVersions av (Just GHC) criteria pfreq + cabalvers <- listVersions av (Just Cabal) criteria pfreq + ghcupvers <- listVersions av (Just GHCup) criteria pfreq pure (ghcvers <> cabalvers <> ghcupvers) where @@ -455,8 +440,8 @@ listVersions av lt criteria = do pure Nothing -- NOTE: this are not cross ones, because no bindists - toListResult :: PlatformRequest -> Tool -> (Version, [Tag]) -> IO ListResult - toListResult pfreq t (v, tags) = case t of + toListResult :: Tool -> (Version, [Tag]) -> IO ListResult + toListResult t (v, tags) = case t of GHC -> do let lNoBindist = isLeft $ getDownloadInfo GHC v pfreq av let tver = mkTVer v @@ -606,15 +591,13 @@ compileGHC :: ( MonadMask m -> Maybe (Path Abs) -- ^ build config -> Maybe (Path Abs) -- ^ patch directory -> [Text] -- ^ additional args to ./configure + -> PlatformRequest -> Excepts '[ AlreadyInstalled , BuildFailed , DigestError - , DistroNotFound , DownloadFailed , GHCupSetError - , NoCompatibleArch - , NoCompatiblePlatform , NoDownload , NotFoundInPATH , PatchFailed @@ -625,7 +608,7 @@ compileGHC :: ( MonadMask m ] m () -compileGHC dls tver bstrap jobs mbuildConfig patchdir aargs = do +compileGHC dls tver bstrap jobs mbuildConfig patchdir aargs PlatformRequest {..} = do lift $ $(logDebug) [i|Requested to compile: #{tver} with #{bstrap}|] whenM (liftIO $ ghcInstalled tver) (throwE $ AlreadyInstalled GHC (tver ^. tvVersion)) @@ -639,7 +622,6 @@ compileGHC dls tver bstrap jobs mbuildConfig patchdir aargs = do -- unpack tmpUnpack <- lift mkGhcupTmpDir liftE $ unpackToDir tmpUnpack dl - (PlatformRequest {..}) <- liftE $ platformRequest void $ liftIO $ darwinNotarization _rPlatform tmpUnpack bghc <- case bstrap of @@ -787,15 +769,13 @@ compileCabal :: ( MonadReader Settings m -> Either Version (Path Abs) -- ^ version to bootstrap with -> Maybe Int -> Maybe (Path Abs) + -> PlatformRequest -> Excepts '[ AlreadyInstalled , BuildFailed , CopyError , DigestError - , DistroNotFound , DownloadFailed - , NoCompatibleArch - , NoCompatiblePlatform , NoDownload , NotInstalled , PatchFailed @@ -806,7 +786,7 @@ compileCabal :: ( MonadReader Settings m ] m () -compileCabal dls tver bghc jobs patchdir = do +compileCabal dls tver bghc jobs patchdir PlatformRequest{..} = do lift $ $(logDebug) [i|Requested to compile: #{tver} with ghc-#{bghc}|] bindir <- liftIO ghcupBinDir @@ -827,7 +807,6 @@ compileCabal dls tver bghc jobs patchdir = do -- unpack tmpUnpack <- lift mkGhcupTmpDir liftE $ unpackToDir tmpUnpack dl - (PlatformRequest {..}) <- liftE $ platformRequest void $ liftIO $ darwinNotarization _rPlatform tmpUnpack let workdir = maybe id (flip ()) (view dlSubdir dlInfo) $ tmpUnpack @@ -909,23 +888,20 @@ upgradeGHCup :: ( MonadMask m -> Maybe (Path Abs) -- ^ full file destination to write ghcup into -> Bool -- ^ whether to force update regardless -- of currently installed version + -> PlatformRequest -> Excepts '[ CopyError , DigestError - , DistroNotFound , DownloadFailed - , NoCompatibleArch - , NoCompatiblePlatform , NoDownload , NoUpdate ] m Version -upgradeGHCup dls mtarget force = do +upgradeGHCup dls mtarget force pfreq = do lift $ $(logInfo) [i|Upgrading GHCup...|] let latestVer = fromJust $ getLatest dls GHCup when (not force && (latestVer <= pvpToVersion ghcUpVer)) $ throwE NoUpdate - pfreq <- liftE platformRequest dli <- lE $ getDownloadInfo GHCup latestVer pfreq dls tmp <- lift withGHCupTmpDir let fn = [rel|ghcup|] From b184ee835f1a6dde8a988f072dc84ee18efec80a Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Mon, 13 Jul 2020 20:05:02 +0200 Subject: [PATCH 8/8] Add freebsd 8.6.5 bindist --- ghcup-0.0.2.json | 7 +++++++ lib/GHCup/Data/GHCupDownloads.hs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/ghcup-0.0.2.json b/ghcup-0.0.2.json index f5e1392..fb554eb 100644 --- a/ghcup-0.0.2.json +++ b/ghcup-0.0.2.json @@ -856,6 +856,13 @@ "dlUri": "https://github.com/redneb/ghc-alt-libc/releases/download/ghc-8.6.5-musl/ghc-8.6.5-x86_64-unknown-linux-musl.tar.xz" } }, + "FreeBSD": { + "unknown_versioning": { + "dlHash": "83a3059a630d40a98e26cb5b520354e12094a96e36ba2f5ab002dad94cf2fb37", + "dlSubdir": "ghc-8.6.5", + "dlUri": "https://files.hasufell.de/ghc/ghc-8.6.5-x86_64-portbld-freebsd.tar.xz" + } + }, "Linux_Debian": { "unknown_versioning": { "dlHash": "bc75f5601a9f41d58b2ba161b9e28fad52143a7229060f1e084168d9b2e914df", diff --git a/lib/GHCup/Data/GHCupDownloads.hs b/lib/GHCup/Data/GHCupDownloads.hs index 58c1cbd..d72d249 100644 --- a/lib/GHCup/Data/GHCupDownloads.hs +++ b/lib/GHCup/Data/GHCupDownloads.hs @@ -664,6 +664,12 @@ ghc_865_32_musl = DownloadInfo (Just [rel|ghc-8.6.5|]) "db13ff894faf431f9c64db21c090a1e4e42803794d56720a704c50166c7ca05d" +ghc_865_64_freebsd :: DownloadInfo +ghc_865_64_freebsd = DownloadInfo + [uri|https://files.hasufell.de/ghc/ghc-8.6.5-x86_64-portbld-freebsd.tar.xz|] + (Just [rel|ghc-8.6.5|]) + "83a3059a630d40a98e26cb5b520354e12094a96e36ba2f5ab002dad94cf2fb37" + ----------------- @@ -1647,6 +1653,7 @@ ghcupDownloads = M.fromList ) , (Darwin , M.fromList [(Nothing, ghc_865_64_darwin)]) , (Linux Alpine, M.fromList [(Nothing, ghc_865_64_musl)]) + , (FreeBSD, M.fromList [(Nothing, ghc_865_64_freebsd)]) ] ) , ( A_32