Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b3105b439c | |||
| 2b6cb5f1a8 | |||
| f4242b10e7 | |||
| ad4d185ead | |||
| b18aafe2c4 | |||
| 340196bf9d | |||
| 883226aa70 | |||
| 0d393612a7 | |||
| 5635f6cc4e | |||
| a7fd36beeb | |||
| baee1d5b85 | |||
| 68df6b8e50 | |||
| ac73090784 | |||
| faf4f3b7ca | |||
| d888d11d59 | |||
| 28a1077833 | |||
| c40b9dbc0b | |||
| 6bbd262818 | |||
| 78d36bce24 | |||
| aedfc19220 | |||
| 2f34fc7bef |
78
.gitlab-ci.yml
Normal file
78
.gitlab-ci.yml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
variables:
|
||||||
|
GIT_SSL_NO_VERIFY: "1"
|
||||||
|
|
||||||
|
# Commit of ghc/ci-images repository from which to pull Docker images
|
||||||
|
DOCKER_REV: cefaee3c742af193e0f7783f87edb0d35374515c
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
# CI Step
|
||||||
|
############################################################
|
||||||
|
|
||||||
|
.debian:
|
||||||
|
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
|
||||||
|
tags:
|
||||||
|
- x86_64-linux
|
||||||
|
|
||||||
|
.darwin:
|
||||||
|
tags:
|
||||||
|
- x86_64-darwin
|
||||||
|
|
||||||
|
.test_ghcup_version:
|
||||||
|
script:
|
||||||
|
- ./.gitlab/script/ghcup_version.sh
|
||||||
|
variables:
|
||||||
|
JSON_VERSION: "0.0.1"
|
||||||
|
|
||||||
|
.test_ghcup_version:linux:
|
||||||
|
extends:
|
||||||
|
- .test_ghcup_version
|
||||||
|
- .debian
|
||||||
|
before_script:
|
||||||
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
|
variables:
|
||||||
|
OS: "LINUX"
|
||||||
|
|
||||||
|
.test_ghcup_version:darwin:
|
||||||
|
extends:
|
||||||
|
- .test_ghcup_version
|
||||||
|
- .darwin
|
||||||
|
before_script:
|
||||||
|
- ./.gitlab/before_script/darwin/install_deps.sh
|
||||||
|
variables:
|
||||||
|
OS: "DARWIN"
|
||||||
|
after_script:
|
||||||
|
- BUILD_DIR=$CI_PROJECT_DIR
|
||||||
|
- echo "Cleaning $BUILD_DIR"
|
||||||
|
- cd $HOME
|
||||||
|
- rm -Rf "$BUILD_DIR"/*
|
||||||
|
- exit 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
######## linux ########
|
||||||
|
|
||||||
|
test:linux:recommended:
|
||||||
|
extends: .test_ghcup_version:linux
|
||||||
|
variables:
|
||||||
|
GHC_VERSION: "recommended"
|
||||||
|
|
||||||
|
test:linux:latest:
|
||||||
|
extends: .test_ghcup_version:linux
|
||||||
|
variables:
|
||||||
|
GHC_VERSION: "latest"
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
|
||||||
|
######## darwin ########
|
||||||
|
|
||||||
|
test:mac:recommended:
|
||||||
|
extends: .test_ghcup_version:darwin
|
||||||
|
variables:
|
||||||
|
GHC_VERSION: "recommended"
|
||||||
|
|
||||||
|
test:mac:latest:
|
||||||
|
extends: .test_ghcup_version:darwin
|
||||||
|
variables:
|
||||||
|
GHC_VERSION: "latest"
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
14
.gitlab/before_script/darwin/install_deps.sh
Executable file
14
.gitlab/before_script/darwin/install_deps.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
. "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env"
|
||||||
|
|
||||||
|
curl -sSfL https://gitlab.haskell.org/haskell/ghcup/-/raw/master/ghcup > ./ghcup-legacy
|
||||||
|
chmod +x ghcup-legacy
|
||||||
|
|
||||||
|
./ghcup-legacy install ${GHC_VERSION}
|
||||||
|
./ghcup-legacy set ${GHC_VERSION}
|
||||||
|
./ghcup-legacy install-cabal
|
||||||
|
|
||||||
|
exit 0
|
||||||
16
.gitlab/before_script/linux/install_deps.sh
Executable file
16
.gitlab/before_script/linux/install_deps.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev
|
||||||
|
|
||||||
|
. "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env"
|
||||||
|
|
||||||
|
curl -sSfL https://gitlab.haskell.org/haskell/ghcup/-/raw/master/ghcup > ./ghcup-legacy
|
||||||
|
chmod +x ghcup-legacy
|
||||||
|
|
||||||
|
./ghcup-legacy install ${GHC_VERSION}
|
||||||
|
./ghcup-legacy set ${GHC_VERSION}
|
||||||
|
./ghcup-legacy install-cabal
|
||||||
|
|
||||||
3
.gitlab/ghcup_env
Normal file
3
.gitlab/ghcup_env
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
|
||||||
|
export PATH="$CI_PROJECT_DIR/.ghcup/bin:$CI_PROJECT_DIR/.local/bin:$PATH"
|
||||||
|
|
||||||
58
.gitlab/script/ghcup_version.sh
Executable file
58
.gitlab/script/ghcup_version.sh
Executable file
@@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
. "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup_env"
|
||||||
|
|
||||||
|
mkdir -p "$CI_PROJECT_DIR"/.local/bin
|
||||||
|
|
||||||
|
ecabal() {
|
||||||
|
cabal --store-dir="$(pwd)"/.store "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# build
|
||||||
|
ecabal update
|
||||||
|
|
||||||
|
if [ "${OS}" = "DARWIN" ] ; then
|
||||||
|
ecabal build -fcurl
|
||||||
|
else
|
||||||
|
ecabal build
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup')" .
|
||||||
|
cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup-gen')" .
|
||||||
|
|
||||||
|
|
||||||
|
# testing
|
||||||
|
|
||||||
|
cp ./ghcup "$CI_PROJECT_DIR"/.local/bin/ghcup
|
||||||
|
cp ./ghcup-gen "$CI_PROJECT_DIR"/.local/bin/ghcup-gen
|
||||||
|
rm -rf "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup
|
||||||
|
|
||||||
|
ghcup-gen check -f ghcup-${JSON_VERSION}.json
|
||||||
|
|
||||||
|
ghcup numeric-version
|
||||||
|
|
||||||
|
ghcup -v -c install ${GHC_VERSION}
|
||||||
|
ghcup -v -c set ${GHC_VERSION}
|
||||||
|
ghcup -v -c install-cabal
|
||||||
|
|
||||||
|
cabal --version
|
||||||
|
|
||||||
|
ghcup -v -c debug-info
|
||||||
|
|
||||||
|
ghcup -v -c list
|
||||||
|
ghcup -v -c list -t ghc
|
||||||
|
ghcup -v -c list -t cabal
|
||||||
|
|
||||||
|
ghc --version
|
||||||
|
ghci --version
|
||||||
|
ghc-$(ghc --numeric-version) --version
|
||||||
|
ghci-$(ghc --numeric-version) --version
|
||||||
|
|
||||||
|
ghcup -v upgrade
|
||||||
|
ghcup -v upgrade -f
|
||||||
|
|
||||||
|
ghcup -v rm $(ghc --numeric-version)
|
||||||
|
|
||||||
23
.travis.yml
23
.travis.yml
@@ -4,39 +4,22 @@ jobs:
|
|||||||
osx_image: xcode10.1
|
osx_image: xcode10.1
|
||||||
language: generic
|
language: generic
|
||||||
env: ARTIFACT=x86_64-apple-darwin-10.13-ghcup
|
env: ARTIFACT=x86_64-apple-darwin-10.13-ghcup
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- curl
|
|
||||||
- libffi
|
|
||||||
- libiconv
|
|
||||||
- make
|
|
||||||
- ncurses
|
|
||||||
- xz
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode11.3
|
osx_image: xcode11.3
|
||||||
language: generic
|
language: generic
|
||||||
env: ARTIFACT=x86_64-apple-darwin-10.14-ghcup
|
env: ARTIFACT=x86_64-apple-darwin-10.14-ghcup
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- curl
|
|
||||||
- libffi
|
|
||||||
- libiconv
|
|
||||||
- make
|
|
||||||
- ncurses
|
|
||||||
- xz
|
|
||||||
|
|
||||||
script: ".travis/build.sh"
|
script: ".travis/build.sh"
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
api_key:
|
api_key:
|
||||||
secure: GEQR+HIwMUql+tFU0LoKCCzG+IG1s5XVA4yp8xMFk0IPsNjHEMh6djYgNqsS6MnujzRulinZe69RyJMZHW3UbtVKWd1D5nsCKmAVfnU8VRbubaL55Bz7C2WI9UCYtKY0isVIQu3KkY+0a6LhdjSkbatO2hl9v0nFmN28q/RpEzsJTI4kyVhmCBflH4fL/QvXzfLuyOae7qsiZBVQXEhmySYktKifNMANSI1aU+kyZ3JgykqZogMK+g/fmcxxTe9MPYMsRQxae/xqdf87IQpmK8v9BRShvF0wq1gO8NY+/fEemAVIHi5CYhPgiLntUD/HFr6AT04LcHnaGryDn/PhkvHuDuZ4INYgBrdNMeGVTjT93N7OtXyh7c+AP3/51E8nM0SkSWCeP4P2fMMksdeOnKtPbhzlqgEM9tbRMILOj1LcjcqurU5ku+WEwZ7d1osTyNug7FVCO5Vb0q3NYnDF4UPXc/d5/2SB+SjJSMxRc52+BiKskHmOa96TXirL3eo6KVNaokQRKvbLw1fEjZvqYJuhPWBRDMalyYjc77poj4kzfVL9CYjtP7h6N5wFR7AtPsMz2n2fQf7J3N4+oqHK+83fOPGyy4FYPZojKNw+L2X/XYrfVscsY/1KbBjULgGIrdr4euYz+rRrTHixUYIvGclKOx+g3SHAOXFWhXlldvI=
|
secure: GQESg4TcYf3PQJRRaZV/kWS0hsF+OFnH2+EcwpgnIcfx4+aogMyprdh745KtBXe1FlFN1luKHksFjqceqhcg/xcNyeCJiSnLWMn4D/i4WUperEHseRBi5yZZCB1AvOjIlHrE4DS3a8pyEm1GV3G7CKY5Fu8jBjof2SnyENfd7fofhjtNHWmeFS+jBn8HRDf1YaSRYxzTw6uHLrPLsybfgQZVl7babMu/38Ghin0f5pz5OlNokzDxaubIYQHOZ7st7YndHJtBWWql/KualBWbMILy88dUVQBnbqQLP2P8d1ME8ILUjJVqz33HiRU0JzlEJyWfbvEjcJ6iD8M6n4nXTaxfu3i2UhhGsQ6SSBNKssMP4tji8nkNpMqG59wLQ/zhcetEm71fKkgJNrIMNllkqlWSo5K74IqqP9kiLg/qm8ipOJjui0gPk8tZXKcV+ztX1d1OVCapoLfiDM5l/0LLQXaTOXOV1x3e5LLQ/w2doNiH3eh5CV4II9dRu7owpaiiMBHMssmT0pH99jEeF6giHLKtt3y7l2GWoRLPdhsZZ54gxsaBxZt9GuypmkbNcr97CEnAVaWij5v0CF3w4rAWqy/tAxQpIDJOIOQBgmwG5WrBAKyKrFvEpBL5a8BPcRWJDvqKC83QeWpvPrEVdgJevC6ZN1MKzrb2SiPOwC2Kerc=
|
||||||
file: $ARTIFACT
|
file: $ARTIFACT
|
||||||
on:
|
on:
|
||||||
repo: hasufell/ghcup-hs
|
repo: haskell/ghcup-hs
|
||||||
tags: true
|
tags: true
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
draft: true
|
draft: true
|
||||||
|
|
||||||
|
|||||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,5 +1,15 @@
|
|||||||
# Revision history for ghcup
|
# Revision history for ghcup
|
||||||
|
|
||||||
## 0.1.0.0 -- YYYY-mm-dd
|
## 0.1.2 -- 2020-04-15
|
||||||
|
|
||||||
|
* Fix bug when removing the set GHC version
|
||||||
|
* Fix use of undocumented `GHCUP_INSTALL_BASE_PREFIX` variable
|
||||||
|
* skip upgrade if ghcup is already latest version
|
||||||
|
|
||||||
|
## 0.1.1 -- 2020-04-15
|
||||||
|
|
||||||
|
* fix awful fdopendir bug on mac bug by updating hpath-posix
|
||||||
|
|
||||||
|
## 0.1.0
|
||||||
|
|
||||||
* First version. Released on an unsuspecting world.
|
* First version. Released on an unsuspecting world.
|
||||||
|
|||||||
18
HACKING.md
18
HACKING.md
@@ -16,7 +16,23 @@ I consider haskell-TLS an interesting experiment, but not a battle-tested and pe
|
|||||||
|
|
||||||
### Optics instead of lens
|
### Optics instead of lens
|
||||||
|
|
||||||
They're a little safer (less Monoid weirdness with view) and have better error messages. Consider: `view (_Just . to (++ "abc")) Nothing` (lens) vs `view (_Just % to (++ "abc")) Nothing` (optics). The latter does not compile (good).
|
They're a little safer (less Monoid weirdness with view) and have better error messages. Consider the following wit lens
|
||||||
|
|
||||||
|
```
|
||||||
|
> view (_Just . to (++ "abc")) Nothing
|
||||||
|
""
|
||||||
|
```
|
||||||
|
|
||||||
|
vs optics
|
||||||
|
|
||||||
|
```
|
||||||
|
> view (_Just % to (++ "abc")) Nothing
|
||||||
|
|
||||||
|
<interactive>:2:1: error:
|
||||||
|
• An_AffineFold cannot be used as A_Getter
|
||||||
|
• In the expression: view (_Just % to (++ "abc")) Nothing
|
||||||
|
In an equation for ‘it’: it = view (_Just % to (++ "abc")) Nothing
|
||||||
|
```
|
||||||
|
|
||||||
### Strict and StrictData on by default
|
### Strict and StrictData on by default
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Follow the instructions at [https://www.haskell.org/ghcup/](https://www.haskell.
|
|||||||
|
|
||||||
### Manual install
|
### Manual install
|
||||||
|
|
||||||
Download the binary for your platform at [https://github.com/hasufell/ghcup-hs/releases](https://github.com/hasufell/ghcup-hs/releases)
|
Download the binary for your platform at [https://downloads.haskell.org/~ghcup/](https://downloads.haskell.org/~ghcup/)
|
||||||
and place it into your `PATH` anywhere.
|
and place it into your `PATH` anywhere.
|
||||||
|
|
||||||
Then adjust your `PATH` in `~/.bashrc` (or similar, depending on your shell) like so:
|
Then adjust your `PATH` in `~/.bashrc` (or similar, depending on your shell) like so:
|
||||||
|
|||||||
21
TODO.md
21
TODO.md
@@ -2,23 +2,7 @@
|
|||||||
|
|
||||||
## Now
|
## Now
|
||||||
|
|
||||||
* travis
|
* move out GHCup.Version module, bc it's not library-ish
|
||||||
|
|
||||||
* requirements
|
|
||||||
* for ghcup (bootstrap script)
|
|
||||||
* per tool
|
|
||||||
* mac build: xattr -cr .
|
|
||||||
* static binaries
|
|
||||||
* upgrade plan from old ghcup
|
|
||||||
|
|
||||||
* bootstrap-haskell with new ghcup
|
|
||||||
* add warning to ghcup script about new binary
|
|
||||||
|
|
||||||
* make sure smart-dl is not broken
|
|
||||||
|
|
||||||
* handle SIGINT better (remove dirs)
|
|
||||||
|
|
||||||
* review symlink handling (maybe fixed set of tools?)
|
|
||||||
|
|
||||||
## Maybe
|
## Maybe
|
||||||
|
|
||||||
@@ -28,16 +12,17 @@
|
|||||||
|
|
||||||
## Later
|
## Later
|
||||||
|
|
||||||
|
* i386 support
|
||||||
* add support for RC/alpha/HEAD versions
|
* add support for RC/alpha/HEAD versions
|
||||||
|
|
||||||
## Cleanups
|
## Cleanups
|
||||||
|
|
||||||
|
* too many decodeutf8
|
||||||
* avoid alternative for IO
|
* avoid alternative for IO
|
||||||
* use plucky or oops instead of Excepts
|
* use plucky or oops instead of Excepts
|
||||||
|
|
||||||
## Questions
|
## Questions
|
||||||
|
|
||||||
* fully static musl builds for linux?
|
|
||||||
* mirror support
|
* mirror support
|
||||||
* interactive handling when distro doesn't exist and we know the tarball is incompatible?
|
* interactive handling when distro doesn't exist and we know the tarball is incompatible?
|
||||||
* ghcup-with wrapper to execute a command with a given ghc in PATH?
|
* ghcup-with wrapper to execute a command with a given ghc in PATH?
|
||||||
|
|||||||
@@ -984,32 +984,33 @@ cabal_3200_64_darwin = DownloadInfo
|
|||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
||||||
ghcup_010_64_linux :: DownloadInfo
|
ghcup_011_32_linux :: DownloadInfo
|
||||||
ghcup_010_64_linux = DownloadInfo
|
ghcup_011_32_linux = DownloadInfo
|
||||||
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-linux-ghcup-0.1.0|]
|
[uri|https://downloads.haskell.org/ghcup/0.1.1/i386-linux-ghcup-0.1.1|]
|
||||||
Nothing
|
Nothing
|
||||||
"b2dc576926c74336805a30c647056eeb1b4204742bcfc5c51680d4e7c34b87a1"
|
"f576f22efdcf17fa18189b65d70e596d14f2347ef549a00592ef28d529c7d5a0"
|
||||||
|
|
||||||
|
|
||||||
ghcup_010_64_freebsd :: DownloadInfo
|
ghcup_011_64_linux :: DownloadInfo
|
||||||
ghcup_010_64_freebsd = DownloadInfo
|
ghcup_011_64_linux = DownloadInfo
|
||||||
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0|]
|
[uri|https://downloads.haskell.org/ghcup/0.1.1/x86_64-linux-ghcup-0.1.1|]
|
||||||
Nothing
|
Nothing
|
||||||
"d300e36beb63eb5199169b669cc0550e581d871f404f2ce1a2581829c1d2f431"
|
"2789fbab2848e4dfd77406b9a710c925b3b9680ac0f8486caca190628646486f"
|
||||||
|
|
||||||
|
|
||||||
ghcup_010_64_darwin10_13 :: DownloadInfo
|
ghcup_011_64_freebsd :: DownloadInfo
|
||||||
ghcup_010_64_darwin10_13 = DownloadInfo
|
ghcup_011_64_freebsd = DownloadInfo
|
||||||
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0|]
|
[uri|https://downloads.haskell.org/ghcup/0.1.1/x86_64-portbld-freebsd-ghcup-0.1.1|]
|
||||||
Nothing
|
Nothing
|
||||||
"3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32"
|
"1336585b15692d6458edf4d913fd585d9963a708e2c952a71ee1ad3400ed2163"
|
||||||
|
|
||||||
|
|
||||||
ghcup_010_64_darwin10_14 :: DownloadInfo
|
ghcup_011_64_darwin10_13 :: DownloadInfo
|
||||||
ghcup_010_64_darwin10_14 = DownloadInfo
|
ghcup_011_64_darwin10_13 = DownloadInfo
|
||||||
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0|]
|
[uri|https://downloads.haskell.org/ghcup/0.1.1/x86_64-apple-darwin-ghcup-0.1.1|]
|
||||||
Nothing
|
Nothing
|
||||||
"f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9"
|
"b9694de40134e3d17611749eba94d8e4d00a84e2a16bb2409eab1e87f810dacd"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1876,22 +1877,19 @@ ghcupDownloads = M.fromList
|
|||||||
)
|
)
|
||||||
, ( GHCup
|
, ( GHCup
|
||||||
, M.fromList
|
, M.fromList
|
||||||
[ ( [vver|0.1.0|]
|
[ ( [vver|0.1.1|]
|
||||||
, VersionInfo [Recommended, Latest] Nothing $ M.fromList
|
, VersionInfo [Recommended, Latest] Nothing $ M.fromList
|
||||||
[ ( A_64
|
[ ( A_64
|
||||||
, M.fromList
|
, M.fromList
|
||||||
[ (Linux UnknownLinux, M.fromList [(Nothing, ghcup_010_64_linux)])
|
[ (Linux UnknownLinux, M.fromList [(Nothing, ghcup_011_64_linux)])
|
||||||
, ( Darwin
|
, (Darwin, M.fromList [(Nothing, ghcup_011_64_darwin10_13)])
|
||||||
, M.fromList
|
, (FreeBSD, M.fromList [(Nothing, ghcup_011_64_freebsd)])
|
||||||
[ (Nothing , ghcup_010_64_darwin10_13)
|
|
||||||
, (Just [vers|10.13|], ghcup_010_64_darwin10_13)
|
|
||||||
, (Just [vers|10.14|], ghcup_010_64_darwin10_14)
|
|
||||||
, (Just [vers|10.15|], ghcup_010_64_darwin10_14)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
, (FreeBSD, M.fromList [(Nothing, ghcup_010_64_freebsd)])
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
, ( A_32
|
||||||
|
, M.fromList
|
||||||
|
[(Linux UnknownLinux, M.fromList [(Nothing, ghcup_011_32_linux)])]
|
||||||
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE TypeApplications #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE DuplicateRecordFields #-}
|
{-# LANGUAGE DuplicateRecordFields #-}
|
||||||
|
{-# LANGUAGE NamedFieldPuns #-}
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE TypeApplications #-}
|
||||||
|
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
@@ -14,7 +15,7 @@ import GHCup.Types.JSON ( )
|
|||||||
import GHCup.Utils.Logger
|
import GHCup.Utils.Logger
|
||||||
import GHCupInfo
|
import GHCupInfo
|
||||||
|
|
||||||
import Data.Aeson ( eitherDecode )
|
import Data.Aeson ( eitherDecode, encode )
|
||||||
import Data.Aeson.Encode.Pretty
|
import Data.Aeson.Encode.Pretty
|
||||||
#if !MIN_VERSION_base(4,13,0)
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
import Data.Semigroup ( (<>) )
|
import Data.Semigroup ( (<>) )
|
||||||
@@ -61,10 +62,13 @@ outputP = fileOutput <|> stdOutput
|
|||||||
|
|
||||||
data GenJSONOpts = GenJSONOpts
|
data GenJSONOpts = GenJSONOpts
|
||||||
{ output :: Maybe Output
|
{ output :: Maybe Output
|
||||||
|
, pretty :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
genJSONOpts :: Parser GenJSONOpts
|
genJSONOpts :: Parser GenJSONOpts
|
||||||
genJSONOpts = GenJSONOpts <$> optional outputP
|
genJSONOpts = GenJSONOpts <$> optional outputP <*> switch
|
||||||
|
(short 'p' <> long "pretty" <> help "Make JSON output pretty (human readable)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
data Input
|
data Input
|
||||||
@@ -134,14 +138,16 @@ main = do
|
|||||||
customExecParser (prefs showHelpOnError) (info (opts <**> helper) idm)
|
customExecParser (prefs showHelpOnError) (info (opts <**> helper) idm)
|
||||||
>>= \Options {..} -> case optCommand of
|
>>= \Options {..} -> case optCommand of
|
||||||
GenJSON gopts -> do
|
GenJSON gopts -> do
|
||||||
let
|
let bs True =
|
||||||
bs = encodePretty' (defConfig { confIndent = Spaces 2 })
|
encodePretty' (defConfig { confIndent = Spaces 2 }) ghcupInfo
|
||||||
ghcupInfo
|
bs False = encode ghcupInfo
|
||||||
case gopts of
|
case gopts of
|
||||||
GenJSONOpts { output = Nothing } -> L.hPutStr stdout bs
|
GenJSONOpts { output = Nothing, pretty } ->
|
||||||
GenJSONOpts { output = Just StdOutput } -> L.hPutStr stdout bs
|
L.hPutStr stdout (bs pretty)
|
||||||
GenJSONOpts { output = Just (FileOutput file) } ->
|
GenJSONOpts { output = Just StdOutput, pretty } ->
|
||||||
L.writeFile file bs
|
L.hPutStr stdout (bs pretty)
|
||||||
|
GenJSONOpts { output = Just (FileOutput file), pretty } ->
|
||||||
|
L.writeFile file (bs pretty)
|
||||||
ValidateJSON vopts -> case vopts of
|
ValidateJSON vopts -> case vopts of
|
||||||
ValidateJSONOpts { input = Nothing } ->
|
ValidateJSONOpts { input = Nothing } ->
|
||||||
L.getContents >>= valAndExit validate
|
L.getContents >>= valAndExit validate
|
||||||
@@ -165,4 +171,3 @@ main = do
|
|||||||
Left e -> die (color Red $ show e)
|
Left e -> die (color Red $ show e)
|
||||||
myLoggerT (LoggerConfig True (B.hPut stdout) (\_ -> pure ())) (f av)
|
myLoggerT (LoggerConfig True (B.hPut stdout) (\_ -> pure ())) (f av)
|
||||||
>>= exitWith
|
>>= exitWith
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ data Command
|
|||||||
| Rm RmOptions
|
| Rm RmOptions
|
||||||
| DInfo
|
| DInfo
|
||||||
| Compile CompileCommand
|
| Compile CompileCommand
|
||||||
| Upgrade UpgradeOpts
|
| Upgrade UpgradeOpts Bool
|
||||||
| NumericVersion
|
| NumericVersion
|
||||||
| ToolRequirements
|
| ToolRequirements
|
||||||
|
|
||||||
@@ -194,9 +194,12 @@ com =
|
|||||||
)
|
)
|
||||||
<> command
|
<> command
|
||||||
"upgrade"
|
"upgrade"
|
||||||
( Upgrade
|
(info ((Upgrade <$> upgradeOptsP <*>
|
||||||
<$> (info (upgradeOptsP <**> helper) (progDesc "Upgrade ghcup"))
|
switch
|
||||||
)
|
(short 'f' <> long "force" <> help
|
||||||
|
"Force update"
|
||||||
|
)
|
||||||
|
) <**> helper) (progDesc "Upgrade ghcup"))
|
||||||
<> command
|
<> command
|
||||||
"compile"
|
"compile"
|
||||||
( Compile
|
( Compile
|
||||||
@@ -626,6 +629,7 @@ main = do
|
|||||||
, NoCompatiblePlatform
|
, NoCompatiblePlatform
|
||||||
, NoCompatibleArch
|
, NoCompatibleArch
|
||||||
, NoDownload
|
, NoDownload
|
||||||
|
, NoUpdate
|
||||||
, FileDoesNotExistError
|
, FileDoesNotExistError
|
||||||
, CopyError
|
, CopyError
|
||||||
, DownloadFailed
|
, DownloadFailed
|
||||||
@@ -770,7 +774,7 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
|
|||||||
VLeft e ->
|
VLeft e ->
|
||||||
runLogger ($(logError) [i|#{e}|]) >> exitFailure
|
runLogger ($(logError) [i|#{e}|]) >> exitFailure
|
||||||
|
|
||||||
Upgrade (uOpts) -> do
|
Upgrade (uOpts) force -> do
|
||||||
target <- case uOpts of
|
target <- case uOpts of
|
||||||
UpgradeInplace -> do
|
UpgradeInplace -> do
|
||||||
efp <- liftIO $ getExecutablePath
|
efp <- liftIO $ getExecutablePath
|
||||||
@@ -783,7 +787,7 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
|
|||||||
|
|
||||||
void
|
void
|
||||||
$ (runUpgrade $ do
|
$ (runUpgrade $ do
|
||||||
liftE $ upgradeGHCup dls target
|
liftE $ upgradeGHCup dls target force
|
||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight v' -> do
|
VRight v' -> do
|
||||||
@@ -791,6 +795,9 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
|
|||||||
runLogger
|
runLogger
|
||||||
$ $(logInfo)
|
$ $(logInfo)
|
||||||
[i|Successfully upgraded GHCup to version #{pretty_v}|]
|
[i|Successfully upgraded GHCup to version #{pretty_v}|]
|
||||||
|
VLeft (V NoUpdate) ->
|
||||||
|
runLogger $ $(logWarn)
|
||||||
|
[i|No GHCup update available|]
|
||||||
VLeft e ->
|
VLeft e ->
|
||||||
runLogger ($(logError) [i|#{e}|]) >> exitFailure
|
runLogger ($(logError) [i|#{e}|]) >> exitFailure
|
||||||
|
|
||||||
|
|||||||
@@ -27,31 +27,42 @@ download_ghcup() {
|
|||||||
_plat="$(uname -s)"
|
_plat="$(uname -s)"
|
||||||
_arch=$(uname -m)
|
_arch=$(uname -m)
|
||||||
|
|
||||||
case "${_arch}" in
|
|
||||||
x86_64|amd64)
|
|
||||||
;;
|
|
||||||
i*86)
|
|
||||||
die "i386 currently not supported!"
|
|
||||||
;;
|
|
||||||
*) die "Unknown architecture: ${_arch}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "${_plat}" in
|
case "${_plat}" in
|
||||||
"linux"|"Linux")
|
"linux"|"Linux")
|
||||||
_url=https://www.haskell.org/ghcup/bin/x86_64-linux-ghcup
|
case "${_arch}" in
|
||||||
|
x86_64|amd64)
|
||||||
|
_url=https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup
|
||||||
|
;;
|
||||||
|
i*86)
|
||||||
|
_url=https://downloads.haskell.org/~ghcup/i386-linux-ghcup
|
||||||
|
;;
|
||||||
|
*) die "Unknown architecture: ${_arch}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
"FreeBSD"|"freebsd")
|
"FreeBSD"|"freebsd")
|
||||||
_url=https://www.haskell.org/ghcup/bin/x86_64-portbld-freebsd-ghcup
|
case "${_arch}" in
|
||||||
|
x86_64|amd64)
|
||||||
|
;;
|
||||||
|
i*86)
|
||||||
|
die "i386 currently not supported!"
|
||||||
|
;;
|
||||||
|
*) die "Unknown architecture: ${_arch}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
_url=https://downloads.haskell.org/~ghcup/x86_64-portbld-freebsd-ghcup
|
||||||
;;
|
;;
|
||||||
"Darwin"|"darwin")
|
"Darwin"|"darwin")
|
||||||
case "$(sw_vers -productVersion || echo "none")" in
|
case "${_arch}" in
|
||||||
10.15.*) _url=https://www.haskell.org/ghcup/bin/x86_64-apple-darwin-10.14-ghcup ;;
|
x86_64|amd64)
|
||||||
10.14.*) _url=https://www.haskell.org/ghcup/bin/x86_64-apple-darwin-10.14-ghcup ;;
|
;;
|
||||||
10.13.*) _url=https://www.haskell.org/ghcup/bin/x86_64-apple-darwin-10.13-ghcup ;;
|
i*86)
|
||||||
*) _url=https://www.haskell.org/ghcup/bin/x86_64-apple-darwin-10.13-ghcup ;;
|
die "i386 currently not supported!"
|
||||||
|
;;
|
||||||
|
*) die "Unknown architecture: ${_arch}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
_url=https://downloads.haskell.org/~ghcup/x86_64-apple-darwin-ghcup ;;
|
||||||
*) die "Unknown platform: ${_plat}"
|
*) die "Unknown platform: ${_plat}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -2113,43 +2113,37 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"GHCup": {
|
"GHCup": {
|
||||||
"0.1.0": {
|
"0.1.1": {
|
||||||
"viArch": {
|
"viArch": {
|
||||||
"A_64": {
|
"A_64": {
|
||||||
"FreeBSD": {
|
"FreeBSD": {
|
||||||
"unknown_versioning": {
|
"unknown_versioning": {
|
||||||
"dlHash": "d300e36beb63eb5199169b669cc0550e581d871f404f2ce1a2581829c1d2f431",
|
"dlHash": "1336585b15692d6458edf4d913fd585d9963a708e2c952a71ee1ad3400ed2163",
|
||||||
"dlSubdir": null,
|
"dlSubdir": null,
|
||||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0"
|
"dlUri": "https://downloads.haskell.org/ghcup/0.1.1/x86_64-portbld-freebsd-ghcup-0.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Darwin": {
|
"Darwin": {
|
||||||
"unknown_versioning": {
|
"unknown_versioning": {
|
||||||
"dlHash": "3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32",
|
"dlHash": "b9694de40134e3d17611749eba94d8e4d00a84e2a16bb2409eab1e87f810dacd",
|
||||||
"dlSubdir": null,
|
"dlSubdir": null,
|
||||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0"
|
"dlUri": "https://downloads.haskell.org/ghcup/0.1.1/x86_64-apple-darwin-ghcup-0.1.1"
|
||||||
},
|
|
||||||
"10.14": {
|
|
||||||
"dlHash": "f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9",
|
|
||||||
"dlSubdir": null,
|
|
||||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0"
|
|
||||||
},
|
|
||||||
"10.13": {
|
|
||||||
"dlHash": "3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32",
|
|
||||||
"dlSubdir": null,
|
|
||||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0"
|
|
||||||
},
|
|
||||||
"10.15": {
|
|
||||||
"dlHash": "f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9",
|
|
||||||
"dlSubdir": null,
|
|
||||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Linux_UnknownLinux": {
|
"Linux_UnknownLinux": {
|
||||||
"unknown_versioning": {
|
"unknown_versioning": {
|
||||||
"dlHash": "b2dc576926c74336805a30c647056eeb1b4204742bcfc5c51680d4e7c34b87a1",
|
"dlHash": "2789fbab2848e4dfd77406b9a710c925b3b9680ac0f8486caca190628646486f",
|
||||||
"dlSubdir": null,
|
"dlSubdir": null,
|
||||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-linux-ghcup-0.1.0"
|
"dlUri": "https://downloads.haskell.org/ghcup/0.1.1/x86_64-linux-ghcup-0.1.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"A_32": {
|
||||||
|
"Linux_UnknownLinux": {
|
||||||
|
"unknown_versioning": {
|
||||||
|
"dlHash": "f576f22efdcf17fa18189b65d70e596d14f2347ef549a00592ef28d529c7d5a0",
|
||||||
|
"dlSubdir": null,
|
||||||
|
"dlUri": "https://downloads.haskell.org/ghcup/0.1.1/i386-linux-ghcup-0.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
ghcup.cabal
12
ghcup.cabal
@@ -1,13 +1,13 @@
|
|||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
name: ghcup
|
name: ghcup
|
||||||
version: 0.1.0
|
version: 0.1.2
|
||||||
synopsis: ghc toolchain installer as an exe/library
|
synopsis: ghc toolchain installer as an exe/library
|
||||||
description:
|
description:
|
||||||
A rewrite of the shell script ghcup, for providing
|
A rewrite of the shell script ghcup, for providing
|
||||||
a more stable user experience and exposing an API.
|
a more stable user experience and exposing an API.
|
||||||
|
|
||||||
homepage: https://github.com/hasufell/ghcup-hs
|
homepage: https://gitlab.haskell.org/haskell/ghcup-hs
|
||||||
bug-reports: https://github.com/hasufell/ghcup-hs/issues
|
bug-reports: https://gitlab.haskell.org/haskell/ghcup-hs/issues
|
||||||
license: LGPL-3.0-only
|
license: LGPL-3.0-only
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Julian Ospald
|
author: Julian Ospald
|
||||||
@@ -19,7 +19,7 @@ extra-source-files: CHANGELOG.md
|
|||||||
|
|
||||||
source-repository head
|
source-repository head
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/hasufell/ghcup-hs
|
location: https://gitlab.haskell.org/haskell/ghcup-hs.git
|
||||||
|
|
||||||
flag Curl
|
flag Curl
|
||||||
description: Use curl instead of http-io-streams for download
|
description: Use curl instead of http-io-streams for download
|
||||||
@@ -84,7 +84,7 @@ common hpath
|
|||||||
build-depends: hpath >=0.11
|
build-depends: hpath >=0.11
|
||||||
|
|
||||||
common hpath-directory
|
common hpath-directory
|
||||||
build-depends: hpath-directory >=0.13.2
|
build-depends: hpath-directory >=0.13.3
|
||||||
|
|
||||||
common hpath-filepath
|
common hpath-filepath
|
||||||
build-depends: hpath-filepath >=0.10.3
|
build-depends: hpath-filepath >=0.10.3
|
||||||
@@ -93,7 +93,7 @@ common hpath-io
|
|||||||
build-depends: hpath-io >=0.13.1
|
build-depends: hpath-io >=0.13.1
|
||||||
|
|
||||||
common hpath-posix
|
common hpath-posix
|
||||||
build-depends: hpath-posix >=0.11.1
|
build-depends: hpath-posix >=0.13.2
|
||||||
|
|
||||||
common http-io-streams
|
common http-io-streams
|
||||||
build-depends: http-io-streams >=0.1.2.0
|
build-depends: http-io-streams >=0.1.2.0
|
||||||
|
|||||||
15
lib/GHCup.hs
15
lib/GHCup.hs
@@ -376,6 +376,10 @@ rmGHCVer ver = do
|
|||||||
if exists
|
if exists
|
||||||
then do
|
then do
|
||||||
-- this isn't atomic, order matters
|
-- this isn't atomic, order matters
|
||||||
|
when isSetGHC $ do
|
||||||
|
lift $ $(logInfo) [i|Removing ghc symlinks|]
|
||||||
|
liftE $ rmPlain ver
|
||||||
|
|
||||||
lift $ $(logInfo) [i|Removing directory recursively: #{d'}|]
|
lift $ $(logInfo) [i|Removing directory recursively: #{d'}|]
|
||||||
liftIO $ deleteDirRecursive dir
|
liftIO $ deleteDirRecursive dir
|
||||||
|
|
||||||
@@ -389,11 +393,6 @@ rmGHCVer ver = do
|
|||||||
(mj, mi) <- getGHCMajor ver
|
(mj, mi) <- getGHCMajor ver
|
||||||
getGHCForMajor mj mi >>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY)
|
getGHCForMajor mj mi >>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY)
|
||||||
|
|
||||||
|
|
||||||
when isSetGHC $ do
|
|
||||||
lift $ $(logInfo) [i|Removing ghc symlinks|]
|
|
||||||
liftE $ rmPlain ver
|
|
||||||
|
|
||||||
liftIO
|
liftIO
|
||||||
$ ghcupBaseDir
|
$ ghcupBaseDir
|
||||||
>>= hideError doesNotExistErrorType
|
>>= hideError doesNotExistErrorType
|
||||||
@@ -676,6 +675,8 @@ upgradeGHCup :: ( MonadMask m
|
|||||||
)
|
)
|
||||||
=> GHCupDownloads
|
=> GHCupDownloads
|
||||||
-> Maybe (Path Abs) -- ^ full file destination to write ghcup into
|
-> Maybe (Path Abs) -- ^ full file destination to write ghcup into
|
||||||
|
-> Bool -- ^ whether to force update regardless
|
||||||
|
-- of currently installed version
|
||||||
-> Excepts
|
-> Excepts
|
||||||
'[ CopyError
|
'[ CopyError
|
||||||
, DigestError
|
, DigestError
|
||||||
@@ -684,12 +685,14 @@ upgradeGHCup :: ( MonadMask m
|
|||||||
, NoCompatibleArch
|
, NoCompatibleArch
|
||||||
, NoCompatiblePlatform
|
, NoCompatiblePlatform
|
||||||
, NoDownload
|
, NoDownload
|
||||||
|
, NoUpdate
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
Version
|
Version
|
||||||
upgradeGHCup dls mtarget = do
|
upgradeGHCup dls mtarget force = do
|
||||||
lift $ $(logInfo) [i|Upgrading GHCup...|]
|
lift $ $(logInfo) [i|Upgrading GHCup...|]
|
||||||
let latestVer = fromJust $ getLatest dls GHCup
|
let latestVer = fromJust $ getLatest dls GHCup
|
||||||
|
when (not force && (latestVer < pvpToVersion ghcUpVer)) $ throwE NoUpdate
|
||||||
pfreq <- liftE platformRequest
|
pfreq <- liftE platformRequest
|
||||||
dli <- lE $ getDownloadInfo GHCup latestVer pfreq dls
|
dli <- lE $ getDownloadInfo GHCup latestVer pfreq dls
|
||||||
tmp <- lift withGHCupTmpDir
|
tmp <- lift withGHCupTmpDir
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ data NoCompatiblePlatform = NoCompatiblePlatform String -- the platform we got
|
|||||||
data NoDownload = NoDownload
|
data NoDownload = NoDownload
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
|
-- | No update available or necessary.
|
||||||
|
data NoUpdate = NoUpdate
|
||||||
|
deriving Show
|
||||||
|
|
||||||
-- | The Architecture is unknown and unsupported.
|
-- | The Architecture is unknown and unsupported.
|
||||||
data NoCompatibleArch = NoCompatibleArch String
|
data NoCompatibleArch = NoCompatibleArch String
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|||||||
@@ -39,11 +39,10 @@ import qualified System.Posix.User as PU
|
|||||||
|
|
||||||
ghcupBaseDir :: IO (Path Abs)
|
ghcupBaseDir :: IO (Path Abs)
|
||||||
ghcupBaseDir = do
|
ghcupBaseDir = do
|
||||||
getEnv "GHCUP_INSTALL_BASE_PREFIX" >>= \case
|
bdir <- getEnv "GHCUP_INSTALL_BASE_PREFIX" >>= \case
|
||||||
Just r -> parseAbs r
|
Just r -> parseAbs r
|
||||||
Nothing -> do
|
Nothing -> liftIO getHomeDirectory
|
||||||
home <- liftIO getHomeDirectory
|
pure (bdir </> [rel|.ghcup|])
|
||||||
pure (home </> [rel|.ghcup|])
|
|
||||||
|
|
||||||
ghcupGHCBaseDir :: IO (Path Abs)
|
ghcupGHCBaseDir :: IO (Path Abs)
|
||||||
ghcupGHCBaseDir = ghcupBaseDir <&> (</> [rel|ghc|])
|
ghcupGHCBaseDir = ghcupBaseDir <&> (</> [rel|ghc|])
|
||||||
|
|||||||
@@ -240,3 +240,7 @@ addToCurrentEnv :: MonadIO m
|
|||||||
addToCurrentEnv adds = do
|
addToCurrentEnv adds = do
|
||||||
cEnv <- liftIO $ getEnvironment
|
cEnv <- liftIO $ getEnvironment
|
||||||
pure (adds ++ cEnv)
|
pure (adds ++ cEnv)
|
||||||
|
|
||||||
|
|
||||||
|
pvpToVersion :: PVP -> Version
|
||||||
|
pvpToVersion = either (\_ -> error "Couldn't convert PVP to Version") id . version . prettyPVP
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ ghcupURL :: URI
|
|||||||
ghcupURL = [uri|https://www.haskell.org/ghcup/data/ghcup-0.0.1.json|]
|
ghcupURL = [uri|https://www.haskell.org/ghcup/data/ghcup-0.0.1.json|]
|
||||||
|
|
||||||
ghcUpVer :: PVP
|
ghcUpVer :: PVP
|
||||||
ghcUpVer = [pver|0.1.0|]
|
ghcUpVer = [pver|0.1.2|]
|
||||||
|
|||||||
Reference in New Issue
Block a user