Get rid of tar
This commit is contained in:
parent
4d465efef1
commit
f8cfcd4038
@ -52,3 +52,7 @@ apk add --no-cache \
|
|||||||
xz-dev \
|
xz-dev \
|
||||||
ncurses-static
|
ncurses-static
|
||||||
|
|
||||||
|
if [ "${ARCH}" = "32" ] ; then
|
||||||
|
apk add --no-cache \
|
||||||
|
bsd-compat-headers
|
||||||
|
fi
|
||||||
|
@ -18,7 +18,7 @@ ecabal update
|
|||||||
|
|
||||||
if [ "${OS}" = "LINUX" ] ; then
|
if [ "${OS}" = "LINUX" ] ; then
|
||||||
if [ "${ARCH}" = "32" ] ; then
|
if [ "${ARCH}" = "32" ] ; then
|
||||||
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui -ftar
|
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui
|
||||||
elif [ "${ARCH}" = "64" ] ; then
|
elif [ "${ARCH}" = "64" ] ; then
|
||||||
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui
|
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui
|
||||||
else
|
else
|
||||||
|
@ -42,14 +42,15 @@ if [ "${OS}" = "DARWIN" ] ; then
|
|||||||
ecabal haddock -w ghc-${GHC_VERSION} -ftui
|
ecabal haddock -w ghc-${GHC_VERSION} -ftui
|
||||||
elif [ "${OS}" = "LINUX" ] ; then
|
elif [ "${OS}" = "LINUX" ] ; then
|
||||||
if [ "${ARCH}" = "32" ] ; then
|
if [ "${ARCH}" = "32" ] ; then
|
||||||
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui -ftar
|
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
||||||
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui -ftar ghcup-test
|
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui ghcup-test
|
||||||
ecabal haddock -w ghc-${GHC_VERSION} -finternal-downloader -ftui -ftar
|
ecabal haddock -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
||||||
else
|
else
|
||||||
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
||||||
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui ghcup-test
|
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui ghcup-test
|
||||||
ecabal haddock -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
ecabal haddock -w ghc-${GHC_VERSION} -finternal-downloader -ftui
|
||||||
|
|
||||||
|
if [ "${ARCH}" = "64" ] ; then
|
||||||
# doctest
|
# doctest
|
||||||
curl -sL https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-docspec/cabal-docspec-0.0.0.20210228_p1.tar.bz2 > cabal-docspec.tar.bz2
|
curl -sL https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-docspec/cabal-docspec-0.0.0.20210228_p1.tar.bz2 > cabal-docspec.tar.bz2
|
||||||
echo '3a10f6fec16dbd18efdd331b1cef5d2d342082da42f5b520726d1fa6a3990d12 cabal-docspec.tar.bz2' | sha256sum -c -
|
echo '3a10f6fec16dbd18efdd331b1cef5d2d342082da42f5b520726d1fa6a3990d12 cabal-docspec.tar.bz2' | sha256sum -c -
|
||||||
@ -60,6 +61,7 @@ elif [ "${OS}" = "LINUX" ] ; then
|
|||||||
|
|
||||||
cabal-docspec -XCPP -XTypeSynonymInstances -XOverloadedStrings -XPackageImports --check-properties
|
cabal-docspec -XCPP -XTypeSynonymInstances -XOverloadedStrings -XPackageImports --check-properties
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
elif [ "${OS}" = "FREEBSD" ] ; then
|
elif [ "${OS}" = "FREEBSD" ] ; then
|
||||||
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui --constraint="zip +disable-zstd"
|
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui --constraint="zip +disable-zstd"
|
||||||
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui --constraint="zip +disable-zstd" ghcup-test
|
ecabal test -w ghc-${GHC_VERSION} -finternal-downloader -ftui --constraint="zip +disable-zstd" ghcup-test
|
||||||
|
@ -18,11 +18,7 @@ import GHCup.Utils
|
|||||||
import GHCup.Utils.Logger
|
import GHCup.Utils.Logger
|
||||||
import GHCup.Utils.Version.QQ
|
import GHCup.Utils.Version.QQ
|
||||||
|
|
||||||
#if defined(TAR)
|
|
||||||
import qualified Codec.Archive.Tar as Tar
|
|
||||||
#else
|
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
#endif
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
@ -246,11 +242,7 @@ validateTarballs (TarballFilter etool versionRegex) dls gt = do
|
|||||||
. runE @'[DigestError
|
. runE @'[DigestError
|
||||||
, DownloadFailed
|
, DownloadFailed
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
#if defined(TAR)
|
|
||||||
, Tar.FormatError
|
|
||||||
#else
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
$ do
|
$ do
|
||||||
case etool of
|
case etool of
|
||||||
|
@ -27,9 +27,7 @@ import Brick.Widgets.List ( listSelectedFocusedAttr
|
|||||||
, listSelectedAttr
|
, listSelectedAttr
|
||||||
, listAttr
|
, listAttr
|
||||||
)
|
)
|
||||||
#if !defined(TAR)
|
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
#endif
|
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad.Logger
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
@ -428,9 +426,7 @@ install' _ (_, ListResult {..}) = do
|
|||||||
. runResourceT
|
. runResourceT
|
||||||
. runE
|
. runE
|
||||||
@'[ AlreadyInstalled
|
@'[ AlreadyInstalled
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, FileDoesNotExistError
|
, FileDoesNotExistError
|
||||||
, CopyError
|
, CopyError
|
||||||
|
@ -30,9 +30,7 @@ import GHCup.Utils.Prelude
|
|||||||
import GHCup.Utils.String.QQ
|
import GHCup.Utils.String.QQ
|
||||||
import GHCup.Version
|
import GHCup.Version
|
||||||
|
|
||||||
#if !defined(TAR)
|
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
#endif
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Concurrent.Async
|
import Control.Concurrent.Async
|
||||||
import Control.DeepSeq ( force )
|
import Control.DeepSeq ( force )
|
||||||
@ -1519,9 +1517,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
. runE
|
. runE
|
||||||
@'[ AlreadyInstalled
|
@'[ AlreadyInstalled
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
, FileDoesNotExistError
|
, FileDoesNotExistError
|
||||||
, CopyError
|
, CopyError
|
||||||
, NotInstalled
|
, NotInstalled
|
||||||
@ -1638,9 +1634,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, NotInstalled
|
, NotInstalled
|
||||||
, DirNotEmpty
|
, DirNotEmpty
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -10,13 +10,13 @@ package ghcup
|
|||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/Bodigrim/tar
|
location: https://github.com/bgamari/terminal-size
|
||||||
tag: ac197ec7ea4838dc2b4e22b9b888b080cedf29cf
|
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/bgamari/terminal-size
|
location: https://github.com/hasufell/libarchive
|
||||||
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
tag: 024a7e8ab7b4d3848dc64dca1e70a04831eedc99
|
||||||
|
|
||||||
constraints: http-io-streams -brotli
|
constraints: http-io-streams -brotli
|
||||||
|
|
||||||
|
37
ghcup.cabal
37
ghcup.cabal
@ -43,11 +43,6 @@ flag internal-downloader
|
|||||||
default: False
|
default: False
|
||||||
manual: True
|
manual: True
|
||||||
|
|
||||||
flag tar
|
|
||||||
description: Use tar-bytestring instead of libarchive.
|
|
||||||
default: False
|
|
||||||
manual: True
|
|
||||||
|
|
||||||
library
|
library
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
GHCup
|
GHCup
|
||||||
@ -110,17 +105,15 @@ library
|
|||||||
, disk-free-space ^>=0.1.0.1
|
, disk-free-space ^>=0.1.0.1
|
||||||
, extra ^>=1.7.9
|
, extra ^>=1.7.9
|
||||||
, filepath ^>=1.4.2.1
|
, filepath ^>=1.4.2.1
|
||||||
, generics-sop ^>=0.5
|
|
||||||
, haskus-utils-types ^>=1.5
|
, haskus-utils-types ^>=1.5
|
||||||
, haskus-utils-variant >=3.0 && <3.2
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
|
, libarchive ^>=3.0.0.0
|
||||||
, lzma-static ^>=5.2.5.3
|
, lzma-static ^>=5.2.5.3
|
||||||
, megaparsec >=8.0.0 && <9.1
|
, megaparsec >=8.0.0 && <9.1
|
||||||
, monad-logger ^>=0.3.31
|
, monad-logger ^>=0.3.31
|
||||||
, mtl ^>=2.2
|
, mtl ^>=2.2
|
||||||
, optics ^>=0.4
|
, optics ^>=0.4
|
||||||
, optics-vl ^>=0.2
|
|
||||||
, os-release ^>=1.0.0
|
, os-release ^>=1.0.0
|
||||||
, parsec ^>=3.1
|
|
||||||
, pretty ^>=1.1.3.1
|
, pretty ^>=1.1.3.1
|
||||||
, pretty-terminal ^>=0.1.0.0
|
, pretty-terminal ^>=0.1.0.0
|
||||||
, regex-posix ^>=0.96
|
, regex-posix ^>=0.96
|
||||||
@ -138,7 +131,6 @@ library
|
|||||||
, unliftio-core ^>=0.2.0.1
|
, unliftio-core ^>=0.2.0.1
|
||||||
, unordered-containers ^>=0.2.10.0
|
, unordered-containers ^>=0.2.10.0
|
||||||
, uri-bytestring ^>=0.3.2.2
|
, uri-bytestring ^>=0.3.2.2
|
||||||
, utf8-string ^>=1.0
|
|
||||||
, vector ^>=0.12
|
, vector ^>=0.12
|
||||||
, versions >=4.0.1 && <5.1
|
, versions >=4.0.1 && <5.1
|
||||||
, word8 ^>=0.1.3
|
, word8 ^>=0.1.3
|
||||||
@ -155,13 +147,6 @@ library
|
|||||||
, io-streams >=1.5.2.1
|
, io-streams >=1.5.2.1
|
||||||
, terminal-progress-bar >=0.4.1
|
, terminal-progress-bar >=0.4.1
|
||||||
|
|
||||||
if flag(tar)
|
|
||||||
cpp-options: -DTAR
|
|
||||||
build-depends: tar
|
|
||||||
|
|
||||||
else
|
|
||||||
build-depends: libarchive ^>=3.0.0.0
|
|
||||||
|
|
||||||
if os(windows)
|
if os(windows)
|
||||||
cpp-options: -DIS_WINDOWS
|
cpp-options: -DIS_WINDOWS
|
||||||
other-modules: GHCup.Utils.File.Windows
|
other-modules: GHCup.Utils.File.Windows
|
||||||
@ -175,8 +160,6 @@ library
|
|||||||
other-modules: GHCup.Utils.File.Posix
|
other-modules: GHCup.Utils.File.Posix
|
||||||
build-depends:
|
build-depends:
|
||||||
, bz2 >=0.5.0.5 && <1.1
|
, bz2 >=0.5.0.5 && <1.1
|
||||||
, hpath-posix ^>=0.13.3
|
|
||||||
, process ^>=1.6.9
|
|
||||||
, unix ^>=2.7
|
, unix ^>=2.7
|
||||||
, unix-bytestring ^>=0.3.7.3
|
, unix-bytestring ^>=0.3.7.3
|
||||||
|
|
||||||
@ -211,6 +194,7 @@ executable ghcup
|
|||||||
, filepath ^>=1.4.2.1
|
, filepath ^>=1.4.2.1
|
||||||
, ghcup
|
, ghcup
|
||||||
, haskus-utils-variant >=3.0 && <3.2
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
|
, libarchive ^>=3.0.0.0
|
||||||
, megaparsec >=8.0.0 && <9.1
|
, megaparsec >=8.0.0 && <9.1
|
||||||
, monad-logger ^>=0.3.31
|
, monad-logger ^>=0.3.31
|
||||||
, mtl ^>=2.2
|
, mtl ^>=2.2
|
||||||
@ -235,7 +219,7 @@ executable ghcup
|
|||||||
cpp-options: -DBRICK
|
cpp-options: -DBRICK
|
||||||
other-modules: BrickMain
|
other-modules: BrickMain
|
||||||
build-depends:
|
build-depends:
|
||||||
, brick >=0.64 && <0.65
|
, brick ^>=0.64
|
||||||
, transformers ^>=0.5
|
, transformers ^>=0.5
|
||||||
, vector ^>=0.12
|
, vector ^>=0.12
|
||||||
, vty >=5.28.2 && <5.34
|
, vty >=5.28.2 && <5.34
|
||||||
@ -243,12 +227,6 @@ executable ghcup
|
|||||||
if os(windows)
|
if os(windows)
|
||||||
cpp-options: -DIS_WINDOWS
|
cpp-options: -DIS_WINDOWS
|
||||||
|
|
||||||
if flag(tar)
|
|
||||||
cpp-options: -DTAR
|
|
||||||
|
|
||||||
else
|
|
||||||
build-depends: libarchive ^>=3.0.0.0
|
|
||||||
|
|
||||||
executable ghcup-gen
|
executable ghcup-gen
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
hs-source-dirs: app/ghcup-gen
|
hs-source-dirs: app/ghcup-gen
|
||||||
@ -280,6 +258,7 @@ executable ghcup-gen
|
|||||||
, filepath ^>=1.4.2.1
|
, filepath ^>=1.4.2.1
|
||||||
, ghcup
|
, ghcup
|
||||||
, haskus-utils-variant >=3.0 && <3.2
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
|
, libarchive ^>=3.0.0.0
|
||||||
, monad-logger ^>=0.3.31
|
, monad-logger ^>=0.3.31
|
||||||
, mtl ^>=2.2
|
, mtl ^>=2.2
|
||||||
, optics ^>=0.4
|
, optics ^>=0.4
|
||||||
@ -292,17 +271,9 @@ executable ghcup-gen
|
|||||||
, string-interpolate >=0.2.0.0 && <0.4
|
, string-interpolate >=0.2.0.0 && <0.4
|
||||||
, text ^>=1.2.4.0
|
, text ^>=1.2.4.0
|
||||||
, transformers ^>=0.5
|
, transformers ^>=0.5
|
||||||
, uri-bytestring ^>=0.3.2.2
|
|
||||||
, versions >=4.0.1 && <5.1
|
, versions >=4.0.1 && <5.1
|
||||||
, yaml ^>=0.11.4.0
|
, yaml ^>=0.11.4.0
|
||||||
|
|
||||||
if flag(tar)
|
|
||||||
cpp-options: -DTAR
|
|
||||||
build-depends: tar
|
|
||||||
|
|
||||||
else
|
|
||||||
build-depends: libarchive ^>=3.0.0.0
|
|
||||||
|
|
||||||
test-suite ghcup-test
|
test-suite ghcup-test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
|
24
lib/GHCup.hs
24
lib/GHCup.hs
@ -39,9 +39,7 @@ import GHCup.Utils.String.QQ
|
|||||||
import GHCup.Utils.Version.QQ
|
import GHCup.Utils.Version.QQ
|
||||||
import GHCup.Version
|
import GHCup.Version
|
||||||
|
|
||||||
#if !defined(TAR)
|
|
||||||
import Codec.Archive ( ArchiveResult )
|
import Codec.Archive ( ArchiveResult )
|
||||||
#endif
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.DeepSeq ( force )
|
import Control.DeepSeq ( force )
|
||||||
import Control.Exception ( evaluate )
|
import Control.Exception ( evaluate )
|
||||||
@ -83,7 +81,7 @@ import System.IO.Error
|
|||||||
#if defined(IS_WINDOWS)
|
#if defined(IS_WINDOWS)
|
||||||
import System.IO.Temp
|
import System.IO.Temp
|
||||||
#endif
|
#endif
|
||||||
import Text.PrettyPrint.HughesPJClass ( prettyShow, Pretty )
|
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
import Text.Regex.Posix
|
import Text.Regex.Posix
|
||||||
|
|
||||||
import qualified Crypto.Hash.SHA256 as SHA256
|
import qualified Crypto.Hash.SHA256 as SHA256
|
||||||
@ -197,9 +195,7 @@ installGHCBindist :: ( MonadFail m
|
|||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, DirNotEmpty
|
, DirNotEmpty
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
@ -264,9 +260,7 @@ installPackedGHC :: ( MonadMask m
|
|||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, DirNotEmpty
|
, DirNotEmpty
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
] m ()
|
] m ()
|
||||||
installPackedGHC dl msubdir inst ver = do
|
installPackedGHC dl msubdir inst ver = do
|
||||||
PlatformRequest {..} <- lift getPlatformReq
|
PlatformRequest {..} <- lift getPlatformReq
|
||||||
@ -382,9 +376,7 @@ installGHCBin :: ( MonadFail m
|
|||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, DirNotEmpty
|
, DirNotEmpty
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
@ -419,9 +411,7 @@ installCabalBindist :: ( MonadMask m
|
|||||||
, NotInstalled
|
, NotInstalled
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
, FileAlreadyExistsError
|
, FileAlreadyExistsError
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
@ -515,9 +505,7 @@ installCabalBin :: ( MonadMask m
|
|||||||
, NotInstalled
|
, NotInstalled
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
, FileAlreadyExistsError
|
, FileAlreadyExistsError
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
@ -553,9 +541,7 @@ installHLSBindist :: ( MonadMask m
|
|||||||
, NotInstalled
|
, NotInstalled
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
@ -660,9 +646,7 @@ installHLSBin :: ( MonadMask m
|
|||||||
, NotInstalled
|
, NotInstalled
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
@ -698,9 +682,7 @@ installStackBin :: ( MonadMask m
|
|||||||
, NotInstalled
|
, NotInstalled
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
@ -735,9 +717,7 @@ installStackBindist :: ( MonadMask m
|
|||||||
, NotInstalled
|
, NotInstalled
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
@ -1791,9 +1771,7 @@ compileGHC :: ( MonadMask m
|
|||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, NotInstalled
|
, NotInstalled
|
||||||
, DirNotEmpty
|
, DirNotEmpty
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
GHCTargetVersion
|
GHCTargetVersion
|
||||||
|
@ -21,11 +21,7 @@ module GHCup.Errors where
|
|||||||
|
|
||||||
import GHCup.Types
|
import GHCup.Types
|
||||||
|
|
||||||
#if !defined(TAR)
|
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
#else
|
|
||||||
import qualified Codec.Archive.Tar as Tar
|
|
||||||
#endif
|
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
import Data.CaseInsensitive ( CI )
|
import Data.CaseInsensitive ( CI )
|
||||||
@ -390,7 +386,6 @@ instance Pretty URIParseError where
|
|||||||
pPrint (OtherError err) =
|
pPrint (OtherError err) =
|
||||||
text [i|Failed to parse URI: #{err}|]
|
text [i|Failed to parse URI: #{err}|]
|
||||||
|
|
||||||
#if !defined(TAR)
|
|
||||||
instance Pretty ArchiveResult where
|
instance Pretty ArchiveResult where
|
||||||
pPrint ArchiveFatal = text "Archive result: fatal"
|
pPrint ArchiveFatal = text "Archive result: fatal"
|
||||||
pPrint ArchiveFailed = text "Archive result: failed"
|
pPrint ArchiveFailed = text "Archive result: failed"
|
||||||
@ -398,14 +393,3 @@ instance Pretty ArchiveResult where
|
|||||||
pPrint ArchiveRetry = text "Archive result: retry"
|
pPrint ArchiveRetry = text "Archive result: retry"
|
||||||
pPrint ArchiveOk = text "Archive result: Ok"
|
pPrint ArchiveOk = text "Archive result: Ok"
|
||||||
pPrint ArchiveEOF = text "Archive result: EOF"
|
pPrint ArchiveEOF = text "Archive result: EOF"
|
||||||
#else
|
|
||||||
instance Pretty Tar.FormatError where
|
|
||||||
pPrint Tar.TruncatedArchive = text "Truncated archive"
|
|
||||||
pPrint Tar.ShortTrailer = text "Short trailer"
|
|
||||||
pPrint Tar.BadTrailer = text "Bad trailer"
|
|
||||||
pPrint Tar.TrailingJunk = text "Trailing junk"
|
|
||||||
pPrint Tar.ChecksumIncorrect = text "Checksum incorrect"
|
|
||||||
pPrint Tar.NotTarFormat = text "Not a tar format"
|
|
||||||
pPrint Tar.UnrecognisedTarFormat = text "Unrecognised tar format"
|
|
||||||
pPrint Tar.HeaderBadNumericEncoding = text "Header has bad numeric encoding"
|
|
||||||
#endif
|
|
||||||
|
@ -39,9 +39,7 @@ import GHCup.Utils.MegaParsec
|
|||||||
import GHCup.Utils.Prelude
|
import GHCup.Utils.Prelude
|
||||||
import GHCup.Utils.String.QQ
|
import GHCup.Utils.String.QQ
|
||||||
|
|
||||||
#if !defined(TAR)
|
|
||||||
import Codec.Archive hiding ( Directory )
|
import Codec.Archive hiding ( Directory )
|
||||||
#endif
|
|
||||||
import Codec.Archive.Zip
|
import Codec.Archive.Zip
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
@ -83,9 +81,6 @@ import Text.PrettyPrint.HughesPJClass hiding ( (<>) )
|
|||||||
import Text.Regex.Posix
|
import Text.Regex.Posix
|
||||||
import URI.ByteString
|
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.BZip as BZip
|
||||||
import qualified Codec.Compression.GZip as GZip
|
import qualified Codec.Compression.GZip as GZip
|
||||||
import qualified Codec.Compression.Lzma as Lzma
|
import qualified Codec.Compression.Lzma as Lzma
|
||||||
@ -603,27 +598,17 @@ unpackToDir :: (MonadLogger m, MonadIO m, MonadThrow m)
|
|||||||
=> FilePath -- ^ destination dir
|
=> FilePath -- ^ destination dir
|
||||||
-> FilePath -- ^ archive path
|
-> FilePath -- ^ archive path
|
||||||
-> Excepts '[UnknownArchive
|
-> Excepts '[UnknownArchive
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
] m ()
|
] m ()
|
||||||
unpackToDir dfp av = do
|
unpackToDir dfp av = do
|
||||||
let fn = takeFileName av
|
let fn = takeFileName av
|
||||||
lift $ $(logInfo) [i|Unpacking: #{fn} to #{dfp}|]
|
lift $ $(logInfo) [i|Unpacking: #{fn} to #{dfp}|]
|
||||||
|
|
||||||
#if defined(TAR)
|
|
||||||
let untar :: MonadIO m => BL.ByteString -> Excepts '[] m ()
|
|
||||||
untar = liftIO . Tar.unpack dfp . Tar.read
|
|
||||||
|
|
||||||
rf :: MonadIO m => FilePath -> Excepts '[] m BL.ByteString
|
|
||||||
rf = liftIO . BL.readFile
|
|
||||||
#else
|
|
||||||
let untar :: MonadIO m => BL.ByteString -> Excepts '[ArchiveResult] m ()
|
let untar :: MonadIO m => BL.ByteString -> Excepts '[ArchiveResult] m ()
|
||||||
untar = lEM . liftIO . runArchiveM . unpackToDirLazy dfp
|
untar = lEM . liftIO . runArchiveM . unpackToDirLazy dfp
|
||||||
|
|
||||||
rf :: MonadIO m => FilePath -> Excepts '[ArchiveResult] m BL.ByteString
|
rf :: MonadIO m => FilePath -> Excepts '[ArchiveResult] m BL.ByteString
|
||||||
rf = liftIO . BL.readFile
|
rf = liftIO . BL.readFile
|
||||||
#endif
|
|
||||||
|
|
||||||
-- extract, depending on file extension
|
-- extract, depending on file extension
|
||||||
if
|
if
|
||||||
@ -644,34 +629,16 @@ unpackToDir dfp av = do
|
|||||||
getArchiveFiles :: (MonadLogger m, MonadIO m, MonadThrow m)
|
getArchiveFiles :: (MonadLogger m, MonadIO m, MonadThrow m)
|
||||||
=> FilePath -- ^ archive path
|
=> FilePath -- ^ archive path
|
||||||
-> Excepts '[UnknownArchive
|
-> Excepts '[UnknownArchive
|
||||||
#if defined(TAR)
|
|
||||||
, Tar.FormatError
|
|
||||||
#else
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
] m [FilePath]
|
] m [FilePath]
|
||||||
getArchiveFiles av = do
|
getArchiveFiles av = do
|
||||||
let fn = takeFileName av
|
let fn = takeFileName av
|
||||||
|
|
||||||
#if defined(TAR)
|
|
||||||
let entries :: Monad m => BL.ByteString -> Excepts '[Tar.FormatError] m [FilePath]
|
|
||||||
entries =
|
|
||||||
lE @Tar.FormatError
|
|
||||||
. Tar.foldEntries
|
|
||||||
(\e x -> fmap (Tar.entryPath e :) x)
|
|
||||||
(Right [])
|
|
||||||
(\e -> Left e)
|
|
||||||
. Tar.read
|
|
||||||
|
|
||||||
rf :: MonadIO m => FilePath -> Excepts '[Tar.FormatError] m BL.ByteString
|
|
||||||
rf = liftIO . BL.readFile
|
|
||||||
#else
|
|
||||||
let entries :: Monad m => BL.ByteString -> Excepts '[ArchiveResult] m [FilePath]
|
let entries :: Monad m => BL.ByteString -> Excepts '[ArchiveResult] m [FilePath]
|
||||||
entries = (fmap . fmap) filepath . lE . readArchiveBSL
|
entries = (fmap . fmap) filepath . lE . readArchiveBSL
|
||||||
|
|
||||||
rf :: MonadIO m => FilePath -> Excepts '[ArchiveResult] m BL.ByteString
|
rf :: MonadIO m => FilePath -> Excepts '[ArchiveResult] m BL.ByteString
|
||||||
rf = liftIO . BL.readFile
|
rf = liftIO . BL.readFile
|
||||||
#endif
|
|
||||||
|
|
||||||
-- extract, depending on file extension
|
-- extract, depending on file extension
|
||||||
if
|
if
|
||||||
|
Loading…
Reference in New Issue
Block a user