Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
9d6e469f79
|
|||
|
982c0a0fcf
|
|||
|
f8cfcd4038
|
|||
|
4d465efef1
|
|||
|
d667160027
|
|||
|
|
df55d972cf | ||
|
7bc00c4e68
|
|||
|
bfc50e269c
|
|||
|
cea71beb4d
|
|||
|
8247c0b00b
|
|||
|
f624a83e87
|
|||
|
951e676bee
|
|||
|
281f310394
|
|||
|
c029713f23
|
|||
|
b86e2a1d5b
|
|||
|
099a6b9dcd
|
|||
|
3b13624117
|
|||
|
fad1efcefa
|
|||
|
1701b8a2f4
|
|||
|
608ee07940
|
|||
|
|
a0c2a5ccec | ||
|
cd41d3af97
|
@@ -99,7 +99,7 @@ variables:
|
|||||||
script:
|
script:
|
||||||
- bash ./.gitlab/script/ghcup_version.sh
|
- bash ./.gitlab/script/ghcup_version.sh
|
||||||
variables:
|
variables:
|
||||||
JSON_VERSION: "0.0.6"
|
JSON_VERSION: "0.0.7"
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 2 week
|
expire_in: 2 week
|
||||||
paths:
|
paths:
|
||||||
@@ -207,7 +207,7 @@ variables:
|
|||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
variables:
|
variables:
|
||||||
JSON_VERSION: "0.0.6"
|
JSON_VERSION: "0.0.7"
|
||||||
|
|
||||||
######## stack test ########
|
######## stack test ########
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ test:windows:bootstrap_powershell_script:
|
|||||||
|
|
||||||
######## linux test ########
|
######## linux test ########
|
||||||
|
|
||||||
test:linux:recommended:
|
test:linux:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_ghcup_version:linux
|
extends: .test_ghcup_version:linux
|
||||||
variables:
|
variables:
|
||||||
@@ -263,14 +263,6 @@ test:linux:recommended:
|
|||||||
CABAL_VERSION: "3.4.0.0"
|
CABAL_VERSION: "3.4.0.0"
|
||||||
needs: []
|
needs: []
|
||||||
|
|
||||||
test:linux:latest:
|
|
||||||
stage: test
|
|
||||||
extends: .test_ghcup_version:linux
|
|
||||||
variables:
|
|
||||||
GHC_VERSION: "9.0.1"
|
|
||||||
CABAL_VERSION: "3.4.0.0"
|
|
||||||
needs: []
|
|
||||||
|
|
||||||
test:linux:cross-armv7:
|
test:linux:cross-armv7:
|
||||||
stage: test
|
stage: test
|
||||||
extends:
|
extends:
|
||||||
@@ -311,7 +303,7 @@ test:linux:git:hadrian:
|
|||||||
|
|
||||||
######## linux 32bit test ########
|
######## linux 32bit test ########
|
||||||
|
|
||||||
test:linux:recommended:32bit:
|
test:linux:32bit:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_ghcup_version:linux32
|
extends: .test_ghcup_version:linux32
|
||||||
variables:
|
variables:
|
||||||
@@ -321,7 +313,7 @@ test:linux:recommended:32bit:
|
|||||||
|
|
||||||
######## arm tests ########
|
######## arm tests ########
|
||||||
|
|
||||||
test:linux:recommended:armv7:
|
test:linux:armv7:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_ghcup_version:armv7
|
extends: .test_ghcup_version:armv7
|
||||||
variables:
|
variables:
|
||||||
@@ -331,7 +323,7 @@ test:linux:recommended:armv7:
|
|||||||
when: manual
|
when: manual
|
||||||
needs: []
|
needs: []
|
||||||
|
|
||||||
test:linux:recommended:aarch64:
|
test:linux:aarch64:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_ghcup_version:aarch64
|
extends: .test_ghcup_version:aarch64
|
||||||
variables:
|
variables:
|
||||||
@@ -343,7 +335,7 @@ test:linux:recommended:aarch64:
|
|||||||
|
|
||||||
######## darwin test ########
|
######## darwin test ########
|
||||||
|
|
||||||
test:mac:recommended:
|
test:mac:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_ghcup_version:darwin
|
extends: .test_ghcup_version:darwin
|
||||||
variables:
|
variables:
|
||||||
@@ -351,15 +343,7 @@ test:mac:recommended:
|
|||||||
CABAL_VERSION: "3.4.0.0"
|
CABAL_VERSION: "3.4.0.0"
|
||||||
needs: []
|
needs: []
|
||||||
|
|
||||||
test:mac:latest:
|
test:mac:aarch64:
|
||||||
stage: test
|
|
||||||
extends: .test_ghcup_version:darwin
|
|
||||||
variables:
|
|
||||||
GHC_VERSION: "9.0.1"
|
|
||||||
CABAL_VERSION: "3.4.0.0"
|
|
||||||
needs: []
|
|
||||||
|
|
||||||
test:mac:recommended:aarch64:
|
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_ghcup_version:darwin:aarch64
|
extends: .test_ghcup_version:darwin:aarch64
|
||||||
variables:
|
variables:
|
||||||
@@ -371,7 +355,7 @@ test:mac:recommended:aarch64:
|
|||||||
|
|
||||||
######## freebsd test ########
|
######## freebsd test ########
|
||||||
|
|
||||||
test:freebsd:recommended:
|
test:freebsd:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_ghcup_version:freebsd
|
extends: .test_ghcup_version:freebsd
|
||||||
variables:
|
variables:
|
||||||
@@ -383,7 +367,7 @@ test:freebsd:recommended:
|
|||||||
|
|
||||||
######## windows test ########
|
######## windows test ########
|
||||||
|
|
||||||
test:windows:recommended:
|
test:windows:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_ghcup_version:windows
|
extends: .test_ghcup_version:windows
|
||||||
variables:
|
variables:
|
||||||
@@ -400,7 +384,7 @@ test:windows:recommended:
|
|||||||
|
|
||||||
release:linux:64bit:
|
release:linux:64bit:
|
||||||
stage: release
|
stage: release
|
||||||
needs: ["test:linux:recommended", "test:linux:latest"]
|
needs: ["test:linux"]
|
||||||
extends:
|
extends:
|
||||||
- .alpine:64bit
|
- .alpine:64bit
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
@@ -414,7 +398,7 @@ release:linux:64bit:
|
|||||||
|
|
||||||
release:linux:32bit:
|
release:linux:32bit:
|
||||||
stage: release
|
stage: release
|
||||||
needs: ["test:linux:recommended:32bit"]
|
needs: ["test:linux:32bit"]
|
||||||
extends:
|
extends:
|
||||||
- .alpine:32bit
|
- .alpine:32bit
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
@@ -427,7 +411,7 @@ release:linux:32bit:
|
|||||||
|
|
||||||
release:linux:armv7:
|
release:linux:armv7:
|
||||||
stage: release
|
stage: release
|
||||||
needs: ["test:linux:recommended:armv7"]
|
needs: ["test:linux:armv7"]
|
||||||
extends:
|
extends:
|
||||||
- .linux:armv7
|
- .linux:armv7
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
@@ -441,7 +425,7 @@ release:linux:armv7:
|
|||||||
|
|
||||||
release:linux:aarch64:
|
release:linux:aarch64:
|
||||||
stage: release
|
stage: release
|
||||||
needs: ["test:linux:recommended:aarch64"]
|
needs: ["test:linux:aarch64"]
|
||||||
extends:
|
extends:
|
||||||
- .linux:aarch64
|
- .linux:aarch64
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
@@ -457,7 +441,7 @@ release:linux:aarch64:
|
|||||||
|
|
||||||
release:darwin:
|
release:darwin:
|
||||||
stage: release
|
stage: release
|
||||||
needs: ["test:mac:recommended", "test:mac:latest"]
|
needs: ["test:mac"]
|
||||||
extends:
|
extends:
|
||||||
- .darwin
|
- .darwin
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
@@ -472,7 +456,7 @@ release:darwin:
|
|||||||
|
|
||||||
release:darwin:aarch64:
|
release:darwin:aarch64:
|
||||||
stage: release
|
stage: release
|
||||||
needs: ["test:mac:recommended:aarch64"]
|
needs: ["test:mac:aarch64"]
|
||||||
extends:
|
extends:
|
||||||
- .darwin:aarch64
|
- .darwin:aarch64
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
@@ -509,7 +493,7 @@ release:darwin:aarch64:
|
|||||||
|
|
||||||
release:freebsd:
|
release:freebsd:
|
||||||
stage: release
|
stage: release
|
||||||
needs: ["test:freebsd:recommended"]
|
needs: ["test:freebsd"]
|
||||||
extends:
|
extends:
|
||||||
- .freebsd
|
- .freebsd
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
@@ -526,7 +510,7 @@ release:freebsd:
|
|||||||
|
|
||||||
release:windows:
|
release:windows:
|
||||||
stage: release
|
stage: release
|
||||||
needs: ["test:windows:recommended"]
|
needs: ["test:windows"]
|
||||||
extends:
|
extends:
|
||||||
- .windows
|
- .windows
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
|
|||||||
@@ -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,13 +42,25 @@ 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
|
||||||
|
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 -
|
||||||
|
tar -xjf cabal-docspec.tar.bz2 cabal-docspec
|
||||||
|
mv cabal-docspec "$CI_PROJECT_DIR"/.local/bin/cabal-docspec
|
||||||
|
rm -f cabal-docspec.tar.bz2
|
||||||
|
chmod a+x "$CI_PROJECT_DIR"/.local/bin/cabal-docspec
|
||||||
|
|
||||||
|
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"
|
||||||
|
|||||||
31
README.md
31
README.md
@@ -23,6 +23,7 @@ Similar in scope to [rustup](https://github.com/rust-lang-nursery/rustup.rs), [p
|
|||||||
* [XDG support](#xdg-support)
|
* [XDG support](#xdg-support)
|
||||||
* [Env variables](#env-variables)
|
* [Env variables](#env-variables)
|
||||||
* [Installing custom bindists](#installing-custom-bindists)
|
* [Installing custom bindists](#installing-custom-bindists)
|
||||||
|
* [Isolated Installs](#isolated-installs)
|
||||||
* [Tips and tricks](#tips-and-tricks)
|
* [Tips and tricks](#tips-and-tricks)
|
||||||
* [Design goals](#design-goals)
|
* [Design goals](#design-goals)
|
||||||
* [How](#how)
|
* [How](#how)
|
||||||
@@ -160,6 +161,36 @@ and produce the binaries `ghc-8.10.2-eff` and `ghc-head` respectively.
|
|||||||
GHCup always needs to know which version the bindist corresponds to (this is not automatically
|
GHCup always needs to know which version the bindist corresponds to (this is not automatically
|
||||||
detected).
|
detected).
|
||||||
|
|
||||||
|
### Isolated installs
|
||||||
|
|
||||||
|
Ghcup also enables you to install a tool (GHC, Cabal, HLS, Stack) at an isolated location of your choosing.
|
||||||
|
These installs, as the name suggests, are separate from your main installs and DO NOT conflict with them.
|
||||||
|
|
||||||
|
|
||||||
|
- No symlinks are made to these isolated installed tools, you'd have to manually point to them wherever you intend to use them.
|
||||||
|
|
||||||
|
- These installs, can also NOT be deleted from ghcup, you'd have to go and manually delete these.
|
||||||
|
|
||||||
|
You need to use the `--isolate` or `-i` flag followed by the directory path.
|
||||||
|
|
||||||
|
Examples:-
|
||||||
|
|
||||||
|
1. install an isolated GHC version at location /home/user/isolated_dir/ghc/
|
||||||
|
- `ghcup install ghc 8.10.5 --isolate /home/user/isolated_dir/ghc`
|
||||||
|
|
||||||
|
2. isolated install Cabal at a location you desire
|
||||||
|
- `ghcup install cabal --isolate /home/username/my_isolated_dir/`
|
||||||
|
|
||||||
|
3. do an isolated install with a custom bindist
|
||||||
|
- `ghcup install ghc --isolate /home/username/my_isolated_dir/ -u 'https://gitlab.haskell.org/api/v4/projects/1/jobs/artifacts/master/raw/ghc-x86_64-fedora27-linux.tar.xz?job=validate-x86_64-linux-fedora27' head`
|
||||||
|
|
||||||
|
4. isolated install HLS
|
||||||
|
- `ghcup install hls --isolate /home/username/dir/hls/`
|
||||||
|
|
||||||
|
5. you can even compile ghc to an isolated location.
|
||||||
|
- `ghcup compile ghc -j 4 -v 9.0.1 -b 8.10.5 -i /home/username/my/dir/ghc`
|
||||||
|
---
|
||||||
|
|
||||||
### Tips and tricks
|
### Tips and tricks
|
||||||
|
|
||||||
#### with_ghc wrapper (e.g. for HLS)
|
#### with_ghc wrapper (e.g. for HLS)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -275,6 +275,8 @@ find_shell() {
|
|||||||
ask_bashrc() {
|
ask_bashrc() {
|
||||||
if [ -n "${BOOTSTRAP_HASKELL_ADJUST_BASHRC}" ] ; then
|
if [ -n "${BOOTSTRAP_HASKELL_ADJUST_BASHRC}" ] ; then
|
||||||
return 1
|
return 1
|
||||||
|
elif [ -z "${MY_SHELL}" ] ; then
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
@@ -8,21 +8,16 @@ package ghcup
|
|||||||
tests: True
|
tests: True
|
||||||
flags: +tui
|
flags: +tui
|
||||||
|
|
||||||
source-repository-package
|
|
||||||
type: git
|
|
||||||
location: https://github.com/jtdaugherty/brick.git
|
|
||||||
tag: b3b96cfe66dfd398d338e3feb2b6855e66a35190
|
|
||||||
|
|
||||||
source-repository-package
|
|
||||||
type: git
|
|
||||||
location: https://github.com/Bodigrim/tar
|
|
||||||
tag: ac197ec7ea4838dc2b4e22b9b888b080cedf29cf
|
|
||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/bgamari/terminal-size
|
location: https://github.com/bgamari/terminal-size
|
||||||
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
||||||
|
|
||||||
|
source-repository-package
|
||||||
|
type: git
|
||||||
|
location: https://github.com/hasufell/libarchive
|
||||||
|
tag: 024a7e8ab7b4d3848dc64dca1e70a04831eedc99
|
||||||
|
|
||||||
constraints: http-io-streams -brotli
|
constraints: http-io-streams -brotli
|
||||||
|
|
||||||
package libarchive
|
package libarchive
|
||||||
|
|||||||
119
ghcup-0.0.6.yaml
119
ghcup-0.0.6.yaml
@@ -19,6 +19,18 @@ toolRequirements:
|
|||||||
- libncurses5
|
- libncurses5
|
||||||
- libtinfo5
|
- libtinfo5
|
||||||
notes: ''
|
notes: ''
|
||||||
|
">= 11":
|
||||||
|
distroPKGs:
|
||||||
|
- build-essential
|
||||||
|
- curl
|
||||||
|
- libffi-dev
|
||||||
|
- libffi7
|
||||||
|
- libgmp-dev
|
||||||
|
- libgmp10
|
||||||
|
- libncurses-dev
|
||||||
|
- libncurses5
|
||||||
|
- libtinfo5
|
||||||
|
notes: ''
|
||||||
Linux_Ubuntu:
|
Linux_Ubuntu:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
distroPKGs:
|
distroPKGs:
|
||||||
@@ -1872,96 +1884,81 @@ ghcupDownloads:
|
|||||||
dlUri: https://downloads.haskell.org/~ghc/9.0.1/ghc-9.0.1-armv7-deb9-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.0.1/ghc-9.0.1-armv7-deb9-linux.tar.xz
|
||||||
dlSubdir: ghc-9.0.1
|
dlSubdir: ghc-9.0.1
|
||||||
dlHash: 6f404f9b88468407b3a9ec5800bcc2d01dd453ef3d63414853b4fbbd4d8df496
|
dlHash: 6f404f9b88468407b3a9ec5800bcc2d01dd453ef3d63414853b4fbbd4d8df496
|
||||||
9.2.0.20210422:
|
9.2.0.20210821:
|
||||||
viTags:
|
viTags:
|
||||||
- Prerelease
|
- Prerelease
|
||||||
- base-4.16.0.0
|
- base-4.16.0.0
|
||||||
viChangeLog: https://downloads.haskell.org/~ghc/9.2.1-alpha2/docs/html/users_guide/index.html
|
viChangeLog: https://downloads.haskell.org/~ghc/9.2.1-rc1/docs/html/users_guide/index.html
|
||||||
viSourceDL:
|
viSourceDL:
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-src.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-src.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821
|
||||||
dlHash: 69be189e6e7f8d51a9078ac8f177176bc5bff54edc8352974c50c1f0e110df27
|
dlHash: 7c4772d9a22a1774a13f67a570719c339f744b1607fbddfdf4702bb1fbbd57e0
|
||||||
viPostRemove: *ghc-post-remove
|
viPostRemove: *ghc-post-remove
|
||||||
viArch:
|
viArch:
|
||||||
A_64:
|
A_64:
|
||||||
Linux_Debian:
|
Linux_Debian:
|
||||||
'( >= 9 && < 10 )': &ghc-921-alpha2-64-deb9
|
'( >= 9 && < 10 )': &ghc-921-rc1-64-deb9
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-deb9-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-x86_64-deb9-linux.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821
|
||||||
dlHash: 7262f3a230cd6945c588882e03941301877a9eb12e58c5975ad264596c2e12f2
|
dlHash: 4a561cb97f0cbe51de676d4e29968d49beb415a0190514d8f1a8f8ae0405f313
|
||||||
'( >= 10 && < 11 )': &ghc-921-alpha2-64-deb10
|
'( >= 10 && < 11 )': &ghc-921-rc1-64-deb10
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-deb10-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-x86_64-deb10-linux.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821
|
||||||
dlHash: 6d36cd08576bdee7473fee66b4b8ceb72011983a7d5aa3ec587403815a73e37b
|
dlHash: 28112271739b490635e7fd6ed1936949c3a3c41d4a7d95833bb47f420dd1a815
|
||||||
unknown_versioning: *ghc-921-alpha2-64-deb9
|
unknown_versioning: *ghc-921-rc1-64-deb9
|
||||||
Linux_Ubuntu:
|
Linux_Ubuntu:
|
||||||
unknown_versioning: &ghc-921-alpha2-64-fedora
|
unknown_versioning: &ghc-921-rc1-64-fedora
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-fedora27-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-x86_64-fedora27-linux.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821
|
||||||
dlHash: 95624192ff0982690bc9093632d6351fdc6f72e6df380b392449229c39a0354b
|
dlHash: 3c4d3874e4438baf54bdf8bcbdca60a7416ca88c32da1823127dd3159bbede62
|
||||||
'( >= 16 && < 19 )': *ghc-921-alpha2-64-deb9
|
'( >= 16 && < 19 )': *ghc-921-rc1-64-deb9
|
||||||
Linux_Mint:
|
Linux_Mint:
|
||||||
unknown_versioning: *ghc-921-alpha2-64-deb10
|
unknown_versioning: *ghc-921-rc1-64-deb10
|
||||||
Linux_Fedora:
|
Linux_Fedora:
|
||||||
'( >= 27 && < 28 )': *ghc-921-alpha2-64-fedora
|
'( >= 27 && < 28 )': *ghc-921-rc1-64-fedora
|
||||||
unknown_versioning: *ghc-921-alpha2-64-fedora
|
unknown_versioning: *ghc-921-rc1-64-fedora
|
||||||
Linux_CentOS:
|
|
||||||
'( >= 7 && < 8 )': &ghc-921-alpha2-64-centos
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-centos7-linux.tar.xz
|
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
|
||||||
dlHash: dee4f158f2d59bfe97ec3f5773b6b31aa911f9b128a5e56eeefa2dccc754d295
|
|
||||||
unknown_versioning: *ghc-921-alpha2-64-centos
|
|
||||||
Linux_RedHat:
|
|
||||||
unknown_versioning: *ghc-921-alpha2-64-centos
|
|
||||||
Linux_Alpine:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-alpine3.10-linux-integer-simple.tar.xz
|
|
||||||
dlSubdir: ghc-9.2.0.20210422-x86_64-unknown-linux
|
|
||||||
dlHash: f61ae72925325ca7b316e40121e8d6bad94794016d3fa59bcbc8dbe116a7f13c
|
|
||||||
Linux_AmazonLinux:
|
|
||||||
unknown_versioning: *ghc-921-alpha2-64-centos
|
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning: *ghc-921-alpha2-64-fedora
|
unknown_versioning: *ghc-921-rc1-64-fedora
|
||||||
FreeBSD:
|
FreeBSD:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-unknown-freebsd.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-x86_64-unknown-freebsd.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821
|
||||||
dlHash: 195728e02398ea6154fe713b7782a0cae856eb0d9d90f5d09cd0cca610c985e2
|
dlHash: ed31d0ca40588fcbed4f03e83e49abea7babb37e528bb36ab3c1fb6191c4c422
|
||||||
Darwin:
|
Darwin:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-apple-darwin.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-x86_64-apple-darwin.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821-x86_64-apple-darwin
|
||||||
dlHash: 8884c059f2b76e4c4309ff6bd7a7dde37663f751fd26220e9a2bcabb4d69a401
|
dlHash: 38199ca35117cc1f4372a4b6692596f8639688c286d2a0d09bc7336826c05e10
|
||||||
Windows:
|
Windows:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-unknown-mingw32.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-x86_64-unknown-mingw32.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422-x86_64-unknown-mingw32
|
dlSubdir: ghc-9.2.0.20210821-x86_64-unknown-mingw32
|
||||||
dlHash: 33f173b754d18f26bb27f52bb77a92fd22a48675daa2b43a1879bf01dddd7e8f
|
dlHash: 3926620698cb43b9e9a5381b4c3b7b84d22c67b3509a546581aa17afecd6a846
|
||||||
A_32:
|
A_32:
|
||||||
Linux_Debian:
|
Linux_Debian:
|
||||||
'( >= 9 && < 10 )': &ghc-921-alpha2-32-deb9
|
'( >= 9 && < 10 )': &ghc-921-rc1-32-deb9
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-i386-deb9-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-i386-deb9-linux.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821
|
||||||
dlHash: a378ec3fd31a9fa2a7134e98159e189362fe969f04031515616e9cc3182c861a
|
dlHash: 30b25b787a787473988a785606b01099ce077f99d5c08940c0024537433f5084
|
||||||
unknown_versioning: *ghc-921-alpha2-32-deb9
|
unknown_versioning: *ghc-921-rc1-32-deb9
|
||||||
Linux_Ubuntu:
|
Linux_Ubuntu:
|
||||||
unknown_versioning: *ghc-921-alpha2-32-deb9
|
unknown_versioning: *ghc-921-rc1-32-deb9
|
||||||
Linux_Mint:
|
Linux_Mint:
|
||||||
unknown_versioning: *ghc-921-alpha2-32-deb9
|
unknown_versioning: *ghc-921-rc1-32-deb9
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning: *ghc-921-alpha2-32-deb9
|
unknown_versioning: *ghc-921-rc1-32-deb9
|
||||||
A_ARM64:
|
A_ARM64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-aarch64-deb10-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-aarch64-deb10-linux.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821
|
||||||
dlHash: fd2f4d0f6122f752aca396fe1a13e7d14d037dc45806bb0404a031eeeeb1994c
|
dlHash: 289fc361be4a3199ac15449e30405a9831454811dd454e81eab73bfcdd2c4088
|
||||||
A_ARM:
|
A_ARM:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghc/9.2.1-alpha2/ghc-9.2.0.20210422-armv7-deb10-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/9.2.1-rc1/ghc-9.2.0.20210821-armv7-deb10-linux.tar.xz
|
||||||
dlSubdir: ghc-9.2.0.20210422
|
dlSubdir: ghc-9.2.0.20210821
|
||||||
dlHash: dab7d7785d6ccafb130526b666669fc974ba5c90fc9aaf2024f9c65bcbd097d3
|
dlHash: 9ff0be63191181700a1f51c453056c2dab16e11ecb7a4b1dd72e4b7aad5999a6
|
||||||
Cabal:
|
Cabal:
|
||||||
2.4.1.0:
|
2.4.1.0:
|
||||||
viTags:
|
viTags:
|
||||||
|
|||||||
2394
ghcup-0.0.7.yaml
Normal file
2394
ghcup-0.0.7.yaml
Normal file
File diff suppressed because it is too large
Load Diff
38
ghcup.cabal
38
ghcup.cabal
@@ -21,6 +21,7 @@ extra-doc-files:
|
|||||||
ghcup-0.0.4.yaml
|
ghcup-0.0.4.yaml
|
||||||
ghcup-0.0.5.yaml
|
ghcup-0.0.5.yaml
|
||||||
ghcup-0.0.6.yaml
|
ghcup-0.0.6.yaml
|
||||||
|
ghcup-0.0.7.yaml
|
||||||
HACKING.md
|
HACKING.md
|
||||||
README.md
|
README.md
|
||||||
RELEASING.md
|
RELEASING.md
|
||||||
@@ -43,11 +44,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 +106,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 +132,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 +148,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 +161,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 +195,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 +220,7 @@ executable ghcup
|
|||||||
cpp-options: -DBRICK
|
cpp-options: -DBRICK
|
||||||
other-modules: BrickMain
|
other-modules: BrickMain
|
||||||
build-depends:
|
build-depends:
|
||||||
, brick >=0.5 && <0.64
|
, 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 +228,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 +259,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 +272,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
|
||||||
|
|||||||
35
lib/GHCup.hs
35
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 )
|
||||||
@@ -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
|
||||||
@@ -276,7 +270,7 @@ installPackedGHC dl msubdir inst ver = do
|
|||||||
-- unpack
|
-- unpack
|
||||||
tmpUnpack <- lift mkGhcupTmpDir
|
tmpUnpack <- lift mkGhcupTmpDir
|
||||||
liftE $ unpackToDir tmpUnpack dl
|
liftE $ unpackToDir tmpUnpack dl
|
||||||
void $ lift $ darwinNotarization _rPlatform tmpUnpack
|
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
|
||||||
|
|
||||||
-- the subdir of the archive where we do the work
|
-- the subdir of the archive where we do the work
|
||||||
workdir <- maybe (pure tmpUnpack)
|
workdir <- maybe (pure tmpUnpack)
|
||||||
@@ -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
|
||||||
@@ -451,7 +441,7 @@ installCabalBindist dlinfo ver isoFilepath = do
|
|||||||
-- unpack
|
-- unpack
|
||||||
tmpUnpack <- lift withGHCupTmpDir
|
tmpUnpack <- lift withGHCupTmpDir
|
||||||
liftE $ unpackToDir tmpUnpack dl
|
liftE $ unpackToDir tmpUnpack dl
|
||||||
void $ lift $ darwinNotarization _rPlatform tmpUnpack
|
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
|
||||||
|
|
||||||
-- the subdir of the archive where we do the work
|
-- the subdir of the archive where we do the work
|
||||||
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlinfo)
|
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlinfo)
|
||||||
@@ -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
|
||||||
()
|
()
|
||||||
@@ -579,7 +565,7 @@ installHLSBindist dlinfo ver isoFilepath = do
|
|||||||
-- unpack
|
-- unpack
|
||||||
tmpUnpack <- lift withGHCupTmpDir
|
tmpUnpack <- lift withGHCupTmpDir
|
||||||
liftE $ unpackToDir tmpUnpack dl
|
liftE $ unpackToDir tmpUnpack dl
|
||||||
void $ lift $ darwinNotarization _rPlatform tmpUnpack
|
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
|
||||||
|
|
||||||
-- the subdir of the archive where we do the work
|
-- the subdir of the archive where we do the work
|
||||||
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlinfo)
|
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlinfo)
|
||||||
@@ -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
|
||||||
()
|
()
|
||||||
@@ -760,7 +740,7 @@ installStackBindist dlinfo ver isoFilepath = do
|
|||||||
-- unpack
|
-- unpack
|
||||||
tmpUnpack <- lift withGHCupTmpDir
|
tmpUnpack <- lift withGHCupTmpDir
|
||||||
liftE $ unpackToDir tmpUnpack dl
|
liftE $ unpackToDir tmpUnpack dl
|
||||||
void $ lift $ darwinNotarization _rPlatform tmpUnpack
|
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
|
||||||
|
|
||||||
-- the subdir of the archive where we do the work
|
-- the subdir of the archive where we do the work
|
||||||
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlinfo)
|
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlinfo)
|
||||||
@@ -1791,9 +1771,7 @@ compileGHC :: ( MonadMask m
|
|||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, NotInstalled
|
, NotInstalled
|
||||||
, DirNotEmpty
|
, DirNotEmpty
|
||||||
#if !defined(TAR)
|
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
#endif
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
GHCTargetVersion
|
GHCTargetVersion
|
||||||
@@ -1816,7 +1794,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
|
|||||||
-- unpack
|
-- unpack
|
||||||
tmpUnpack <- lift mkGhcupTmpDir
|
tmpUnpack <- lift mkGhcupTmpDir
|
||||||
liftE $ unpackToDir tmpUnpack dl
|
liftE $ unpackToDir tmpUnpack dl
|
||||||
void $ lift $ darwinNotarization _rPlatform tmpUnpack
|
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
|
||||||
|
|
||||||
workdir <- maybe (pure tmpUnpack)
|
workdir <- maybe (pure tmpUnpack)
|
||||||
(liftE . intoSubdir tmpUnpack)
|
(liftE . intoSubdir tmpUnpack)
|
||||||
@@ -1856,7 +1834,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
|
|||||||
ExitSuccess -> throwEither . MP.parse ghcProjectVersion "" . decUTF8Safe' $ _stdOut
|
ExitSuccess -> throwEither . MP.parse ghcProjectVersion "" . decUTF8Safe' $ _stdOut
|
||||||
ExitFailure c -> fail ("Could not figure out GHC project version. Exit code was: " <> show c <> ". Error was: " <> T.unpack (decUTF8Safe' _stdErr))
|
ExitFailure c -> fail ("Could not figure out GHC project version. Exit code was: " <> show c <> ". Error was: " <> T.unpack (decUTF8Safe' _stdErr))
|
||||||
|
|
||||||
void $ lift $ darwinNotarization _rPlatform tmpUnpack
|
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
|
||||||
lift $ $(logInfo) [i|Git version #{ref} corresponds to GHC version #{prettyVer tver}|]
|
lift $ $(logInfo) [i|Git version #{ref} corresponds to GHC version #{prettyVer tver}|]
|
||||||
|
|
||||||
pure (tmpUnpack, tmpUnpack, GHCTargetVersion Nothing tver)
|
pure (tmpUnpack, tmpUnpack, GHCTargetVersion Nothing tver)
|
||||||
@@ -2354,4 +2332,3 @@ whereIsTool tool ver@GHCTargetVersion {..} = do
|
|||||||
liftIO $ canonicalizePath currentRunningExecPath
|
liftIO $ canonicalizePath currentRunningExecPath
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ download uri eDigest dest mfn etags
|
|||||||
|
|
||||||
-- this nonsense is necessary, because some older versions of curl would overwrite
|
-- this nonsense is necessary, because some older versions of curl would overwrite
|
||||||
-- the destination file when 304 is returned
|
-- the destination file when 304 is returned
|
||||||
case fmap T.words . listToMaybe . fmap T.strip . T.lines $ headers of
|
case fmap T.words . listToMaybe . fmap T.strip . T.lines . getLastHeader $ headers of
|
||||||
Just (http':sc:_)
|
Just (http':sc:_)
|
||||||
| sc == "304"
|
| sc == "304"
|
||||||
, T.pack "HTTP" `T.isPrefixOf` http' -> $logDebug [i|Status code was 304, not overwriting|]
|
, T.pack "HTTP" `T.isPrefixOf` http' -> $logDebug [i|Status code was 304, not overwriting|]
|
||||||
@@ -447,7 +447,7 @@ download uri eDigest dest mfn etags
|
|||||||
|
|
||||||
parseEtags :: (MonadLogger m, MonadIO m, MonadThrow m) => T.Text -> m (Maybe T.Text)
|
parseEtags :: (MonadLogger m, MonadIO m, MonadThrow m) => T.Text -> m (Maybe T.Text)
|
||||||
parseEtags stderr = do
|
parseEtags stderr = do
|
||||||
let mEtag = find (\line -> T.pack "etag:" `T.isPrefixOf` T.toLower line) . fmap T.strip . T.lines $ stderr
|
let mEtag = find (\line -> T.pack "etag:" `T.isPrefixOf` T.toLower line) . fmap T.strip . T.lines . getLastHeader $ stderr
|
||||||
case T.words <$> mEtag of
|
case T.words <$> mEtag of
|
||||||
(Just []) -> do
|
(Just []) -> do
|
||||||
$logDebug "Couldn't parse etags, no input: "
|
$logDebug "Couldn't parse etags, no input: "
|
||||||
@@ -585,7 +585,23 @@ getWgetOpts =
|
|||||||
Nothing -> pure []
|
Nothing -> pure []
|
||||||
|
|
||||||
|
|
||||||
|
-- | Get the url base name.
|
||||||
|
--
|
||||||
|
-- >>> urlBaseName "/foo/bar/baz"
|
||||||
|
-- "baz"
|
||||||
urlBaseName :: ByteString -- ^ the url path (without scheme and host)
|
urlBaseName :: ByteString -- ^ the url path (without scheme and host)
|
||||||
-> ByteString
|
-> ByteString
|
||||||
urlBaseName = snd . B.breakEnd (== _slash) . urlDecode False
|
urlBaseName = snd . B.breakEnd (== _slash) . urlDecode False
|
||||||
|
|
||||||
|
|
||||||
|
-- | Curl saves all intermediate connect headers as well, not just the last one, so we make an effort to take the
|
||||||
|
-- last HTTP block only. Passing '--suppress-connect-headers' would be better, but it isn't supported by all versions,
|
||||||
|
-- also see:
|
||||||
|
-- https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/213
|
||||||
|
--
|
||||||
|
-- >>> getLastHeader "\n\nHTTP/1.0 200 Connection established\n\nHTTP/1.1 304 Not Modified\n"
|
||||||
|
-- "HTTP/1.1 304 Not Modified\n"
|
||||||
|
-- >>> getLastHeader "HTTP/1.1 304 Not Modified\n"
|
||||||
|
-- "HTTP/1.1 304 Not Modified\n"
|
||||||
|
getLastHeader :: T.Text -> T.Text
|
||||||
|
getLastHeader = T.unlines . lastDef [] . filter (\x -> not (null x)) . splitOn [""] . fmap T.stripEnd . T.lines
|
||||||
|
|||||||
@@ -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
|
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ data LinuxDistro = Debian
|
|||||||
| RedHat
|
| RedHat
|
||||||
| Alpine
|
| Alpine
|
||||||
| AmazonLinux
|
| AmazonLinux
|
||||||
|
| Solus
|
||||||
-- rolling
|
-- rolling
|
||||||
| Gentoo
|
| Gentoo
|
||||||
| Exherbo
|
| Exherbo
|
||||||
@@ -239,6 +240,7 @@ distroToString CentOS = "centos"
|
|||||||
distroToString RedHat = "redhat"
|
distroToString RedHat = "redhat"
|
||||||
distroToString Alpine = "alpine"
|
distroToString Alpine = "alpine"
|
||||||
distroToString AmazonLinux = "amazon"
|
distroToString AmazonLinux = "amazon"
|
||||||
|
distroToString Solus = "solus"
|
||||||
distroToString Gentoo = "gentoo"
|
distroToString Gentoo = "gentoo"
|
||||||
distroToString Exherbo = "exherbo"
|
distroToString Exherbo = "exherbo"
|
||||||
distroToString UnknownLinux = "unknown"
|
distroToString UnknownLinux = "unknown"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
Module : GHCup.Utils.Prelude
|
Module : GHCup.Utils.Prelude
|
||||||
@@ -29,6 +30,7 @@ import Control.Exception.Safe
|
|||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
|
import Control.Monad.Logger
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
import Data.List ( nub, intercalate )
|
import Data.List ( nub, intercalate )
|
||||||
@@ -39,6 +41,7 @@ import Data.Versions
|
|||||||
import Data.Word8
|
import Data.Word8
|
||||||
import Haskus.Utils.Types.List
|
import Haskus.Utils.Types.List
|
||||||
import Haskus.Utils.Variant.Excepts
|
import Haskus.Utils.Variant.Excepts
|
||||||
|
import Text.PrettyPrint.HughesPJClass ( prettyShow, Pretty )
|
||||||
import System.IO.Error
|
import System.IO.Error
|
||||||
#if defined(IS_WINDOWS)
|
#if defined(IS_WINDOWS)
|
||||||
import System.IO.Temp
|
import System.IO.Temp
|
||||||
@@ -68,6 +71,14 @@ import qualified System.Win32.File as Win32
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
-- $setup
|
||||||
|
-- >>> import Data.ByteString.Internal (c2w, w2c)
|
||||||
|
-- >>> import Test.QuickCheck
|
||||||
|
-- >>> import Data.Word8
|
||||||
|
-- >>> import Data.Word8
|
||||||
|
-- >>> import qualified Data.Text as T
|
||||||
|
-- >>> instance Arbitrary T.Text where arbitrary = T.pack <$> arbitrary
|
||||||
|
|
||||||
|
|
||||||
fS :: IsString a => String -> a
|
fS :: IsString a => String -> a
|
||||||
fS = fromString
|
fS = fromString
|
||||||
@@ -162,6 +173,10 @@ lEM' :: forall e' e es a m
|
|||||||
-> Excepts es m a
|
-> Excepts es m a
|
||||||
lEM' f em = lift em >>= lE . first f
|
lEM' f em = lift em >>= lE . first f
|
||||||
|
|
||||||
|
-- for some obscure reason... this won't type-check if we move it to a different module
|
||||||
|
catchWarn :: forall es m . (Pretty (V es), MonadLogger m, Monad m) => Excepts es m () -> Excepts '[] m ()
|
||||||
|
catchWarn = catchAllE @_ @es (\v -> lift $ $(logWarn) (T.pack . prettyShow $ v))
|
||||||
|
|
||||||
fromEither :: Either a b -> VEither '[a] b
|
fromEither :: Either a b -> VEither '[a] b
|
||||||
fromEither = either (VLeft . V) VRight
|
fromEither = either (VLeft . V) VRight
|
||||||
|
|
||||||
@@ -489,7 +504,14 @@ recover action =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
-- Gathering monoidal values
|
-- | Gathering monoidal values
|
||||||
|
--
|
||||||
|
-- >>> traverseFold (pure . (:["0"])) ["1","2"]
|
||||||
|
-- ["1","0","2","0"]
|
||||||
|
-- >>> traverseFold Just ["1","2","3","4","5"]
|
||||||
|
-- Just "12345"
|
||||||
|
--
|
||||||
|
-- prop> \t -> traverseFold Just t === Just (mconcat t)
|
||||||
traverseFold :: (Foldable t, Applicative m, Monoid b) => (a -> m b) -> t a -> m b
|
traverseFold :: (Foldable t, Applicative m, Monoid b) => (a -> m b) -> t a -> m b
|
||||||
traverseFold f = foldl (\mb a -> (<>) <$> mb <*> f a) (pure mempty)
|
traverseFold f = foldl (\mb a -> (<>) <$> mb <*> f a) (pure mempty)
|
||||||
|
|
||||||
@@ -499,6 +521,16 @@ forFold = \t -> (`traverseFold` t)
|
|||||||
|
|
||||||
|
|
||||||
-- | Strip @\\r@ and @\\n@ from 'ByteString's
|
-- | Strip @\\r@ and @\\n@ from 'ByteString's
|
||||||
|
--
|
||||||
|
-- >>> stripNewline "foo\n\n\n"
|
||||||
|
-- "foo"
|
||||||
|
-- >>> stripNewline "foo\r"
|
||||||
|
-- "foo"
|
||||||
|
-- >>> stripNewline "foo"
|
||||||
|
-- "foo"
|
||||||
|
--
|
||||||
|
-- prop> \t -> stripNewline (t <> "\n") === stripNewline t
|
||||||
|
-- prop> \t -> not (any (isNewLine . c2w) t) ==> stripNewline t == t
|
||||||
stripNewline :: String -> String
|
stripNewline :: String -> String
|
||||||
stripNewline s
|
stripNewline s
|
||||||
| null s = []
|
| null s = []
|
||||||
@@ -507,6 +539,16 @@ stripNewline s
|
|||||||
|
|
||||||
|
|
||||||
-- | Strip @\\r@ and @\\n@ from 'ByteString's
|
-- | Strip @\\r@ and @\\n@ from 'ByteString's
|
||||||
|
--
|
||||||
|
-- >>> stripNewline' "foo\n\n\n"
|
||||||
|
-- "foo"
|
||||||
|
-- >>> stripNewline' "foo\r"
|
||||||
|
-- "foo"
|
||||||
|
-- >>> stripNewline' "foo"
|
||||||
|
-- "foo"
|
||||||
|
--
|
||||||
|
-- prop> \t -> stripNewline' (t <> "\n") === stripNewline' t
|
||||||
|
-- prop> \t -> not (T.any (isNewLine . c2w) t) ==> stripNewline' t == t
|
||||||
stripNewline' :: T.Text -> T.Text
|
stripNewline' :: T.Text -> T.Text
|
||||||
stripNewline' s
|
stripNewline' s
|
||||||
| T.null s = mempty
|
| T.null s = mempty
|
||||||
@@ -514,6 +556,14 @@ stripNewline' s
|
|||||||
| otherwise = T.singleton (T.head s) <> stripNewline' (T.tail s)
|
| otherwise = T.singleton (T.head s) <> stripNewline' (T.tail s)
|
||||||
|
|
||||||
|
|
||||||
|
-- | Is the word8 a newline?
|
||||||
|
--
|
||||||
|
-- >>> isNewLine (c2w '\n')
|
||||||
|
-- True
|
||||||
|
-- >>> isNewLine (c2w '\r')
|
||||||
|
-- True
|
||||||
|
--
|
||||||
|
-- prop> \w -> w /= _lf && w /= _cr ==> not (isNewLine w)
|
||||||
isNewLine :: Word8 -> Bool
|
isNewLine :: Word8 -> Bool
|
||||||
isNewLine w
|
isNewLine w
|
||||||
| w == _lf = True
|
| w == _lf = True
|
||||||
@@ -523,8 +573,10 @@ isNewLine w
|
|||||||
|
|
||||||
-- | Split on a PVP suffix.
|
-- | Split on a PVP suffix.
|
||||||
--
|
--
|
||||||
-- >>> splitOnPVP "-" "ghc-iserv-dyn-9.3.20210706" == ("ghc-iserv-dyn", "9.3.20210706")
|
-- >>> splitOnPVP "-" "ghc-iserv-dyn-9.3.20210706"
|
||||||
-- >>> splitOnPVP "-" "ghc-iserv-dyn" == ("ghc-iserv-dyn", "")
|
-- ("ghc-iserv-dyn","9.3.20210706")
|
||||||
|
-- >>> splitOnPVP "-" "ghc-iserv-dyn"
|
||||||
|
-- ("ghc-iserv-dyn","")
|
||||||
splitOnPVP :: String -> String -> (String, String)
|
splitOnPVP :: String -> String -> (String, String)
|
||||||
splitOnPVP c s = case Split.splitOn c s of
|
splitOnPVP c s = case Split.splitOn c s of
|
||||||
[] -> def
|
[] -> def
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import qualified Data.Text as T
|
|||||||
|
|
||||||
-- | This reflects the API version of the YAML.
|
-- | This reflects the API version of the YAML.
|
||||||
ghcupURL :: URI
|
ghcupURL :: URI
|
||||||
ghcupURL = [uri|https://www.haskell.org/ghcup/data/ghcup-0.0.6.yaml|]
|
ghcupURL = [uri|https://www.haskell.org/ghcup/data/ghcup-0.0.7.yaml|]
|
||||||
|
|
||||||
-- | The current ghcup version.
|
-- | The current ghcup version.
|
||||||
ghcUpVer :: PVP
|
ghcUpVer :: PVP
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ extra-deps:
|
|||||||
- git: https://github.com/Bodigrim/tar
|
- git: https://github.com/Bodigrim/tar
|
||||||
commit: ac197ec7ea4838dc2b4e22b9b888b080cedf29cf
|
commit: ac197ec7ea4838dc2b4e22b9b888b080cedf29cf
|
||||||
|
|
||||||
- git: https://github.com/jtdaugherty/brick.git
|
- brick-0.64@sha256:f03fa14607c22cf48af99e24c44f79a0fb073f7ec229f15e969fed9ff73c93f6,16530
|
||||||
commit: b3b96cfe66dfd398d338e3feb2b6855e66a35190
|
|
||||||
|
|
||||||
- IfElse-0.85@sha256:6939b94acc6a55f545f63a168a349dd2fbe4b9a7cca73bf60282db5cc6aa47d2,445
|
- IfElse-0.85@sha256:6939b94acc6a55f545f63a168a349dd2fbe4b9a7cca73bf60282db5cc6aa47d2,445
|
||||||
- ascii-string-1.0.1.4@sha256:fa34f1d9ba57e8e89c0d4c9cef5e01ba32cb2d4373d13f92dcc0b531a6c6749b,2582
|
- ascii-string-1.0.1.4@sha256:fa34f1d9ba57e8e89c0d4c9cef5e01ba32cb2d4373d13f92dcc0b531a6c6749b,2582
|
||||||
- base16-bytestring-0.1.1.7@sha256:0021256a9628971c08da95cb8f4d0d72192f3bb8a7b30b55c080562d17c43dd3,2231
|
- base16-bytestring-0.1.1.7@sha256:0021256a9628971c08da95cb8f4d0d72192f3bb8a7b30b55c080562d17c43dd3,2231
|
||||||
|
|||||||
Reference in New Issue
Block a user