Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d91113cb54
|
|||
|
b566318872
|
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
@@ -44,8 +44,8 @@ jobs:
|
|||||||
|
|
||||||
- uses: haskell/actions/setup@v1.2
|
- uses: haskell/actions/setup@v1.2
|
||||||
with:
|
with:
|
||||||
ghc-version: 8.10.7
|
ghc-version: 8.10.4
|
||||||
cabal-version: 3.6.2.0
|
cabal-version: 3.4.0.0
|
||||||
|
|
||||||
- name: create ~/.local/bin
|
- name: create ~/.local/bin
|
||||||
run: mkdir -p "$HOME/.local/bin"
|
run: mkdir -p "$HOME/.local/bin"
|
||||||
|
|||||||
116
.gitlab-ci.yml
116
.gitlab-ci.yml
@@ -11,16 +11,12 @@ variables:
|
|||||||
# Commit of ghc/ci-images repository from which to pull Docker images
|
# Commit of ghc/ci-images repository from which to pull Docker images
|
||||||
DOCKER_REV: 8d0224e6b2a08157649651e69302380b2bd24e11
|
DOCKER_REV: 8d0224e6b2a08157649651e69302380b2bd24e11
|
||||||
|
|
||||||
# Sequential version number of all cached things.
|
|
||||||
# Bump to invalidate GitLab CI cache.
|
|
||||||
CACHE_REV: 0
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# CI Step
|
# CI Step
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
.debian:
|
.debian:
|
||||||
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV"
|
image: "debian:11"
|
||||||
tags:
|
tags:
|
||||||
- x86_64-linux
|
- x86_64-linux
|
||||||
variables:
|
variables:
|
||||||
@@ -48,7 +44,7 @@ variables:
|
|||||||
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
||||||
|
|
||||||
.linux:armv7:
|
.linux:armv7:
|
||||||
image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb10:$DOCKER_REV"
|
image: "arm32v7/debian:11"
|
||||||
tags:
|
tags:
|
||||||
- armv7-linux
|
- armv7-linux
|
||||||
variables:
|
variables:
|
||||||
@@ -58,7 +54,7 @@ variables:
|
|||||||
retry: 2
|
retry: 2
|
||||||
|
|
||||||
.linux:aarch64:
|
.linux:aarch64:
|
||||||
image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb10:$DOCKER_REV"
|
image: "aarch64/debian:11"
|
||||||
tags:
|
tags:
|
||||||
- aarch64-linux
|
- aarch64-linux
|
||||||
variables:
|
variables:
|
||||||
@@ -168,40 +164,26 @@ variables:
|
|||||||
- .test_ghcup_version
|
- .test_ghcup_version
|
||||||
- .darwin:aarch64
|
- .darwin:aarch64
|
||||||
- .root_cleanup
|
- .root_cleanup
|
||||||
cache:
|
|
||||||
key: darwin-brew-$CACHE_REV
|
|
||||||
paths:
|
|
||||||
- .brew
|
|
||||||
- .brew_cache
|
|
||||||
before_script:
|
|
||||||
# Install brew locally in the project dir. Packages will also be installed here.
|
|
||||||
- '[ -e "$CI_PROJECT_DIR/.brew" ] || git clone --depth=1 https://github.com/Homebrew/brew $CI_PROJECT_DIR/.brew'
|
|
||||||
- export PATH="$CI_PROJECT_DIR/.brew/bin:$CI_PROJECT_DIR/.brew/sbin:$PATH"
|
|
||||||
|
|
||||||
# otherwise we seem to get intel binaries
|
|
||||||
- export HOMEBREW_CHANGE_ARCH_TO_ARM=1
|
|
||||||
|
|
||||||
# make sure to not pollute the machine with temp files etc
|
|
||||||
- mkdir -p $CI_PROJECT_DIR/.brew_cache
|
|
||||||
- export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache
|
|
||||||
- mkdir -p $CI_PROJECT_DIR/.brew_logs
|
|
||||||
- export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs
|
|
||||||
- mkdir -p $CI_PROJECT_DIR/.brew_tmp
|
|
||||||
- export HOMEBREW_TEMP=$CI_PROJECT_DIR/.brew_tmp
|
|
||||||
|
|
||||||
# update and install packages
|
|
||||||
- brew update
|
|
||||||
- brew install llvm
|
|
||||||
- brew install autoconf automake coreutils
|
|
||||||
script: |
|
script: |
|
||||||
export PATH="$CI_PROJECT_DIR/.brew/opt/llvm/bin:$CI_PROJECT_DIR/.brew/bin:$CI_PROJECT_DIR/.brew/sbin:$PATH"
|
set -Eeuo pipefail
|
||||||
export CC=$CI_PROJECT_DIR/.brew/opt/llvm/bin/clang
|
function runInNixShell() {
|
||||||
export CXX=$CI_PROJECT_DIR/.brew/opt/llvm/bin/clang++
|
time nix-shell $CI_PROJECT_DIR/.gitlab/shell.nix \
|
||||||
export LD=ld
|
-I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \
|
||||||
export AR=$CI_PROJECT_DIR/.brew/opt/llvm/bin/llvm-ar
|
--argstr system "aarch64-darwin" \
|
||||||
export RANLIB=$CI_PROJECT_DIR/.brew/opt/llvm/bin/llvm-ranlib
|
--pure \
|
||||||
./.gitlab/before_script/darwin/install_deps.sh
|
--keep CI_PROJECT_DIR \
|
||||||
./.gitlab/script/ghcup_version.sh
|
--keep MACOSX_DEPLOYMENT_TARGET \
|
||||||
|
--keep JSON_VERSION \
|
||||||
|
--keep ARTIFACT \
|
||||||
|
--keep OS \
|
||||||
|
--keep ARCH \
|
||||||
|
--keep CABAL_DIR \
|
||||||
|
--keep GHC_VERSION \
|
||||||
|
--keep CABAL_VERSION \
|
||||||
|
--run "$1" 2>&1
|
||||||
|
}
|
||||||
|
runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1
|
||||||
|
runInNixShell ./.gitlab/script/ghcup_version.sh 2>&1
|
||||||
|
|
||||||
.test_ghcup_version:freebsd12:
|
.test_ghcup_version:freebsd12:
|
||||||
extends:
|
extends:
|
||||||
@@ -406,7 +388,6 @@ test:mac:aarch64:
|
|||||||
CABAL_VERSION: "3.6.2.0"
|
CABAL_VERSION: "3.6.2.0"
|
||||||
needs: []
|
needs: []
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
when: manual
|
|
||||||
|
|
||||||
|
|
||||||
######## freebsd test ########
|
######## freebsd test ########
|
||||||
@@ -527,47 +508,32 @@ release:darwin:aarch64:
|
|||||||
- .darwin:aarch64
|
- .darwin:aarch64
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
- .root_cleanup
|
- .root_cleanup
|
||||||
cache:
|
|
||||||
key: darwin-brew-$CACHE_REV
|
|
||||||
paths:
|
|
||||||
- .brew
|
|
||||||
- .brew_cache
|
|
||||||
before_script:
|
|
||||||
# Install brew locally in the project dir. Packages will also be installed here.
|
|
||||||
- '[ -e "$CI_PROJECT_DIR/.brew" ] || git clone --depth=1 https://github.com/Homebrew/brew $CI_PROJECT_DIR/.brew'
|
|
||||||
- export PATH="$CI_PROJECT_DIR/.brew/bin:$CI_PROJECT_DIR/.brew/sbin:$PATH"
|
|
||||||
|
|
||||||
# otherwise we seem to get intel binaries
|
|
||||||
- export HOMEBREW_CHANGE_ARCH_TO_ARM=1
|
|
||||||
|
|
||||||
# make sure to not pollute the machine with temp files etc
|
|
||||||
- mkdir -p $CI_PROJECT_DIR/.brew_cache
|
|
||||||
- export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache
|
|
||||||
- mkdir -p $CI_PROJECT_DIR/.brew_logs
|
|
||||||
- export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs
|
|
||||||
- mkdir -p $CI_PROJECT_DIR/.brew_tmp
|
|
||||||
- export HOMEBREW_TEMP=$CI_PROJECT_DIR/.brew_tmp
|
|
||||||
|
|
||||||
# update and install packages
|
|
||||||
- brew update
|
|
||||||
- brew install llvm
|
|
||||||
- brew install autoconf automake
|
|
||||||
script: |
|
script: |
|
||||||
export PATH="$CI_PROJECT_DIR/.brew/opt/llvm/bin:$CI_PROJECT_DIR/.brew/bin:$CI_PROJECT_DIR/.brew/sbin:$PATH"
|
set -Eeuo pipefail
|
||||||
export CC=$CI_PROJECT_DIR/.brew/opt/llvm/bin/clang
|
function runInNixShell() {
|
||||||
export CXX=$CI_PROJECT_DIR/.brew/opt/llvm/bin/clang++
|
time nix-shell $CI_PROJECT_DIR/.gitlab/shell.nix \
|
||||||
export LD=ld
|
-I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \
|
||||||
export AR=$CI_PROJECT_DIR/.brew/opt/llvm/bin/llvm-ar
|
--argstr system "aarch64-darwin" \
|
||||||
export RANLIB=$CI_PROJECT_DIR/.brew/opt/llvm/bin/llvm-ranlib
|
--pure \
|
||||||
./.gitlab/before_script/darwin/install_deps.sh
|
--keep CI_PROJECT_DIR \
|
||||||
./.gitlab/script/ghcup_release.sh
|
--keep MACOSX_DEPLOYMENT_TARGET \
|
||||||
|
--keep JSON_VERSION \
|
||||||
|
--keep ARTIFACT \
|
||||||
|
--keep OS \
|
||||||
|
--keep ARCH \
|
||||||
|
--keep CABAL_DIR \
|
||||||
|
--keep GHC_VERSION \
|
||||||
|
--keep CABAL_VERSION \
|
||||||
|
--run "$1" 2>&1
|
||||||
|
}
|
||||||
|
runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1
|
||||||
|
runInNixShell ./.gitlab/script/ghcup_release.sh 2>&1
|
||||||
variables:
|
variables:
|
||||||
ARTIFACT: "aarch64-apple-darwin-ghcup"
|
ARTIFACT: "aarch64-apple-darwin-ghcup"
|
||||||
GHC_VERSION: "8.10.7"
|
GHC_VERSION: "8.10.7"
|
||||||
CABAL_VERSION: "3.6.2.0"
|
CABAL_VERSION: "3.6.2.0"
|
||||||
MACOSX_DEPLOYMENT_TARGET: "10.7"
|
MACOSX_DEPLOYMENT_TARGET: "10.7"
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
when: manual
|
|
||||||
|
|
||||||
|
|
||||||
######## freebsd release ########
|
######## freebsd release ########
|
||||||
|
|||||||
@@ -6,16 +6,49 @@ set -eux
|
|||||||
|
|
||||||
mkdir -p "${TMPDIR}"
|
mkdir -p "${TMPDIR}"
|
||||||
|
|
||||||
sudo apt-get update -y
|
apt-get update -y
|
||||||
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential
|
apt-get install -y \
|
||||||
|
apt-transport-https \
|
||||||
|
autoconf \
|
||||||
|
automake \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
gcc \
|
||||||
|
git \
|
||||||
|
gnupg2 \
|
||||||
|
libbz2-dev \
|
||||||
|
libffi-dev \
|
||||||
|
libffi7 \
|
||||||
|
libgmp-dev \
|
||||||
|
libgmp10 \
|
||||||
|
liblzma-dev \
|
||||||
|
libncurses-dev \
|
||||||
|
libncurses5 \
|
||||||
|
libnuma-dev \
|
||||||
|
libssl-dev \
|
||||||
|
libtinfo5 \
|
||||||
|
lsb-release \
|
||||||
|
pkg-config \
|
||||||
|
software-properties-common \
|
||||||
|
wget \
|
||||||
|
zlib1g-dev
|
||||||
|
|
||||||
|
|
||||||
if [ "${CROSS}" = "arm-linux-gnueabihf" ] ; then
|
if [ "${CROSS}" = "arm-linux-gnueabihf" ] ; then
|
||||||
sudo apt-get install -y gcc-arm-linux-gnueabihf
|
apt-get install -y gcc-arm-linux-gnueabihf
|
||||||
sudo dpkg --add-architecture armhf
|
dpkg --add-architecture armhf
|
||||||
sudo apt-get update -y
|
apt-get update -y
|
||||||
sudo apt-get install -y libncurses-dev:armhf
|
apt-get install -y libncurses-dev:armhf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
apt-get install -y libseccomp-dev
|
||||||
|
curl -L https://dev.exherbo.org/~alip/sydbox/sydbox-2.1.0.tar.bz2 | tar -xj
|
||||||
|
cd sydbox-2.1.0
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
|
||||||
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
|
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
|
||||||
export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION
|
export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION
|
||||||
export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_VERSION
|
export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_VERSION
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ if [ "${OS}" = "WINDOWS" ] ; then
|
|||||||
else
|
else
|
||||||
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
|
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
|
||||||
export GHCUP_BIN="$CI_PROJECT_DIR/.ghcup/bin"
|
export GHCUP_BIN="$CI_PROJECT_DIR/.ghcup/bin"
|
||||||
export PATH="$GHCUP_BIN:$CI_PROJECT_DIR/.local/bin:$PATH"
|
export PATH="$GHCUP_BIN:$CI_PROJECT_DIR/.local/bin:/opt/llvm/bin:$PATH"
|
||||||
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -15,14 +15,100 @@ ecabal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
raw_eghcup() {
|
raw_eghcup() {
|
||||||
ghcup -v -c "$@"
|
if command -v sydbox 1>/dev/null ; then
|
||||||
|
sydbox \
|
||||||
|
-m core/sandbox/read:deny \
|
||||||
|
-m core/sandbox/write:deny \
|
||||||
|
-m core/sandbox/network:allow \
|
||||||
|
-m allowlist/read+/usr/lib/os-release \
|
||||||
|
-m "allowlist/read+${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/***" \
|
||||||
|
-m "allowlist/write+${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/***" \
|
||||||
|
-m "allowlist/read+${TMPDIR}/***" \
|
||||||
|
-m "allowlist/write+${TMPDIR}/***" \
|
||||||
|
-m "allowlist/read+/usr/lib/***" \
|
||||||
|
-m 'allowlist/read+/etc/ld.so.cache' \
|
||||||
|
-m "allowlist/read+/lib/***" \
|
||||||
|
-m 'allowlist/read+/etc/ssl/openssl.cnf' \
|
||||||
|
-m 'allowlist/read+/proc/sys/crypto/fips_enabled' \
|
||||||
|
-m 'allowlist/read+/etc/nsswitch.conf' \
|
||||||
|
-m 'allowlist/read+/etc/host.conf' \
|
||||||
|
-m 'allowlist/read+/etc/resolv.conf' \
|
||||||
|
-m 'allowlist/read+/etc/hosts' \
|
||||||
|
-m 'allowlist/read+/etc/gai.conf' \
|
||||||
|
-m 'allowlist/read+/etc/ssl/certs/ca-certificates.crt' \
|
||||||
|
-m 'allowlist/read+/usr/share/zoneinfo/Etc/UTC' \
|
||||||
|
-m 'allowlist/read+/dev/urandom' \
|
||||||
|
-m 'core/violation/decision:killall' \
|
||||||
|
-- ghcup -v -c "$@"
|
||||||
|
else
|
||||||
|
ghcup -v -c "$@"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
eghcup() {
|
eghcup() {
|
||||||
if [ "${OS}" = "WINDOWS" ] ; then
|
if [ "${OS}" = "WINDOWS" ] ; then
|
||||||
|
sydbox \
|
||||||
|
-m core/sandbox/read:deny \
|
||||||
|
-m core/sandbox/write:deny \
|
||||||
|
-m core/sandbox/network:allow \
|
||||||
|
-m allowlist/read+/usr/lib/os-release \
|
||||||
|
-m "allowlist/read+${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/***" \
|
||||||
|
-m "allowlist/write+${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/***" \
|
||||||
|
-m "allowlist/read+${TMPDIR}/***" \
|
||||||
|
-m "allowlist/write+${TMPDIR}/***" \
|
||||||
|
-m "allowlist/read+/usr/lib/***" \
|
||||||
|
-m 'allowlist/read+/etc/ld.so.cache' \
|
||||||
|
-m "allowlist/read+/lib/***" \
|
||||||
|
-m 'allowlist/read+/etc/ssl/openssl.cnf' \
|
||||||
|
-m 'allowlist/read+/proc/sys/crypto/fips_enabled' \
|
||||||
|
-m 'allowlist/read+/etc/nsswitch.conf' \
|
||||||
|
-m 'allowlist/read+/etc/host.conf' \
|
||||||
|
-m 'allowlist/read+/etc/resolv.conf' \
|
||||||
|
-m 'allowlist/read+/etc/hosts' \
|
||||||
|
-m 'allowlist/read+/etc/gai.conf' \
|
||||||
|
-m 'allowlist/read+/etc/ssl/certs/ca-certificates.crt' \
|
||||||
|
-m 'allowlist/read+/usr/share/zoneinfo/Etc/UTC' \
|
||||||
|
-m 'allowlist/read+/dev/urandom' \
|
||||||
|
-m 'core/violation/decision:killall' \
|
||||||
|
|
||||||
ghcup -v -c -s file:/$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@"
|
ghcup -v -c -s file:/$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@"
|
||||||
else
|
else
|
||||||
ghcup -v -c -s file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@"
|
if command -v sydbox 1>/dev/null ; then
|
||||||
|
ghcup -v -c -s file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@"
|
||||||
|
else
|
||||||
|
ghcup -v -c -s file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
eghcup_offline() {
|
||||||
|
if command -v sydbox 1>/dev/null ; then
|
||||||
|
sydbox \
|
||||||
|
-m core/sandbox/read:deny \
|
||||||
|
-m core/sandbox/write:deny \
|
||||||
|
-m core/sandbox/network:deny \
|
||||||
|
-m allowlist/read+/usr/lib/os-release \
|
||||||
|
-m "allowlist/read+${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/***" \
|
||||||
|
-m "allowlist/write+${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/***" \
|
||||||
|
-m "allowlist/read+${TMPDIR}/***" \
|
||||||
|
-m "allowlist/write+${TMPDIR}/***" \
|
||||||
|
-m "allowlist/read+/usr/lib/***" \
|
||||||
|
-m 'allowlist/read+/etc/ld.so.cache' \
|
||||||
|
-m "allowlist/read+/lib/***" \
|
||||||
|
-m 'allowlist/read+/etc/ssl/openssl.cnf' \
|
||||||
|
-m 'allowlist/read+/proc/sys/crypto/fips_enabled' \
|
||||||
|
-m 'allowlist/read+/etc/nsswitch.conf' \
|
||||||
|
-m 'allowlist/read+/etc/host.conf' \
|
||||||
|
-m 'allowlist/read+/etc/resolv.conf' \
|
||||||
|
-m 'allowlist/read+/etc/hosts' \
|
||||||
|
-m 'allowlist/read+/etc/gai.conf' \
|
||||||
|
-m 'allowlist/read+/etc/ssl/certs/ca-certificates.crt' \
|
||||||
|
-m 'allowlist/read+/usr/share/zoneinfo/Etc/UTC' \
|
||||||
|
-m 'allowlist/read+/dev/urandom' \
|
||||||
|
-m 'core/violation/decision:killall' \
|
||||||
|
-- ghcup -v --offline "$@"
|
||||||
|
else
|
||||||
|
ghcup -v --offline "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +171,7 @@ else
|
|||||||
ext=''
|
ext=''
|
||||||
fi
|
fi
|
||||||
cp "$(ecabal new-exec -w ghc-${GHC_VERSION} --verbose=0 --offline sh -- -c 'command -v ghcup')" "$CI_PROJECT_DIR"/.local/bin/ghcup${ext}
|
cp "$(ecabal new-exec -w ghc-${GHC_VERSION} --verbose=0 --offline sh -- -c 'command -v ghcup')" "$CI_PROJECT_DIR"/.local/bin/ghcup${ext}
|
||||||
|
cp "$(ecabal new-exec -w ghc-${GHC_VERSION} --verbose=0 --offline sh -- -c 'command -v ghcup-gen')" "$CI_PROJECT_DIR"/.local/bin/ghcup-gen${ext}
|
||||||
|
|
||||||
### cleanup
|
### cleanup
|
||||||
|
|
||||||
@@ -93,6 +180,8 @@ rm -rf "${GHCUP_DIR}"
|
|||||||
### manual cli based testing
|
### manual cli based testing
|
||||||
|
|
||||||
|
|
||||||
|
ghcup-gen check -f data/metadata/ghcup-${JSON_VERSION}.yaml
|
||||||
|
|
||||||
eghcup --numeric-version
|
eghcup --numeric-version
|
||||||
|
|
||||||
eghcup install ghc ${GHC_VERSION}
|
eghcup install ghc ${GHC_VERSION}
|
||||||
@@ -130,7 +219,7 @@ else
|
|||||||
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
|
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
|
||||||
if [ "${OS}" = "LINUX" ] ; then
|
if [ "${OS}" = "LINUX" ] ; then
|
||||||
eghcup --downloader=wget prefetch ghc 8.10.3
|
eghcup --downloader=wget prefetch ghc 8.10.3
|
||||||
eghcup --offline install ghc 8.10.3
|
eghcup_offline install ghc 8.10.3
|
||||||
if [ "${ARCH}" = "64" ] ; then
|
if [ "${ARCH}" = "64" ] ; then
|
||||||
expected=$(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghc-8.10.3-linux.files" | sort)
|
expected=$(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghc-8.10.3-linux.files" | sort)
|
||||||
actual=$(cd "${GHCUP_DIR}/ghc/8.10.3/" && find | sort)
|
actual=$(cd "${GHCUP_DIR}/ghc/8.10.3/" && find | sort)
|
||||||
@@ -139,17 +228,17 @@ else
|
|||||||
fi
|
fi
|
||||||
elif [ "${OS}" = "WINDOWS" ] ; then
|
elif [ "${OS}" = "WINDOWS" ] ; then
|
||||||
eghcup prefetch ghc 8.10.3
|
eghcup prefetch ghc 8.10.3
|
||||||
eghcup --offline install ghc 8.10.3
|
eghcup_offline install ghc 8.10.3
|
||||||
expected=$(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghc-8.10.3-windows.files" | sort)
|
expected=$(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghc-8.10.3-windows.files" | sort)
|
||||||
actual=$(cd "${GHCUP_DIR}/ghc/8.10.3/" && find | sort)
|
actual=$(cd "${GHCUP_DIR}/ghc/8.10.3/" && find | sort)
|
||||||
[ "${actual}" = "${expected}" ]
|
[ "${actual}" = "${expected}" ]
|
||||||
unset actual expected
|
unset actual expected
|
||||||
else
|
else
|
||||||
eghcup prefetch ghc 8.10.3
|
eghcup prefetch ghc 8.10.3
|
||||||
eghcup --offline install ghc 8.10.3
|
eghcup_offline install ghc 8.10.3
|
||||||
fi
|
fi
|
||||||
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
||||||
eghcup --offline set 8.10.3
|
eghcup_offline set 8.10.3
|
||||||
eghcup set 8.10.3
|
eghcup set 8.10.3
|
||||||
[ "$(ghc --numeric-version)" = "8.10.3" ]
|
[ "$(ghc --numeric-version)" = "8.10.3" ]
|
||||||
eghcup set ${GHC_VERSION}
|
eghcup set ${GHC_VERSION}
|
||||||
@@ -157,7 +246,7 @@ else
|
|||||||
eghcup unset ghc
|
eghcup unset ghc
|
||||||
"$GHCUP_BIN"/ghc --numeric-version && exit || echo yes
|
"$GHCUP_BIN"/ghc --numeric-version && exit || echo yes
|
||||||
eghcup set ${GHC_VERSION}
|
eghcup set ${GHC_VERSION}
|
||||||
eghcup --offline rm 8.10.3
|
eghcup_offline rm 8.10.3
|
||||||
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
90
.gitlab/shell.nix
Normal file
90
.gitlab/shell.nix
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
{ system ? "aarch64-darwin"
|
||||||
|
#, nixpkgs ? fetchTarball https://github.com/angerman/nixpkgs/archive/257cb120334.tar.gz #apple-silicon.tar.gz
|
||||||
|
, pkgs ? import <nixpkgs> { inherit system; }
|
||||||
|
, compiler ? if system == "aarch64-darwin" then "ghc8103Binary" else "ghc8103"
|
||||||
|
}: pkgs.mkShell {
|
||||||
|
# this prevents nix from trying to write the env-vars file.
|
||||||
|
# we can't really, as NIX_BUILD_TOP/env-vars is not set.
|
||||||
|
noDumpEnvVars=1;
|
||||||
|
|
||||||
|
# stop polluting LDFLAGS with -liconv
|
||||||
|
dontAddExtraLibs = true;
|
||||||
|
|
||||||
|
# we need to inject ncurses into --with-curses-libraries.
|
||||||
|
# the real fix is to teach terminfo to use libcurses on macOS.
|
||||||
|
# CONFIGURE_ARGS = "--with-intree-gmp --with-curses-libraries=${pkgs.ncurses.out}/lib";
|
||||||
|
CONFIGURE_ARGS = "--with-intree-gmp --with-curses-libraries=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib --with-iconv-includes=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include --with-iconv-libraries=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib SH=/bin/bash";
|
||||||
|
|
||||||
|
# magic speedup pony :facepalm:
|
||||||
|
#
|
||||||
|
# nix has the ugly habbit of duplicating ld flags more than necessary. This
|
||||||
|
# somewhat consolidates this.
|
||||||
|
shellHook = ''
|
||||||
|
export NIX_LDFLAGS=$(for a in $NIX_LDFLAGS; do echo $a; done |sort|uniq|xargs)
|
||||||
|
export NIX_LDFLAGS_FOR_TARGET=$(for a in $NIX_LDFLAGS_FOR_TARGET; do echo $a; done |sort|uniq|xargs)
|
||||||
|
export NIX_LDFLAGS_FOR_TARGET=$(comm -3 <(for l in $NIX_LDFLAGS_FOR_TARGET; do echo $l; done) <(for l in $NIX_LDFLAGS; do echo $l; done))
|
||||||
|
|
||||||
|
|
||||||
|
# Impurity hack for GHC releases.
|
||||||
|
#################################
|
||||||
|
# We don't want binary releases to depend on nix, thus we'll need to make sure we don't leak in references.
|
||||||
|
# GHC externally depends only on iconv and curses. However we can't force a specific curses library for
|
||||||
|
# the terminfo package, as such we'll need to make sure we only look in the system path for the curses library
|
||||||
|
# and not pick up the tinfo from the nix provided ncurses package.
|
||||||
|
#
|
||||||
|
# We also need to force us to use the systems COREFOUNDATION, not the one that nix builds. Again this is impure,
|
||||||
|
# but it will allow us to have proper binary distributions.
|
||||||
|
#
|
||||||
|
# do not use nixpkgs provided core foundation
|
||||||
|
export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks
|
||||||
|
# drop curses from the LDFLAGS, we really want the system ones, not the nix ones.
|
||||||
|
export NIX_LDFLAGS=$(for lib in $NIX_LDFLAGS; do case "$lib" in *curses*);; *) echo -n "$lib ";; esac; done;)
|
||||||
|
export NIX_CFLAGS_COMPILE+=" -Wno-nullability-completeness -Wno-availability -Wno-expansion-to-defined -Wno-builtin-requires-header -Wno-unused-command-line-argument"
|
||||||
|
|
||||||
|
# unconditionally add the MacOSX.sdk and TargetConditional.h
|
||||||
|
export NIX_CFLAGS_COMPILE+=" -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
|
||||||
|
export NIX_LDFLAGS="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib $NIX_LDFLAGS"
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
|
nativeBuildInputs = (with pkgs; [
|
||||||
|
# This needs to come *before* ghc,
|
||||||
|
# otherwise we migth end up with the clang from
|
||||||
|
# the bootstrap GHC in PATH with higher priority.
|
||||||
|
clang_11
|
||||||
|
llvm_11
|
||||||
|
|
||||||
|
haskell.compiler.${compiler}
|
||||||
|
haskell.packages.${compiler}.cabal-install
|
||||||
|
haskell.packages.${compiler}.alex
|
||||||
|
haskell.packages.${compiler}.happy # _1_19_12 is needed for older GHCs.
|
||||||
|
|
||||||
|
automake
|
||||||
|
autoconf
|
||||||
|
m4
|
||||||
|
|
||||||
|
gmp
|
||||||
|
zlib.out
|
||||||
|
zlib.dev
|
||||||
|
glibcLocales
|
||||||
|
# locale doesn't build yet :-/
|
||||||
|
# locale
|
||||||
|
|
||||||
|
git
|
||||||
|
|
||||||
|
python3
|
||||||
|
# python3Full
|
||||||
|
# python3Packages.sphinx
|
||||||
|
perl
|
||||||
|
|
||||||
|
which
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
file
|
||||||
|
|
||||||
|
xz
|
||||||
|
xlibs.lndir
|
||||||
|
|
||||||
|
cacert ])
|
||||||
|
++ (with pkgs.darwin.apple_sdk.frameworks; [ Foundation Security ]);
|
||||||
|
}
|
||||||
@@ -1,12 +1,5 @@
|
|||||||
# Revision history for ghcup
|
# Revision history for ghcup
|
||||||
|
|
||||||
## 0.1.17.3 -- 2021-10-27
|
|
||||||
|
|
||||||
* clean up during unpack failures as well
|
|
||||||
* migrate te aeson-2.0.1.0
|
|
||||||
* switch to yaml-streamly to fix performance regression wrt [#270](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/270)
|
|
||||||
* use [github.com/haskell/ghcup-metadata](https://github.com/haskell/ghcup-metadata) for metadata file download (better caching)
|
|
||||||
|
|
||||||
## 0.1.17.2 -- 2021-09-30
|
## 0.1.17.2 -- 2021-09-30
|
||||||
|
|
||||||
* Honour GHC bootstrap compiler during git clone stages wrt [#250](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/250)
|
* Honour GHC bootstrap compiler during git clone stages wrt [#250](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/250)
|
||||||
|
|||||||
@@ -9,5 +9,3 @@
|
|||||||
GHCup is an installer for the general purpose language [Haskell](https://www.haskell.org/).
|
GHCup is an installer for the general purpose language [Haskell](https://www.haskell.org/).
|
||||||
|
|
||||||
Visit the [documentation](https://www.haskell.org/ghcup/) for installation instructions.
|
Visit the [documentation](https://www.haskell.org/ghcup/) for installation instructions.
|
||||||
|
|
||||||
If you're looking for the metadata YAML files, see here: [https://github.com/haskell/ghcup-metadata](https://github.com/haskell/ghcup-metadata)
|
|
||||||
|
|||||||
155
app/ghcup-gen/Main.hs
Normal file
155
app/ghcup-gen/Main.hs
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# LANGUAGE DataKinds #-}
|
||||||
|
{-# LANGUAGE DuplicateRecordFields #-}
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE TypeApplications #-}
|
||||||
|
|
||||||
|
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import GHCup.Types
|
||||||
|
import GHCup.Errors
|
||||||
|
import GHCup.Platform
|
||||||
|
import GHCup.Utils.Dirs
|
||||||
|
import GHCup.Utils.Logger
|
||||||
|
import GHCup.Types.JSON ( )
|
||||||
|
|
||||||
|
import Control.Exception ( displayException )
|
||||||
|
import Control.Monad.Trans.Reader ( runReaderT )
|
||||||
|
import Control.Monad.IO.Class
|
||||||
|
import Data.Char ( toLower )
|
||||||
|
import Data.Maybe
|
||||||
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
|
import Data.Semigroup ( (<>) )
|
||||||
|
#endif
|
||||||
|
import Options.Applicative hiding ( style )
|
||||||
|
import Haskus.Utils.Variant.Excepts
|
||||||
|
import System.Console.Pretty
|
||||||
|
import System.Environment
|
||||||
|
import System.Exit
|
||||||
|
import System.IO ( stderr )
|
||||||
|
import Text.Regex.Posix
|
||||||
|
import Validate
|
||||||
|
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
|
|
||||||
|
import qualified Data.Text.IO as T
|
||||||
|
import qualified Data.Text as T
|
||||||
|
import qualified Data.ByteString as B
|
||||||
|
import qualified Data.Yaml.Aeson as Y
|
||||||
|
|
||||||
|
|
||||||
|
data Options = Options
|
||||||
|
{ optCommand :: Command
|
||||||
|
}
|
||||||
|
|
||||||
|
data Command = ValidateYAML ValidateYAMLOpts
|
||||||
|
| ValidateTarballs ValidateYAMLOpts TarballFilter
|
||||||
|
|
||||||
|
|
||||||
|
data Input
|
||||||
|
= FileInput FilePath -- optsparse-applicative doesn't handle ByteString correctly anyway
|
||||||
|
| StdInput
|
||||||
|
|
||||||
|
fileInput :: Parser Input
|
||||||
|
fileInput =
|
||||||
|
FileInput
|
||||||
|
<$> strOption
|
||||||
|
(long "file" <> short 'f' <> metavar "FILENAME" <> help
|
||||||
|
"Input file to validate"
|
||||||
|
)
|
||||||
|
|
||||||
|
stdInput :: Parser Input
|
||||||
|
stdInput = flag'
|
||||||
|
StdInput
|
||||||
|
(short 'i' <> long "stdin" <> help "Validate from stdin (default)")
|
||||||
|
|
||||||
|
inputP :: Parser Input
|
||||||
|
inputP = fileInput <|> stdInput
|
||||||
|
|
||||||
|
data ValidateYAMLOpts = ValidateYAMLOpts
|
||||||
|
{ vInput :: Maybe Input
|
||||||
|
}
|
||||||
|
|
||||||
|
validateYAMLOpts :: Parser ValidateYAMLOpts
|
||||||
|
validateYAMLOpts = ValidateYAMLOpts <$> optional inputP
|
||||||
|
|
||||||
|
tarballFilterP :: Parser TarballFilter
|
||||||
|
tarballFilterP = option readm $
|
||||||
|
long "tarball-filter" <> short 'u' <> metavar "<tool>-<version>" <> value def
|
||||||
|
<> help "Only check certain tarballs (format: <tool>-<version>)"
|
||||||
|
where
|
||||||
|
def = TarballFilter (Right Nothing) (makeRegex ("" :: String))
|
||||||
|
readm = do
|
||||||
|
s <- str
|
||||||
|
case span (/= '-') s of
|
||||||
|
(_, []) -> fail "invalid format, missing '-' after the tool name"
|
||||||
|
(t, v) | [tool] <- [ tool | tool <- [minBound..maxBound], low (show tool) == low t ] ->
|
||||||
|
pure (TarballFilter $ Right $ Just tool) <*> makeRegexOptsM compIgnoreCase execBlank (drop 1 v)
|
||||||
|
(t, v) | [tool] <- [ tool | tool <- [minBound..maxBound], low (show tool) == low t ] ->
|
||||||
|
pure (TarballFilter $ Left tool) <*> makeRegexOptsM compIgnoreCase execBlank (drop 1 v)
|
||||||
|
_ -> fail "invalid tool"
|
||||||
|
low = fmap toLower
|
||||||
|
|
||||||
|
|
||||||
|
opts :: Parser Options
|
||||||
|
opts = Options <$> com
|
||||||
|
|
||||||
|
com :: Parser Command
|
||||||
|
com = subparser
|
||||||
|
( command
|
||||||
|
"check"
|
||||||
|
( ValidateYAML
|
||||||
|
<$> info (validateYAMLOpts <**> helper)
|
||||||
|
(progDesc "Validate the YAML")
|
||||||
|
)
|
||||||
|
<> command
|
||||||
|
"check-tarballs"
|
||||||
|
(info
|
||||||
|
((ValidateTarballs <$> validateYAMLOpts <*> tarballFilterP) <**> helper)
|
||||||
|
(progDesc "Validate all tarballs (download and checksum)")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
no_color <- isJust <$> lookupEnv "NO_COLOR"
|
||||||
|
let loggerConfig = LoggerConfig { lcPrintDebug = True
|
||||||
|
, consoleOutter = T.hPutStr stderr
|
||||||
|
, fileOutter = \_ -> pure ()
|
||||||
|
, fancyColors = not no_color
|
||||||
|
}
|
||||||
|
dirs <- liftIO getAllDirs
|
||||||
|
let leanAppstate = LeanAppState (Settings True False Never Curl True GHCupURL False GPGNone False) dirs defaultKeyBindings loggerConfig
|
||||||
|
|
||||||
|
pfreq <- (
|
||||||
|
flip runReaderT leanAppstate . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] $ platformRequest
|
||||||
|
) >>= \case
|
||||||
|
VRight r -> pure r
|
||||||
|
VLeft e -> do
|
||||||
|
flip runReaderT leanAppstate $ logError $ T.pack $ prettyShow e
|
||||||
|
liftIO $ exitWith (ExitFailure 2)
|
||||||
|
|
||||||
|
let appstate = AppState (Settings True False Never Curl True GHCupURL False GPGNone False) dirs defaultKeyBindings (GHCupInfo mempty mempty mempty) pfreq loggerConfig
|
||||||
|
|
||||||
|
_ <- customExecParser (prefs showHelpOnError) (info (opts <**> helper) idm)
|
||||||
|
>>= \Options {..} -> case optCommand of
|
||||||
|
ValidateYAML vopts -> withValidateYamlOpts vopts (\dl m -> flip runReaderT appstate $ validate dl m)
|
||||||
|
ValidateTarballs vopts tarballFilter -> withValidateYamlOpts vopts (\dl m -> flip runReaderT appstate $ validateTarballs tarballFilter dl m)
|
||||||
|
pure ()
|
||||||
|
|
||||||
|
where
|
||||||
|
withValidateYamlOpts vopts f = case vopts of
|
||||||
|
ValidateYAMLOpts { vInput = Nothing } ->
|
||||||
|
B.getContents >>= valAndExit f
|
||||||
|
ValidateYAMLOpts { vInput = Just StdInput } ->
|
||||||
|
B.getContents >>= valAndExit f
|
||||||
|
ValidateYAMLOpts { vInput = Just (FileInput file) } ->
|
||||||
|
B.readFile file >>= valAndExit f
|
||||||
|
valAndExit f contents = do
|
||||||
|
(GHCupInfo _ av gt) <- case Y.decodeEither' contents of
|
||||||
|
Right r -> pure r
|
||||||
|
Left e -> die (color Red $ displayException e)
|
||||||
|
f av gt
|
||||||
|
>>= exitWith
|
||||||
280
app/ghcup-gen/Validate.hs
Normal file
280
app/ghcup-gen/Validate.hs
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# LANGUAGE DataKinds #-}
|
||||||
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE TypeApplications #-}
|
||||||
|
{-# LANGUAGE ViewPatterns #-}
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
|
module Validate where
|
||||||
|
|
||||||
|
import GHCup
|
||||||
|
import GHCup.Download
|
||||||
|
import GHCup.Errors
|
||||||
|
import GHCup.Types
|
||||||
|
import GHCup.Types.Optics
|
||||||
|
import GHCup.Utils
|
||||||
|
import GHCup.Utils.Logger
|
||||||
|
import GHCup.Utils.Version.QQ
|
||||||
|
|
||||||
|
import Codec.Archive
|
||||||
|
import Control.Applicative
|
||||||
|
import Control.Exception.Safe
|
||||||
|
import Control.Monad
|
||||||
|
import Control.Monad.IO.Class
|
||||||
|
import Control.Monad.Reader.Class
|
||||||
|
import Control.Monad.Trans.Class ( lift )
|
||||||
|
import Control.Monad.Trans.Reader ( runReaderT )
|
||||||
|
import Control.Monad.Trans.Resource ( runResourceT
|
||||||
|
, MonadUnliftIO
|
||||||
|
)
|
||||||
|
import Data.Containers.ListUtils ( nubOrd )
|
||||||
|
import Data.IORef
|
||||||
|
import Data.List
|
||||||
|
import Data.Versions
|
||||||
|
import Haskus.Utils.Variant.Excepts
|
||||||
|
import Optics
|
||||||
|
import System.FilePath
|
||||||
|
import System.Exit
|
||||||
|
import Text.ParserCombinators.ReadP
|
||||||
|
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
|
import Text.Regex.Posix
|
||||||
|
|
||||||
|
import qualified Data.Map.Strict as M
|
||||||
|
import qualified Data.Text as T
|
||||||
|
import qualified Data.Version as V
|
||||||
|
|
||||||
|
|
||||||
|
data ValidationError = InternalError String
|
||||||
|
deriving Show
|
||||||
|
|
||||||
|
instance Exception ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
addError :: (MonadReader (IORef Int) m, MonadIO m, Monad m) => m ()
|
||||||
|
addError = do
|
||||||
|
ref <- ask
|
||||||
|
liftIO $ modifyIORef ref (+ 1)
|
||||||
|
|
||||||
|
|
||||||
|
validate :: (Monad m, MonadReader env m, HasLog env, MonadThrow m, MonadIO m, MonadUnliftIO m)
|
||||||
|
=> GHCupDownloads
|
||||||
|
-> M.Map GlobalTool DownloadInfo
|
||||||
|
-> m ExitCode
|
||||||
|
validate dls _ = do
|
||||||
|
ref <- liftIO $ newIORef 0
|
||||||
|
|
||||||
|
-- verify binary downloads --
|
||||||
|
flip runReaderT ref $ do
|
||||||
|
-- unique tags
|
||||||
|
forM_ (M.toList dls) $ \(t, _) -> checkUniqueTags t
|
||||||
|
|
||||||
|
-- required platforms
|
||||||
|
forM_ (M.toList dls) $ \(t, versions) ->
|
||||||
|
forM_ (M.toList versions) $ \(v, vi) ->
|
||||||
|
forM_ (M.toList $ _viArch vi) $ \(arch, pspecs) -> do
|
||||||
|
checkHasRequiredPlatforms t v (_viTags vi) arch (M.keys pspecs)
|
||||||
|
|
||||||
|
checkGHCVerIsValid
|
||||||
|
forM_ (M.toList dls) $ \(t, _) -> checkMandatoryTags t
|
||||||
|
_ <- checkGHCHasBaseVersion
|
||||||
|
|
||||||
|
-- exit
|
||||||
|
e <- liftIO $ readIORef ref
|
||||||
|
if e > 0
|
||||||
|
then pure $ ExitFailure e
|
||||||
|
else do
|
||||||
|
lift $ logInfo "All good"
|
||||||
|
pure ExitSuccess
|
||||||
|
where
|
||||||
|
checkHasRequiredPlatforms t v tags arch pspecs = do
|
||||||
|
let v' = prettyVer v
|
||||||
|
arch' = prettyShow arch
|
||||||
|
when (Linux UnknownLinux `notElem` pspecs) $ do
|
||||||
|
lift $ logError $
|
||||||
|
"Linux UnknownLinux missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
||||||
|
addError
|
||||||
|
when ((Darwin `notElem` pspecs) && arch == A_64) $ do
|
||||||
|
lift $ logError $ "Darwin missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
||||||
|
addError
|
||||||
|
when ((FreeBSD `notElem` pspecs) && arch == A_64) $ lift $ logWarn $
|
||||||
|
"FreeBSD missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
||||||
|
when (Windows `notElem` pspecs && arch == A_64) $ do
|
||||||
|
lift $ logError $ "Windows missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
||||||
|
addError
|
||||||
|
|
||||||
|
-- alpine needs to be set explicitly, because
|
||||||
|
-- we cannot assume that "Linux UnknownLinux" runs on Alpine
|
||||||
|
-- (although it could be static)
|
||||||
|
when (Linux Alpine `notElem` pspecs) $
|
||||||
|
case t of
|
||||||
|
GHCup | arch `elem` [A_64, A_32] -> lift (logError $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)) >> addError
|
||||||
|
Cabal | v > [vver|2.4.1.0|]
|
||||||
|
, arch `elem` [A_64, A_32] -> lift (logError $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)) >> addError
|
||||||
|
GHC | Latest `elem` tags || Recommended `elem` tags
|
||||||
|
, arch `elem` [A_64, A_32] -> lift (logError $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch))
|
||||||
|
_ -> lift $ logWarn $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)
|
||||||
|
|
||||||
|
checkUniqueTags tool = do
|
||||||
|
let allTags = _viTags =<< M.elems (availableToolVersions dls tool)
|
||||||
|
let nonUnique =
|
||||||
|
fmap fst
|
||||||
|
. filter (\(_, b) -> not b)
|
||||||
|
<$> ( mapM
|
||||||
|
(\case
|
||||||
|
[] -> throwM $ InternalError "empty inner list"
|
||||||
|
(t : ts) ->
|
||||||
|
pure $ (t, ) (not (isUniqueTag t) || null ts)
|
||||||
|
)
|
||||||
|
. group
|
||||||
|
. sort
|
||||||
|
$ allTags
|
||||||
|
)
|
||||||
|
case join nonUnique of
|
||||||
|
[] -> pure ()
|
||||||
|
xs -> do
|
||||||
|
lift $ logError $ "Tags not unique for " <> T.pack (prettyShow tool) <> ": " <> T.pack (prettyShow xs)
|
||||||
|
addError
|
||||||
|
where
|
||||||
|
isUniqueTag Latest = True
|
||||||
|
isUniqueTag Recommended = True
|
||||||
|
isUniqueTag Old = False
|
||||||
|
isUniqueTag Prerelease = False
|
||||||
|
isUniqueTag (Base _) = False
|
||||||
|
isUniqueTag (UnknownTag _) = False
|
||||||
|
|
||||||
|
checkGHCVerIsValid = do
|
||||||
|
let ghcVers = toListOf (ix GHC % to M.keys % folded) dls
|
||||||
|
forM_ ghcVers $ \v ->
|
||||||
|
case [ x | (x,"") <- readP_to_S V.parseVersion (T.unpack . prettyVer $ v) ] of
|
||||||
|
[_] -> pure ()
|
||||||
|
_ -> do
|
||||||
|
lift $ logError $ "GHC version " <> prettyVer v <> " is not valid"
|
||||||
|
addError
|
||||||
|
|
||||||
|
-- a tool must have at least one of each mandatory tags
|
||||||
|
checkMandatoryTags tool = do
|
||||||
|
let allTags = _viTags =<< M.elems (availableToolVersions dls tool)
|
||||||
|
forM_ [Latest, Recommended] $ \t -> case t `elem` allTags of
|
||||||
|
False -> do
|
||||||
|
lift $ logError $ "Tag " <> T.pack (prettyShow t) <> " missing from " <> T.pack (prettyShow tool)
|
||||||
|
addError
|
||||||
|
True -> pure ()
|
||||||
|
|
||||||
|
-- all GHC versions must have a base tag
|
||||||
|
checkGHCHasBaseVersion = do
|
||||||
|
let allTags = M.toList $ availableToolVersions dls GHC
|
||||||
|
forM allTags $ \(ver, _viTags -> tags) -> case any isBase tags of
|
||||||
|
False -> do
|
||||||
|
lift $ logError $ "Base tag missing from GHC ver " <> prettyVer ver
|
||||||
|
addError
|
||||||
|
True -> pure ()
|
||||||
|
|
||||||
|
isBase (Base _) = True
|
||||||
|
isBase _ = False
|
||||||
|
|
||||||
|
data TarballFilter = TarballFilter
|
||||||
|
{ tfTool :: Either GlobalTool (Maybe Tool)
|
||||||
|
, tfVersion :: Regex
|
||||||
|
}
|
||||||
|
|
||||||
|
validateTarballs :: ( Monad m
|
||||||
|
, MonadReader env m
|
||||||
|
, HasLog env
|
||||||
|
, HasDirs env
|
||||||
|
, HasSettings env
|
||||||
|
, MonadThrow m
|
||||||
|
, MonadIO m
|
||||||
|
, MonadUnliftIO m
|
||||||
|
, MonadMask m
|
||||||
|
, Alternative m
|
||||||
|
, MonadFail m
|
||||||
|
)
|
||||||
|
=> TarballFilter
|
||||||
|
-> GHCupDownloads
|
||||||
|
-> M.Map GlobalTool DownloadInfo
|
||||||
|
-> m ExitCode
|
||||||
|
validateTarballs (TarballFilter etool versionRegex) dls gt = do
|
||||||
|
ref <- liftIO $ newIORef 0
|
||||||
|
|
||||||
|
-- download/verify all tarballs
|
||||||
|
let dlis = either (const []) (\tool -> nubOrd $ dls ^.. each %& indices (maybe (const True) (==) tool) %> each %& indices (matchTest versionRegex . T.unpack . prettyVer) % (viSourceDL % _Just `summing` viArch % each % each % each)) etool
|
||||||
|
let gdlis = nubOrd $ gt ^.. each
|
||||||
|
let allDls = either (const gdlis) (const dlis) etool
|
||||||
|
when (null allDls) $ logError "no tarballs selected by filter" *> runReaderT addError ref
|
||||||
|
forM_ allDls (downloadAll ref)
|
||||||
|
|
||||||
|
-- exit
|
||||||
|
e <- liftIO $ readIORef ref
|
||||||
|
if e > 0
|
||||||
|
then pure $ ExitFailure e
|
||||||
|
else do
|
||||||
|
logInfo "All good"
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
where
|
||||||
|
downloadAll :: ( MonadUnliftIO m
|
||||||
|
, MonadIO m
|
||||||
|
, MonadReader env m
|
||||||
|
, HasLog env
|
||||||
|
, HasDirs env
|
||||||
|
, HasSettings env
|
||||||
|
, MonadCatch m
|
||||||
|
, MonadMask m
|
||||||
|
, MonadThrow m
|
||||||
|
)
|
||||||
|
=> IORef Int
|
||||||
|
-> DownloadInfo
|
||||||
|
-> m ()
|
||||||
|
downloadAll ref dli = do
|
||||||
|
r <- runResourceT
|
||||||
|
. runE @'[DigestError
|
||||||
|
, GPGError
|
||||||
|
, DownloadFailed
|
||||||
|
, UnknownArchive
|
||||||
|
, ArchiveResult
|
||||||
|
]
|
||||||
|
$ do
|
||||||
|
case etool of
|
||||||
|
Right (Just GHCup) -> do
|
||||||
|
tmpUnpack <- lift mkGhcupTmpDir
|
||||||
|
_ <- liftE $ download (_dlUri dli) Nothing (Just (_dlHash dli)) tmpUnpack Nothing False
|
||||||
|
pure Nothing
|
||||||
|
Right _ -> do
|
||||||
|
p <- liftE $ downloadCached dli Nothing
|
||||||
|
fmap (Just . head . splitDirectories . head)
|
||||||
|
. liftE
|
||||||
|
. getArchiveFiles
|
||||||
|
$ p
|
||||||
|
Left ShimGen -> do
|
||||||
|
tmpUnpack <- lift mkGhcupTmpDir
|
||||||
|
_ <- liftE $ download (_dlUri dli) Nothing (Just (_dlHash dli)) tmpUnpack Nothing False
|
||||||
|
pure Nothing
|
||||||
|
case r of
|
||||||
|
VRight (Just basePath) -> do
|
||||||
|
case _dlSubdir dli of
|
||||||
|
Just (RealDir prel) -> do
|
||||||
|
logInfo
|
||||||
|
$ " verifying subdir: " <> T.pack prel
|
||||||
|
when (basePath /= prel) $ do
|
||||||
|
logError $
|
||||||
|
"Subdir doesn't match: expected " <> T.pack prel <> ", got " <> T.pack basePath
|
||||||
|
runReaderT addError ref
|
||||||
|
Just (RegexDir regexString) -> do
|
||||||
|
logInfo $
|
||||||
|
"verifying subdir (regex): " <> T.pack regexString
|
||||||
|
let regex = makeRegexOpts
|
||||||
|
compIgnoreCase
|
||||||
|
execBlank
|
||||||
|
regexString
|
||||||
|
unless (match regex basePath) $ do
|
||||||
|
logError $
|
||||||
|
"Subdir doesn't match: expected regex " <> T.pack regexString <> ", got " <> T.pack basePath
|
||||||
|
runReaderT addError ref
|
||||||
|
Nothing -> pure ()
|
||||||
|
VRight Nothing -> pure ()
|
||||||
|
VLeft e -> do
|
||||||
|
logError $
|
||||||
|
"Could not download (or verify hash) of " <> T.pack (show dli) <> ", Error was: " <> T.pack (prettyShow e)
|
||||||
|
runReaderT addError ref
|
||||||
@@ -10,7 +10,6 @@ module BrickMain where
|
|||||||
import GHCup
|
import GHCup
|
||||||
import GHCup.Download
|
import GHCup.Download
|
||||||
import GHCup.Errors
|
import GHCup.Errors
|
||||||
import GHCup.Types.Optics ( getDirs )
|
|
||||||
import GHCup.Types hiding ( LeanAppState(..) )
|
import GHCup.Types hiding ( LeanAppState(..) )
|
||||||
import GHCup.Utils
|
import GHCup.Utils
|
||||||
import GHCup.Utils.Logger
|
import GHCup.Utils.Logger
|
||||||
@@ -27,9 +26,6 @@ import Brick.Widgets.List ( listSelectedFocusedAttr
|
|||||||
)
|
)
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
#if !MIN_VERSION_base(4,13,0)
|
|
||||||
import Control.Monad.Fail ( MonadFail )
|
|
||||||
#endif
|
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.Except
|
import Control.Monad.Trans.Except
|
||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
@@ -44,8 +40,6 @@ import Data.Vector ( Vector
|
|||||||
import Data.Versions hiding ( str )
|
import Data.Versions hiding ( str )
|
||||||
import Haskus.Utils.Variant.Excepts
|
import Haskus.Utils.Variant.Excepts
|
||||||
import Prelude hiding ( appendFile )
|
import Prelude hiding ( appendFile )
|
||||||
import System.Directory ( canonicalizePath )
|
|
||||||
import System.FilePath
|
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.IO.Unsafe
|
import System.IO.Unsafe
|
||||||
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
@@ -54,8 +48,6 @@ import URI.ByteString
|
|||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Graphics.Vty as Vty
|
import qualified Graphics.Vty as Vty
|
||||||
import qualified Data.Vector as V
|
import qualified Data.Vector as V
|
||||||
import System.Environment (getExecutablePath)
|
|
||||||
import qualified System.Posix.Process as SPP
|
|
||||||
|
|
||||||
|
|
||||||
hiddenTools :: [Tool]
|
hiddenTools :: [Tool]
|
||||||
@@ -440,42 +432,27 @@ install' _ (_, ListResult {..}) = do
|
|||||||
]
|
]
|
||||||
|
|
||||||
run (do
|
run (do
|
||||||
ce <- liftIO $ fmap (either (const Nothing) Just) $
|
|
||||||
try @_ @SomeException $ getExecutablePath >>= canonicalizePath
|
|
||||||
dirs <- lift getDirs
|
|
||||||
case lTool of
|
case lTool of
|
||||||
GHC -> do
|
GHC -> do
|
||||||
let vi = getVersionInfo lVer GHC dls
|
let vi = getVersionInfo lVer GHC dls
|
||||||
liftE $ installGHCBin lVer Nothing False $> (vi, dirs, ce)
|
liftE $ installGHCBin lVer Nothing False $> vi
|
||||||
Cabal -> do
|
Cabal -> do
|
||||||
let vi = getVersionInfo lVer Cabal dls
|
let vi = getVersionInfo lVer Cabal dls
|
||||||
liftE $ installCabalBin lVer Nothing False $> (vi, dirs, ce)
|
liftE $ installCabalBin lVer Nothing False $> vi
|
||||||
GHCup -> do
|
GHCup -> do
|
||||||
let vi = snd <$> getLatest dls GHCup
|
let vi = snd <$> getLatest dls GHCup
|
||||||
liftE $ upgradeGHCup Nothing False $> (vi, dirs, ce)
|
liftE $ upgradeGHCup Nothing False $> vi
|
||||||
HLS -> do
|
HLS -> do
|
||||||
let vi = getVersionInfo lVer HLS dls
|
let vi = getVersionInfo lVer HLS dls
|
||||||
liftE $ installHLSBin lVer Nothing False $> (vi, dirs, ce)
|
liftE $ installHLSBin lVer Nothing False $> vi
|
||||||
Stack -> do
|
Stack -> do
|
||||||
let vi = getVersionInfo lVer Stack dls
|
let vi = getVersionInfo lVer Stack dls
|
||||||
liftE $ installStackBin lVer Nothing False $> (vi, dirs, ce)
|
liftE $ installStackBin lVer Nothing False $> vi
|
||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight (vi, Dirs{..}, Just ce) -> do
|
VRight vi -> do
|
||||||
forM_ (_viPostInstall =<< vi) $ \msg -> logInfo msg
|
forM_ (_viPostInstall =<< vi) $ \msg ->
|
||||||
case lTool of
|
logInfo msg
|
||||||
GHCup -> do
|
|
||||||
up <- liftIO $ fmap (either (const Nothing) Just)
|
|
||||||
$ try @_ @SomeException $ canonicalizePath (binDir </> "ghcup" <.> exeExt)
|
|
||||||
when ((normalise <$> up) == Just (normalise ce)) $
|
|
||||||
-- TODO: track cli arguments of previous invocation
|
|
||||||
liftIO $ SPP.executeFile ce False ["tui"] Nothing
|
|
||||||
logInfo "Please restart 'ghcup' for the changes to take effect"
|
|
||||||
_ -> pure ()
|
|
||||||
pure $ Right ()
|
|
||||||
VRight (vi, _, _) -> do
|
|
||||||
forM_ (_viPostInstall =<< vi) $ \msg -> logInfo msg
|
|
||||||
logInfo "Please restart 'ghcup' for the changes to take effect"
|
|
||||||
pure $ Right ()
|
pure $ Right ()
|
||||||
VLeft (V (AlreadyInstalled _ _)) -> pure $ Right ()
|
VLeft (V (AlreadyInstalled _ _)) -> pure $ Right ()
|
||||||
VLeft (V NoUpdate) -> pure $ Right ()
|
VLeft (V NoUpdate) -> pure $ Right ()
|
||||||
@@ -559,7 +536,17 @@ settings' = unsafePerformIO $ do
|
|||||||
, fileOutter = \_ -> pure ()
|
, fileOutter = \_ -> pure ()
|
||||||
, fancyColors = True
|
, fancyColors = True
|
||||||
}
|
}
|
||||||
newIORef $ AppState defaultSettings
|
newIORef $ AppState (Settings { cache = True
|
||||||
|
, noVerify = False
|
||||||
|
, keepDirs = Never
|
||||||
|
, downloader = Curl
|
||||||
|
, verbose = False
|
||||||
|
, urlSource = GHCupURL
|
||||||
|
, noNetwork = False
|
||||||
|
, gpgSetting = GPGNone
|
||||||
|
, noColor = False
|
||||||
|
, ..
|
||||||
|
})
|
||||||
dirs
|
dirs
|
||||||
defaultKeyBindings
|
defaultKeyBindings
|
||||||
(GHCupInfo mempty mempty mempty)
|
(GHCupInfo mempty mempty mempty)
|
||||||
@@ -618,3 +605,4 @@ getAppData mgi = runExceptT $ do
|
|||||||
flip runReaderT settings $ do
|
flip runReaderT settings $ do
|
||||||
lV <- listVersions Nothing Nothing
|
lV <- listVersions Nothing Nothing
|
||||||
pure $ BrickData (reverse lV)
|
pure $ BrickData (reverse lV)
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ data Options = Options
|
|||||||
-- global options
|
-- global options
|
||||||
optVerbose :: Maybe Bool
|
optVerbose :: Maybe Bool
|
||||||
, optCache :: Maybe Bool
|
, optCache :: Maybe Bool
|
||||||
, optMetaCache :: Maybe Integer
|
|
||||||
, optUrlSource :: Maybe URI
|
, optUrlSource :: Maybe URI
|
||||||
, optNoVerify :: Maybe Bool
|
, optNoVerify :: Maybe Bool
|
||||||
, optKeepDirs :: Maybe KeepDirs
|
, optKeepDirs :: Maybe KeepDirs
|
||||||
@@ -106,7 +105,6 @@ opts =
|
|||||||
Options
|
Options
|
||||||
<$> invertableSwitch "verbose" 'v' False (help "Enable verbosity (default: disabled)")
|
<$> invertableSwitch "verbose" 'v' False (help "Enable verbosity (default: disabled)")
|
||||||
<*> invertableSwitch "cache" 'c' False (help "Cache downloads in ~/.ghcup/cache (default: disabled)")
|
<*> invertableSwitch "cache" 'c' False (help "Cache downloads in ~/.ghcup/cache (default: disabled)")
|
||||||
<*> optional (option auto (long "metadata-caching" <> help "How long the yaml metadata caching interval is (in seconds), 0 to disable" <> internal))
|
|
||||||
<*> optional
|
<*> optional
|
||||||
(option
|
(option
|
||||||
(eitherReader parseUri)
|
(eitherReader parseUri)
|
||||||
|
|||||||
@@ -89,18 +89,6 @@ toolVersionArgument criteria tool =
|
|||||||
mv _ = "VERSION|TAG"
|
mv _ = "VERSION|TAG"
|
||||||
|
|
||||||
|
|
||||||
toolVersionOption :: Maybe ListCriteria -> Maybe Tool -> Parser ToolVersion
|
|
||||||
toolVersionOption criteria tool =
|
|
||||||
option (eitherReader toolVersionEither)
|
|
||||||
( sh tool
|
|
||||||
<> completer (tagCompleter (fromMaybe GHC tool) [])
|
|
||||||
<> foldMap (completer . versionCompleter criteria) tool)
|
|
||||||
where
|
|
||||||
sh (Just GHC) = long "ghc" <> metavar "GHC_VERSION|TAG"
|
|
||||||
sh (Just HLS) = long "hls" <> metavar "HLS_VERSION|TAG"
|
|
||||||
sh _ = long "version" <> metavar "VERSION|TAG"
|
|
||||||
|
|
||||||
|
|
||||||
versionParser :: Parser GHCTargetVersion
|
versionParser :: Parser GHCTargetVersion
|
||||||
versionParser = option
|
versionParser = option
|
||||||
(eitherReader tVersionEither)
|
(eitherReader tVersionEither)
|
||||||
@@ -208,8 +196,8 @@ platformParser s' = case MP.parse (platformP <* MP.eof) "" (T.pack s') of
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
uriParser :: String -> Either String URI
|
bindistParser :: String -> Either String URI
|
||||||
uriParser = first show . parseURI strictURIParserOptions . UTF8.fromString
|
bindistParser = first show . parseURI strictURIParserOptions . UTF8.fromString
|
||||||
|
|
||||||
|
|
||||||
absolutePathParser :: FilePath -> Either String FilePath
|
absolutePathParser :: FilePath -> Either String FilePath
|
||||||
@@ -258,6 +246,18 @@ criteriaParser s' | t == T.pack "installed" = Right ListInstalled
|
|||||||
where t = T.toLower (T.pack s')
|
where t = T.toLower (T.pack s')
|
||||||
|
|
||||||
|
|
||||||
|
toolVersionParser :: Parser ToolVersion
|
||||||
|
toolVersionParser = verP' <|> toolP
|
||||||
|
where
|
||||||
|
verP' = ToolVersion <$> versionParser
|
||||||
|
toolP =
|
||||||
|
ToolTag
|
||||||
|
<$> option
|
||||||
|
(eitherReader tagEither)
|
||||||
|
(short 't' <> long "tag" <> metavar "TAG" <> help "The target tag")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
keepOnParser :: String -> Either String KeepDirs
|
keepOnParser :: String -> Either String KeepDirs
|
||||||
keepOnParser s' | t == T.pack "always" = Right Always
|
keepOnParser s' | t == T.pack "always" = Right Always
|
||||||
@@ -299,7 +299,7 @@ tagCompleter tool add = listIOCompleter $ do
|
|||||||
, fancyColors = False
|
, fancyColors = False
|
||||||
}
|
}
|
||||||
let appState = LeanAppState
|
let appState = LeanAppState
|
||||||
(defaultSettings { noNetwork = True })
|
(Settings True False Never Curl False GHCupURL True GPGNone False)
|
||||||
dirs'
|
dirs'
|
||||||
defaultKeyBindings
|
defaultKeyBindings
|
||||||
loggerConfig
|
loggerConfig
|
||||||
@@ -322,7 +322,7 @@ versionCompleter criteria tool = listIOCompleter $ do
|
|||||||
, fileOutter = mempty
|
, fileOutter = mempty
|
||||||
, fancyColors = False
|
, fancyColors = False
|
||||||
}
|
}
|
||||||
let settings = defaultSettings { noNetwork = True }
|
let settings = Settings True False Never Curl False GHCupURL True GPGNone False
|
||||||
let leanAppState = LeanAppState
|
let leanAppState = LeanAppState
|
||||||
settings
|
settings
|
||||||
dirs'
|
dirs'
|
||||||
@@ -399,7 +399,7 @@ fromVersion' (SetToolVersion v) tool = do
|
|||||||
Right pvpIn ->
|
Right pvpIn ->
|
||||||
lift (getLatestToolFor tool pvpIn dls) >>= \case
|
lift (getLatestToolFor tool pvpIn dls) >>= \case
|
||||||
Just (pvp_, vi') -> do
|
Just (pvp_, vi') -> do
|
||||||
v' <- lift $ pvpToVersion pvp_ ""
|
v' <- lift $ pvpToVersion pvp_
|
||||||
when (v' /= _tvVersion v) $ lift $ logWarn ("Assuming you meant version " <> prettyVer v')
|
when (v' /= _tvVersion v) $ lift $ logWarn ("Assuming you meant version " <> prettyVer v')
|
||||||
pure (GHCTargetVersion (_tvTarget v) v', Just vi')
|
pure (GHCTargetVersion (_tvTarget v) v', Just vi')
|
||||||
Nothing -> pure (v, vi)
|
Nothing -> pure (v, vi)
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import Prelude hiding ( appendFile )
|
|||||||
import System.Exit
|
import System.Exit
|
||||||
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
|
|
||||||
import URI.ByteString hiding ( uriParser )
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Control.Exception.Safe (MonadMask)
|
import Control.Exception.Safe (MonadMask)
|
||||||
import System.FilePath (isPathSeparator)
|
import System.FilePath (isPathSeparator)
|
||||||
@@ -69,7 +68,7 @@ data GHCCompileOptions = GHCCompileOptions
|
|||||||
, bootstrapGhc :: Either Version FilePath
|
, bootstrapGhc :: Either Version FilePath
|
||||||
, jobs :: Maybe Int
|
, jobs :: Maybe Int
|
||||||
, buildConfig :: Maybe FilePath
|
, buildConfig :: Maybe FilePath
|
||||||
, patches :: Maybe (Either FilePath [URI])
|
, patchDir :: Maybe FilePath
|
||||||
, crossTarget :: Maybe Text
|
, crossTarget :: Maybe Text
|
||||||
, addConfArgs :: [Text]
|
, addConfArgs :: [Text]
|
||||||
, setCompile :: Bool
|
, setCompile :: Bool
|
||||||
@@ -85,11 +84,10 @@ data HLSCompileOptions = HLSCompileOptions
|
|||||||
, setCompile :: Bool
|
, setCompile :: Bool
|
||||||
, ovewrwiteVer :: Maybe Version
|
, ovewrwiteVer :: Maybe Version
|
||||||
, isolateDir :: Maybe FilePath
|
, isolateDir :: Maybe FilePath
|
||||||
, cabalProject :: Maybe (Either FilePath URI)
|
, cabalProject :: Maybe FilePath
|
||||||
, cabalProjectLocal :: Maybe URI
|
, cabalProjectLocal :: Maybe FilePath
|
||||||
, patches :: Maybe (Either FilePath [URI])
|
, patchDir :: Maybe FilePath
|
||||||
, targetGHCs :: [ToolVersion]
|
, targetGHCs :: [ToolVersion]
|
||||||
, cabalArgs :: [Text]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -150,10 +148,7 @@ Examples:
|
|||||||
These need to be available in PATH prior to compilation.
|
These need to be available in PATH prior to compilation.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
# compile 1.4.0 for ghc 8.10.5 and 8.10.7
|
ghcup compile hls -v 1.4.0 -j 12 8.10.5 8.10.7 9.0.1|]
|
||||||
ghcup compile hls -v 1.4.0 -j 12 --ghc 8.10.5 --ghc 8.10.7
|
|
||||||
# compile from master for ghc 8.10.7, linking everything dynamically
|
|
||||||
ghcup compile hls -g master -j 12 --ghc 8.10.7 -- --ghc-options='-dynamic'|]
|
|
||||||
|
|
||||||
|
|
||||||
ghcCompileOpts :: Parser GHCCompileOptions
|
ghcCompileOpts :: Parser GHCCompileOptions
|
||||||
@@ -200,23 +195,13 @@ ghcCompileOpts =
|
|||||||
"Absolute path to build config file"
|
"Absolute path to build config file"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
<*> (optional
|
<*> optional
|
||||||
(
|
(option
|
||||||
(fmap Right $ many $ option
|
str
|
||||||
(eitherReader uriParser)
|
(short 'p' <> long "patchdir" <> metavar "PATCH_DIR" <> help
|
||||||
(long "patch" <> metavar "PATCH_URI" <> help
|
"Absolute path to patch directory (applies all .patch and .diff files in order using -p1)"
|
||||||
"URI to a patch (https/http/file)"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
<|>
|
|
||||||
(fmap Left $ option
|
|
||||||
str
|
|
||||||
(short 'p' <> long "patchdir" <> metavar "PATCH_DIR" <> help
|
|
||||||
"Absolute path to patch directory (applies all .patch and .diff files in order using -p1)"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
<*> optional
|
<*> optional
|
||||||
(option
|
(option
|
||||||
str
|
str
|
||||||
@@ -311,37 +296,26 @@ hlsCompileOpts =
|
|||||||
)
|
)
|
||||||
<*> optional
|
<*> optional
|
||||||
(option
|
(option
|
||||||
((fmap Right $ eitherReader uriParser) <|> (fmap Left str))
|
str
|
||||||
(long "cabal-project" <> metavar "CABAL_PROJECT" <> help
|
(long "cabal-project" <> metavar "CABAL_PROJECT" <> help
|
||||||
"If relative filepath, specifies the path to cabal.project inside the unpacked HLS tarball/checkout. Otherwise expects a full URI with https/http/file scheme."
|
"If relative, specifies the path to cabal.project inside the unpacked HLS tarball/checkout. If absolute, will copy the file over."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
<*> optional
|
<*> optional
|
||||||
(option
|
(option
|
||||||
(eitherReader uriParser)
|
(eitherReader absolutePathParser)
|
||||||
(long "cabal-project-local" <> metavar "CABAL_PROJECT_LOCAL" <> help
|
(long "cabal-project-local" <> metavar "CABAL_PROJECT_LOCAL" <> help
|
||||||
"URI (https/http/file) to a cabal.project.local to be used for the build. Will be copied over."
|
"Absolute path to a cabal.project.local to be used for the build. Will be copied over."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
<*> (optional
|
<*> optional
|
||||||
(
|
(option
|
||||||
(fmap Right $ many $ option
|
(eitherReader absolutePathParser)
|
||||||
(eitherReader uriParser)
|
(short 'p' <> long "patchdir" <> metavar "PATCH_DIR" <> help
|
||||||
(long "patch" <> metavar "PATCH_URI" <> help
|
"Absolute path to patch directory (applies all .patch and .diff files in order using -p1)"
|
||||||
"URI to a patch (https/http/file)"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
<|>
|
|
||||||
(fmap Left $ option
|
|
||||||
str
|
|
||||||
(short 'p' <> long "patchdir" <> metavar "PATCH_DIR" <> help
|
|
||||||
"Absolute path to patch directory (applies all .patch and .diff files in order using -p1)"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
<*> some (toolVersionArgument Nothing (Just GHC))
|
||||||
<*> some (toolVersionOption Nothing (Just GHC))
|
|
||||||
<*> many (argument str (metavar "CABAL_ARGS" <> help "Additional arguments to cabal install, prefix with '-- ' (longopts)"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -456,8 +430,7 @@ compile compileCommand settings runAppState runLogger = do
|
|||||||
isolateDir
|
isolateDir
|
||||||
cabalProject
|
cabalProject
|
||||||
cabalProjectLocal
|
cabalProjectLocal
|
||||||
patches
|
patchDir
|
||||||
cabalArgs
|
|
||||||
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
||||||
let vi = getVersionInfo targetVer HLS dls
|
let vi = getVersionInfo targetVer HLS dls
|
||||||
when setCompile $ void $ liftE $
|
when setCompile $ void $ liftE $
|
||||||
@@ -504,7 +477,7 @@ compile compileCommand settings runAppState runLogger = do
|
|||||||
bootstrapGhc
|
bootstrapGhc
|
||||||
jobs
|
jobs
|
||||||
buildConfig
|
buildConfig
|
||||||
patches
|
patchDir
|
||||||
addConfArgs
|
addConfArgs
|
||||||
buildFlavour
|
buildFlavour
|
||||||
hadrian
|
hadrian
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ updateSettings config' settings = do
|
|||||||
mergeConf :: UserSettings -> Settings -> Settings
|
mergeConf :: UserSettings -> Settings -> Settings
|
||||||
mergeConf UserSettings{..} Settings{..} =
|
mergeConf UserSettings{..} Settings{..} =
|
||||||
let cache' = fromMaybe cache uCache
|
let cache' = fromMaybe cache uCache
|
||||||
metaCache' = fromMaybe metaCache uMetaCache
|
|
||||||
noVerify' = fromMaybe noVerify uNoVerify
|
noVerify' = fromMaybe noVerify uNoVerify
|
||||||
keepDirs' = fromMaybe keepDirs uKeepDirs
|
keepDirs' = fromMaybe keepDirs uKeepDirs
|
||||||
downloader' = fromMaybe downloader uDownloader
|
downloader' = fromMaybe downloader uDownloader
|
||||||
@@ -130,7 +129,7 @@ updateSettings config' settings = do
|
|||||||
urlSource' = fromMaybe urlSource uUrlSource
|
urlSource' = fromMaybe urlSource uUrlSource
|
||||||
noNetwork' = fromMaybe noNetwork uNoNetwork
|
noNetwork' = fromMaybe noNetwork uNoNetwork
|
||||||
gpgSetting' = fromMaybe gpgSetting uGPGSetting
|
gpgSetting' = fromMaybe gpgSetting uGPGSetting
|
||||||
in Settings cache' metaCache' noVerify' keepDirs' downloader' verbose' urlSource' noNetwork' gpgSetting' noColor
|
in Settings cache' noVerify' keepDirs' downloader' verbose' urlSource' noNetwork' gpgSetting' noColor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ describe_result = $( LitE . StringL <$>
|
|||||||
runIO (do
|
runIO (do
|
||||||
CapturedProcess{..} <- do
|
CapturedProcess{..} <- do
|
||||||
dirs <- liftIO getAllDirs
|
dirs <- liftIO getAllDirs
|
||||||
let settings = AppState (defaultSettings { noNetwork = True })
|
let settings = AppState (Settings True False Never Curl False GHCupURL False GPGNone False)
|
||||||
dirs
|
dirs
|
||||||
defaultKeyBindings
|
defaultKeyBindings
|
||||||
flip runReaderT settings $ executeOut "git" ["describe"] Nothing
|
flip runReaderT settings $ executeOut "git" ["describe"] Nothing
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import Options.Applicative.Help.Pretty ( text )
|
|||||||
import Prelude hiding ( appendFile )
|
import Prelude hiding ( appendFile )
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
import URI.ByteString hiding ( uriParser )
|
import URI.ByteString
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ installOpts tool =
|
|||||||
<*> ( ( (,)
|
<*> ( ( (,)
|
||||||
<$> optional
|
<$> optional
|
||||||
(option
|
(option
|
||||||
(eitherReader uriParser)
|
(eitherReader bindistParser)
|
||||||
(short 'u' <> long "url" <> metavar "BINDIST_URL" <> help
|
(short 'u' <> long "url" <> metavar "BINDIST_URL" <> help
|
||||||
"Install the specified version from this bindist"
|
"Install the specified version from this bindist"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ import qualified Data.ByteString as B
|
|||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.Text.IO as T
|
import qualified Data.Text.IO as T
|
||||||
import qualified Data.Text.Encoding as E
|
import qualified Data.Text.Encoding as E
|
||||||
import qualified GHCup.Types as Types
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -73,16 +72,15 @@ toSettings options = do
|
|||||||
where
|
where
|
||||||
mergeConf :: Options -> UserSettings -> Bool -> (Settings, KeyBindings)
|
mergeConf :: Options -> UserSettings -> Bool -> (Settings, KeyBindings)
|
||||||
mergeConf Options{..} UserSettings{..} noColor =
|
mergeConf Options{..} UserSettings{..} noColor =
|
||||||
let cache = fromMaybe (fromMaybe (Types.cache defaultSettings) uCache) optCache
|
let cache = fromMaybe (fromMaybe False uCache) optCache
|
||||||
metaCache = fromMaybe (fromMaybe (Types.metaCache defaultSettings) uMetaCache) optMetaCache
|
noVerify = fromMaybe (fromMaybe False uNoVerify) optNoVerify
|
||||||
noVerify = fromMaybe (fromMaybe (Types.noVerify defaultSettings) uNoVerify) optNoVerify
|
verbose = fromMaybe (fromMaybe False uVerbose) optVerbose
|
||||||
verbose = fromMaybe (fromMaybe (Types.verbose defaultSettings) uVerbose) optVerbose
|
keepDirs = fromMaybe (fromMaybe Errors uKeepDirs) optKeepDirs
|
||||||
keepDirs = fromMaybe (fromMaybe (Types.keepDirs defaultSettings) uKeepDirs) optKeepDirs
|
|
||||||
downloader = fromMaybe (fromMaybe defaultDownloader uDownloader) optsDownloader
|
downloader = fromMaybe (fromMaybe defaultDownloader uDownloader) optsDownloader
|
||||||
keyBindings = maybe defaultKeyBindings mergeKeys uKeyBindings
|
keyBindings = maybe defaultKeyBindings mergeKeys uKeyBindings
|
||||||
urlSource = maybe (fromMaybe (Types.urlSource defaultSettings) uUrlSource) OwnSource optUrlSource
|
urlSource = maybe (fromMaybe GHCupURL uUrlSource) OwnSource optUrlSource
|
||||||
noNetwork = fromMaybe (fromMaybe (Types.noNetwork defaultSettings) uNoNetwork) optNoNetwork
|
noNetwork = fromMaybe (fromMaybe False uNoNetwork) optNoNetwork
|
||||||
gpgSetting = fromMaybe (fromMaybe (Types.gpgSetting defaultSettings) uGPGSetting) optGpg
|
gpgSetting = fromMaybe (fromMaybe GPGNone uGPGSetting) optGpg
|
||||||
in (Settings {..}, keyBindings)
|
in (Settings {..}, keyBindings)
|
||||||
#if defined(INTERNAL_DOWNLOADER)
|
#if defined(INTERNAL_DOWNLOADER)
|
||||||
defaultDownloader = Internal
|
defaultDownloader = Internal
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ package ghcup
|
|||||||
tests: True
|
tests: True
|
||||||
flags: +tui
|
flags: +tui
|
||||||
|
|
||||||
constraints: http-io-streams -brotli,
|
constraints: http-io-streams -brotli
|
||||||
any.Cabal ==3.6.2.0,
|
|
||||||
any.aeson >= 2.0.1.0
|
|
||||||
|
|
||||||
package libarchive
|
package libarchive
|
||||||
flags: -system-libarchive
|
flags: -system-libarchive
|
||||||
@@ -21,9 +19,6 @@ package aeson-pretty
|
|||||||
package cabal-plan
|
package cabal-plan
|
||||||
flags: -exe
|
flags: -exe
|
||||||
|
|
||||||
package aeson
|
|
||||||
flags: +ordered-keymap
|
|
||||||
|
|
||||||
allow-newer: base, ghc-prim, template-haskell, language-c
|
allow-newer: base, ghc-prim, template-haskell, language-c
|
||||||
|
|
||||||
with-compiler: ghc-8.10.7
|
with-compiler: ghc-8.10.7
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
active-repositories: hackage.haskell.org:merge
|
active-repositories: hackage.haskell.org:merge
|
||||||
constraints: any.Cabal ==3.6.2.0,
|
constraints: any.Cabal ==3.2.1.0 || ==3.6.1.0,
|
||||||
Cabal -bundled-binary-generic,
|
Cabal -bundled-binary-generic,
|
||||||
any.HUnit ==1.6.2.0,
|
any.HUnit ==1.6.2.0,
|
||||||
any.HsOpenSSL ==0.11.7.2,
|
any.HsOpenSSL ==0.11.7.2,
|
||||||
HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config,
|
HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config,
|
||||||
|
any.HsYAML ==0.2.1.0,
|
||||||
|
HsYAML -exe,
|
||||||
|
any.HsYAML-aeson ==0.2.0.0,
|
||||||
any.QuickCheck ==2.14.2,
|
any.QuickCheck ==2.14.2,
|
||||||
QuickCheck -old-random +templatehaskell,
|
QuickCheck -old-random +templatehaskell,
|
||||||
any.StateVar ==1.2.2,
|
any.StateVar ==1.2.2,
|
||||||
any.abstract-deque ==0.3,
|
any.aeson ==1.5.6.0,
|
||||||
abstract-deque -usecas,
|
aeson -bytestring-builder -cffi -developer -fast,
|
||||||
any.aeson ==2.0.1.0,
|
any.aeson-pretty ==0.8.8,
|
||||||
aeson -bytestring-builder -cffi +ordered-keymap,
|
|
||||||
any.aeson-pretty ==0.8.9,
|
|
||||||
aeson-pretty +lib-only,
|
aeson-pretty +lib-only,
|
||||||
any.alex ==3.2.6,
|
any.alex ==3.2.6,
|
||||||
alex +small_base,
|
alex +small_base,
|
||||||
@@ -21,10 +22,8 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
ansi-wl-pprint -example,
|
ansi-wl-pprint -example,
|
||||||
any.array ==0.5.4.0,
|
any.array ==0.5.4.0,
|
||||||
any.assoc ==1.0.2,
|
any.assoc ==1.0.2,
|
||||||
any.async ==2.2.4,
|
any.async ==2.2.3,
|
||||||
async -bench,
|
async -bench,
|
||||||
any.atomic-primops ==0.8.4,
|
|
||||||
atomic-primops -debug,
|
|
||||||
any.attoparsec ==0.13.2.5,
|
any.attoparsec ==0.13.2.5,
|
||||||
attoparsec -developer,
|
attoparsec -developer,
|
||||||
any.base ==4.14.3.0,
|
any.base ==4.14.3.0,
|
||||||
@@ -36,15 +35,15 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.bifunctors ==5.5.11,
|
any.bifunctors ==5.5.11,
|
||||||
bifunctors +semigroups +tagged,
|
bifunctors +semigroups +tagged,
|
||||||
any.binary ==0.8.8.0,
|
any.binary ==0.8.8.0,
|
||||||
any.blaze-builder ==0.4.2.2,
|
any.blaze-builder ==0.4.2.1,
|
||||||
any.brick ==0.64.2,
|
any.brick ==0.64.1,
|
||||||
brick -demos,
|
brick -demos,
|
||||||
any.bytestring ==0.10.12.0,
|
any.bytestring ==0.10.12.0,
|
||||||
any.bz2 ==1.0.1.0,
|
any.bz2 ==1.0.1.0,
|
||||||
bz2 -cross +with-bzlib,
|
bz2 -cross +with-bzlib,
|
||||||
any.c2hs ==0.28.8,
|
any.c2hs ==0.28.8,
|
||||||
c2hs +base3 -regression,
|
c2hs +base3 -regression,
|
||||||
any.cabal-plan ==0.7.2.1,
|
any.cabal-plan ==0.7.2.0,
|
||||||
cabal-plan -_ -exe -license-report,
|
cabal-plan -_ -exe -license-report,
|
||||||
any.call-stack ==0.4.0,
|
any.call-stack ==0.4.0,
|
||||||
any.case-insensitive ==1.2.1.0,
|
any.case-insensitive ==1.2.1.0,
|
||||||
@@ -67,7 +66,7 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.cpphs ==1.20.9.1,
|
any.cpphs ==1.20.9.1,
|
||||||
cpphs -old-locale,
|
cpphs -old-locale,
|
||||||
any.cryptohash-sha1 ==0.11.100.1,
|
any.cryptohash-sha1 ==0.11.100.1,
|
||||||
any.cryptohash-sha256 ==0.11.102.1,
|
any.cryptohash-sha256 ==0.11.102.0,
|
||||||
cryptohash-sha256 -exe +use-cbits,
|
cryptohash-sha256 -exe +use-cbits,
|
||||||
any.data-clist ==0.1.2.3,
|
any.data-clist ==0.1.2.3,
|
||||||
any.data-fix ==0.3.2,
|
any.data-fix ==0.3.2,
|
||||||
@@ -81,18 +80,16 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.exceptions ==0.10.4,
|
any.exceptions ==0.10.4,
|
||||||
any.filepath ==1.4.2.1,
|
any.filepath ==1.4.2.1,
|
||||||
any.free ==5.1.7,
|
any.free ==5.1.7,
|
||||||
any.fusion-plugin-types ==0.1.0,
|
|
||||||
any.generic-arbitrary ==0.1.0,
|
any.generic-arbitrary ==0.1.0,
|
||||||
any.ghc-boot-th ==8.10.7,
|
any.ghc-boot-th ==8.10.7,
|
||||||
any.ghc-byteorder ==4.11.0.0.10,
|
any.ghc-byteorder ==4.11.0.0.10,
|
||||||
any.ghc-prim ==0.6.1,
|
any.ghc-prim ==0.6.1,
|
||||||
any.happy ==1.20.0,
|
any.happy ==1.20.0,
|
||||||
any.hashable ==1.3.4.1,
|
any.hashable ==1.3.3.0,
|
||||||
hashable +integer-gmp -random-initial-seed,
|
hashable +integer-gmp -random-initial-seed,
|
||||||
any.haskus-utils-data ==1.4,
|
any.haskus-utils-data ==1.4,
|
||||||
any.haskus-utils-types ==1.5.1,
|
any.haskus-utils-types ==1.5.1,
|
||||||
any.haskus-utils-variant ==3.1,
|
any.haskus-utils-variant ==3.1,
|
||||||
any.heaps ==0.4,
|
|
||||||
any.hsc2hs ==0.68.7,
|
any.hsc2hs ==0.68.7,
|
||||||
hsc2hs -in-ghc-tree,
|
hsc2hs -in-ghc-tree,
|
||||||
any.hspec ==2.7.10,
|
any.hspec ==2.7.10,
|
||||||
@@ -112,20 +109,16 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
io-streams +network -nointeractivetests +zlib,
|
io-streams +network -nointeractivetests +zlib,
|
||||||
any.language-c ==0.9.0.1,
|
any.language-c ==0.9.0.1,
|
||||||
language-c -allwarnings +iecfpextension +usebytestrings,
|
language-c -allwarnings +iecfpextension +usebytestrings,
|
||||||
any.libarchive ==3.0.3.1,
|
any.libarchive ==3.0.3.0,
|
||||||
libarchive -cross -low-memory -system-libarchive,
|
libarchive -cross -low-memory -system-libarchive,
|
||||||
any.libyaml-streamly ==0.2.0,
|
|
||||||
libyaml-streamly -no-unicode -system-libyaml,
|
|
||||||
any.lockfree-queue ==0.2.3.1,
|
|
||||||
any.lzma-static ==5.2.5.4,
|
any.lzma-static ==5.2.5.4,
|
||||||
any.megaparsec ==9.0.1,
|
any.megaparsec ==9.0.1,
|
||||||
megaparsec -dev,
|
megaparsec -dev,
|
||||||
any.microlens ==0.4.12.0,
|
any.microlens ==0.4.12.0,
|
||||||
any.microlens-mtl ==0.2.0.1,
|
any.microlens-mtl ==0.2.0.1,
|
||||||
any.microlens-th ==0.4.3.10,
|
any.microlens-th ==0.4.3.10,
|
||||||
any.monad-control ==1.0.3.1,
|
|
||||||
any.mtl ==2.2.2,
|
any.mtl ==2.2.2,
|
||||||
any.network ==3.1.2.5,
|
any.network ==3.1.2.2,
|
||||||
network -devel,
|
network -devel,
|
||||||
any.network-uri ==2.6.4.1,
|
any.network-uri ==2.6.4.1,
|
||||||
any.openssl-streams ==1.2.3.0,
|
any.openssl-streams ==1.2.3.0,
|
||||||
@@ -136,7 +129,7 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.optics-th ==0.4,
|
any.optics-th ==0.4,
|
||||||
any.optparse-applicative ==0.16.1.0,
|
any.optparse-applicative ==0.16.1.0,
|
||||||
optparse-applicative +process,
|
optparse-applicative +process,
|
||||||
any.os-release ==1.0.2.1,
|
any.os-release ==1.0.2,
|
||||||
os-release -devel,
|
os-release -devel,
|
||||||
any.parallel ==3.2.2.0,
|
any.parallel ==3.2.2.0,
|
||||||
any.parsec ==3.1.14.0,
|
any.parsec ==3.1.14.0,
|
||||||
@@ -157,24 +150,18 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.regex-posix ==0.96.0.1,
|
any.regex-posix ==0.96.0.1,
|
||||||
regex-posix -_regex-posix-clib,
|
regex-posix -_regex-posix-clib,
|
||||||
any.resourcet ==1.2.4.3,
|
any.resourcet ==1.2.4.3,
|
||||||
any.retry ==0.8.1.2,
|
|
||||||
retry -lib-werror,
|
|
||||||
any.rts ==1.0.1,
|
any.rts ==1.0.1,
|
||||||
any.safe ==0.3.19,
|
any.safe ==0.3.19,
|
||||||
any.safe-exceptions ==0.1.7.2,
|
any.safe-exceptions ==0.1.7.2,
|
||||||
any.scientific ==0.3.7.0,
|
any.scientific ==0.3.7.0,
|
||||||
scientific -bytestring-builder -integer-simple,
|
scientific -bytestring-builder -integer-simple,
|
||||||
any.semialign ==1.2,
|
any.semigroupoids ==5.3.5,
|
||||||
semialign +semigroupoids,
|
|
||||||
any.semigroupoids ==5.3.6,
|
|
||||||
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
||||||
any.setenv ==0.1.1.3,
|
any.setenv ==0.1.1.3,
|
||||||
any.split ==0.2.3.4,
|
any.split ==0.2.3.4,
|
||||||
any.splitmix ==0.1.0.3,
|
any.splitmix ==0.1.0.3,
|
||||||
splitmix -optimised-mixer,
|
splitmix -optimised-mixer,
|
||||||
any.stm ==2.5.0.1,
|
any.stm ==2.5.0.1,
|
||||||
any.streamly ==0.8.0,
|
|
||||||
streamly -debug -dev -fusion-plugin -has-llvm -inspection -no-fusion +opt -streamk -use-c-malloc,
|
|
||||||
any.strict ==0.4.0.1,
|
any.strict ==0.4.0.1,
|
||||||
strict +assoc,
|
strict +assoc,
|
||||||
any.strict-base ==0.4.0.0,
|
any.strict-base ==0.4.0.0,
|
||||||
@@ -203,7 +190,7 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.transformers-compat ==0.7,
|
any.transformers-compat ==0.7,
|
||||||
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
||||||
any.unix ==2.7.2.2,
|
any.unix ==2.7.2.2,
|
||||||
any.unix-bytestring ==0.3.7.5,
|
any.unix-bytestring ==0.3.7.3,
|
||||||
any.unix-compat ==0.5.3,
|
any.unix-compat ==0.5.3,
|
||||||
unix-compat -old-time,
|
unix-compat -old-time,
|
||||||
any.unliftio-core ==0.2.0.1,
|
any.unliftio-core ==0.2.0.1,
|
||||||
@@ -217,13 +204,10 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
vector +boundschecks -internalchecks -unsafechecks -wall,
|
vector +boundschecks -internalchecks -unsafechecks -wall,
|
||||||
any.versions ==5.0.0,
|
any.versions ==5.0.0,
|
||||||
any.vty ==5.33,
|
any.vty ==5.33,
|
||||||
any.witherable ==0.4.2,
|
|
||||||
any.word-wrap ==0.5,
|
any.word-wrap ==0.5,
|
||||||
any.word8 ==0.1.3,
|
any.word8 ==0.1.3,
|
||||||
any.xor ==0.0.1.0,
|
any.xor ==0.0.1.0,
|
||||||
any.yaml-streamly ==0.12.0,
|
|
||||||
yaml-streamly +no-examples +no-exe,
|
|
||||||
any.zlib ==0.6.2.3,
|
any.zlib ==0.6.2.3,
|
||||||
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
|
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
|
||||||
any.zlib-bindings ==0.1.1.5
|
any.zlib-bindings ==0.1.1.5
|
||||||
index-state: hackage.haskell.org 2021-10-24T10:21:56Z
|
index-state: hackage.haskell.org 2021-10-01T15:16:26Z
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ package ghcup
|
|||||||
tests: True
|
tests: True
|
||||||
flags: +tui
|
flags: +tui
|
||||||
|
|
||||||
constraints: http-io-streams -brotli,
|
constraints: http-io-streams -brotli
|
||||||
any.Cabal ==3.6.2.0,
|
|
||||||
any.aeson >= 2.0.1.0
|
|
||||||
|
|
||||||
package libarchive
|
package libarchive
|
||||||
flags: -system-libarchive
|
flags: -system-libarchive
|
||||||
@@ -21,9 +19,6 @@ package aeson-pretty
|
|||||||
package cabal-plan
|
package cabal-plan
|
||||||
flags: -exe
|
flags: -exe
|
||||||
|
|
||||||
package aeson
|
|
||||||
flags: +ordered-keymap
|
|
||||||
|
|
||||||
allow-newer: base, ghc-prim, template-haskell, language-c
|
allow-newer: base, ghc-prim, template-haskell, language-c
|
||||||
|
|
||||||
with-compiler: ghc-9.0.1
|
with-compiler: ghc-9.0.1
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
active-repositories: hackage.haskell.org:merge
|
active-repositories: hackage.haskell.org:merge
|
||||||
constraints: any.Cabal ==3.6.2.0,
|
constraints: any.Cabal ==3.4.0.0 || ==3.6.1.0,
|
||||||
Cabal -bundled-binary-generic,
|
Cabal -bundled-binary-generic,
|
||||||
any.HUnit ==1.6.2.0,
|
any.HUnit ==1.6.2.0,
|
||||||
any.HsOpenSSL ==0.11.7.2,
|
any.HsOpenSSL ==0.11.7.2,
|
||||||
HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config,
|
HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config,
|
||||||
|
any.HsYAML ==0.2.1.0,
|
||||||
|
HsYAML -exe,
|
||||||
|
any.HsYAML-aeson ==0.2.0.0,
|
||||||
any.QuickCheck ==2.14.2,
|
any.QuickCheck ==2.14.2,
|
||||||
QuickCheck -old-random +templatehaskell,
|
QuickCheck -old-random +templatehaskell,
|
||||||
any.StateVar ==1.2.2,
|
any.StateVar ==1.2.2,
|
||||||
any.abstract-deque ==0.3,
|
any.aeson ==1.5.6.0,
|
||||||
abstract-deque -usecas,
|
aeson -bytestring-builder -cffi -developer -fast,
|
||||||
any.aeson ==2.0.1.0,
|
any.aeson-pretty ==0.8.8,
|
||||||
aeson -bytestring-builder -cffi +ordered-keymap,
|
|
||||||
any.aeson-pretty ==0.8.9,
|
|
||||||
aeson-pretty +lib-only,
|
aeson-pretty +lib-only,
|
||||||
any.alex ==3.2.6,
|
any.alex ==3.2.6,
|
||||||
alex +small_base,
|
alex +small_base,
|
||||||
@@ -21,10 +22,8 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
ansi-wl-pprint -example,
|
ansi-wl-pprint -example,
|
||||||
any.array ==0.5.4.0,
|
any.array ==0.5.4.0,
|
||||||
any.assoc ==1.0.2,
|
any.assoc ==1.0.2,
|
||||||
any.async ==2.2.4,
|
any.async ==2.2.3,
|
||||||
async -bench,
|
async -bench,
|
||||||
any.atomic-primops ==0.8.4,
|
|
||||||
atomic-primops -debug,
|
|
||||||
any.attoparsec ==0.13.2.5,
|
any.attoparsec ==0.13.2.5,
|
||||||
attoparsec -developer,
|
attoparsec -developer,
|
||||||
any.base ==4.15.0.0,
|
any.base ==4.15.0.0,
|
||||||
@@ -36,15 +35,15 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.bifunctors ==5.5.11,
|
any.bifunctors ==5.5.11,
|
||||||
bifunctors +semigroups +tagged,
|
bifunctors +semigroups +tagged,
|
||||||
any.binary ==0.8.8.0,
|
any.binary ==0.8.8.0,
|
||||||
any.blaze-builder ==0.4.2.2,
|
any.blaze-builder ==0.4.2.1,
|
||||||
any.brick ==0.64.2,
|
any.brick ==0.64.1,
|
||||||
brick -demos,
|
brick -demos,
|
||||||
any.bytestring ==0.10.12.1,
|
any.bytestring ==0.10.12.1,
|
||||||
any.bz2 ==1.0.1.0,
|
any.bz2 ==1.0.1.0,
|
||||||
bz2 -cross +with-bzlib,
|
bz2 -cross +with-bzlib,
|
||||||
any.c2hs ==0.28.8,
|
any.c2hs ==0.28.8,
|
||||||
c2hs +base3 -regression,
|
c2hs +base3 -regression,
|
||||||
any.cabal-plan ==0.7.2.1,
|
any.cabal-plan ==0.7.2.0,
|
||||||
cabal-plan -_ -exe -license-report,
|
cabal-plan -_ -exe -license-report,
|
||||||
any.call-stack ==0.4.0,
|
any.call-stack ==0.4.0,
|
||||||
any.case-insensitive ==1.2.1.0,
|
any.case-insensitive ==1.2.1.0,
|
||||||
@@ -67,7 +66,7 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.cpphs ==1.20.9.1,
|
any.cpphs ==1.20.9.1,
|
||||||
cpphs -old-locale,
|
cpphs -old-locale,
|
||||||
any.cryptohash-sha1 ==0.11.100.1,
|
any.cryptohash-sha1 ==0.11.100.1,
|
||||||
any.cryptohash-sha256 ==0.11.102.1,
|
any.cryptohash-sha256 ==0.11.102.0,
|
||||||
cryptohash-sha256 -exe +use-cbits,
|
cryptohash-sha256 -exe +use-cbits,
|
||||||
any.data-clist ==0.1.2.3,
|
any.data-clist ==0.1.2.3,
|
||||||
any.data-fix ==0.3.2,
|
any.data-fix ==0.3.2,
|
||||||
@@ -81,19 +80,17 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.exceptions ==0.10.4,
|
any.exceptions ==0.10.4,
|
||||||
any.filepath ==1.4.2.1,
|
any.filepath ==1.4.2.1,
|
||||||
any.free ==5.1.7,
|
any.free ==5.1.7,
|
||||||
any.fusion-plugin-types ==0.1.0,
|
|
||||||
any.generic-arbitrary ==0.1.0,
|
any.generic-arbitrary ==0.1.0,
|
||||||
any.ghc-bignum ==1.0,
|
any.ghc-bignum ==1.0,
|
||||||
any.ghc-boot-th ==9.0.1,
|
any.ghc-boot-th ==9.0.1,
|
||||||
any.ghc-byteorder ==4.11.0.0.10,
|
any.ghc-byteorder ==4.11.0.0.10,
|
||||||
any.ghc-prim ==0.7.0,
|
any.ghc-prim ==0.7.0,
|
||||||
any.happy ==1.20.0,
|
any.happy ==1.20.0,
|
||||||
any.hashable ==1.3.4.1,
|
any.hashable ==1.3.3.0,
|
||||||
hashable +integer-gmp -random-initial-seed,
|
hashable +integer-gmp -random-initial-seed,
|
||||||
any.haskus-utils-data ==1.4,
|
any.haskus-utils-data ==1.4,
|
||||||
any.haskus-utils-types ==1.5.1,
|
any.haskus-utils-types ==1.5.1,
|
||||||
any.haskus-utils-variant ==3.1,
|
any.haskus-utils-variant ==3.1,
|
||||||
any.heaps ==0.4,
|
|
||||||
any.hsc2hs ==0.68.7,
|
any.hsc2hs ==0.68.7,
|
||||||
hsc2hs -in-ghc-tree,
|
hsc2hs -in-ghc-tree,
|
||||||
any.hspec ==2.7.10,
|
any.hspec ==2.7.10,
|
||||||
@@ -112,20 +109,16 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
io-streams +network -nointeractivetests +zlib,
|
io-streams +network -nointeractivetests +zlib,
|
||||||
any.language-c ==0.9.0.1,
|
any.language-c ==0.9.0.1,
|
||||||
language-c -allwarnings +iecfpextension +usebytestrings,
|
language-c -allwarnings +iecfpextension +usebytestrings,
|
||||||
any.libarchive ==3.0.3.1,
|
any.libarchive ==3.0.3.0,
|
||||||
libarchive -cross -low-memory -system-libarchive,
|
libarchive -cross -low-memory -system-libarchive,
|
||||||
any.libyaml-streamly ==0.2.0,
|
|
||||||
libyaml-streamly -no-unicode -system-libyaml,
|
|
||||||
any.lockfree-queue ==0.2.3.1,
|
|
||||||
any.lzma-static ==5.2.5.4,
|
any.lzma-static ==5.2.5.4,
|
||||||
any.megaparsec ==9.0.1,
|
any.megaparsec ==9.0.1,
|
||||||
megaparsec -dev,
|
megaparsec -dev,
|
||||||
any.microlens ==0.4.12.0,
|
any.microlens ==0.4.12.0,
|
||||||
any.microlens-mtl ==0.2.0.1,
|
any.microlens-mtl ==0.2.0.1,
|
||||||
any.microlens-th ==0.4.3.10,
|
any.microlens-th ==0.4.3.10,
|
||||||
any.monad-control ==1.0.3.1,
|
|
||||||
any.mtl ==2.2.2,
|
any.mtl ==2.2.2,
|
||||||
any.network ==3.1.2.5,
|
any.network ==3.1.2.2,
|
||||||
network -devel,
|
network -devel,
|
||||||
any.network-uri ==2.6.4.1,
|
any.network-uri ==2.6.4.1,
|
||||||
any.openssl-streams ==1.2.3.0,
|
any.openssl-streams ==1.2.3.0,
|
||||||
@@ -136,7 +129,7 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.optics-th ==0.4,
|
any.optics-th ==0.4,
|
||||||
any.optparse-applicative ==0.16.1.0,
|
any.optparse-applicative ==0.16.1.0,
|
||||||
optparse-applicative +process,
|
optparse-applicative +process,
|
||||||
any.os-release ==1.0.2.1,
|
any.os-release ==1.0.2,
|
||||||
os-release -devel,
|
os-release -devel,
|
||||||
any.parallel ==3.2.2.0,
|
any.parallel ==3.2.2.0,
|
||||||
any.parsec ==3.1.14.0,
|
any.parsec ==3.1.14.0,
|
||||||
@@ -157,24 +150,18 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.regex-posix ==0.96.0.1,
|
any.regex-posix ==0.96.0.1,
|
||||||
regex-posix -_regex-posix-clib,
|
regex-posix -_regex-posix-clib,
|
||||||
any.resourcet ==1.2.4.3,
|
any.resourcet ==1.2.4.3,
|
||||||
any.retry ==0.8.1.2,
|
|
||||||
retry -lib-werror,
|
|
||||||
any.rts ==1.0,
|
any.rts ==1.0,
|
||||||
any.safe ==0.3.19,
|
any.safe ==0.3.19,
|
||||||
any.safe-exceptions ==0.1.7.2,
|
any.safe-exceptions ==0.1.7.2,
|
||||||
any.scientific ==0.3.7.0,
|
any.scientific ==0.3.7.0,
|
||||||
scientific -bytestring-builder -integer-simple,
|
scientific -bytestring-builder -integer-simple,
|
||||||
any.semialign ==1.2,
|
any.semigroupoids ==5.3.5,
|
||||||
semialign +semigroupoids,
|
|
||||||
any.semigroupoids ==5.3.6,
|
|
||||||
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
||||||
any.setenv ==0.1.1.3,
|
any.setenv ==0.1.1.3,
|
||||||
any.split ==0.2.3.4,
|
any.split ==0.2.3.4,
|
||||||
any.splitmix ==0.1.0.3,
|
any.splitmix ==0.1.0.3,
|
||||||
splitmix -optimised-mixer,
|
splitmix -optimised-mixer,
|
||||||
any.stm ==2.5.0.0,
|
any.stm ==2.5.0.0,
|
||||||
any.streamly ==0.8.0,
|
|
||||||
streamly -debug -dev -fusion-plugin -has-llvm -inspection -no-fusion +opt -streamk -use-c-malloc,
|
|
||||||
any.strict ==0.4.0.1,
|
any.strict ==0.4.0.1,
|
||||||
strict +assoc,
|
strict +assoc,
|
||||||
any.strict-base ==0.4.0.0,
|
any.strict-base ==0.4.0.0,
|
||||||
@@ -203,7 +190,7 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
any.transformers-compat ==0.7,
|
any.transformers-compat ==0.7,
|
||||||
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
||||||
any.unix ==2.7.2.2,
|
any.unix ==2.7.2.2,
|
||||||
any.unix-bytestring ==0.3.7.5,
|
any.unix-bytestring ==0.3.7.3,
|
||||||
any.unix-compat ==0.5.3,
|
any.unix-compat ==0.5.3,
|
||||||
unix-compat -old-time,
|
unix-compat -old-time,
|
||||||
any.unliftio-core ==0.2.0.1,
|
any.unliftio-core ==0.2.0.1,
|
||||||
@@ -217,13 +204,10 @@ constraints: any.Cabal ==3.6.2.0,
|
|||||||
vector +boundschecks -internalchecks -unsafechecks -wall,
|
vector +boundschecks -internalchecks -unsafechecks -wall,
|
||||||
any.versions ==5.0.0,
|
any.versions ==5.0.0,
|
||||||
any.vty ==5.33,
|
any.vty ==5.33,
|
||||||
any.witherable ==0.4.2,
|
|
||||||
any.word-wrap ==0.5,
|
any.word-wrap ==0.5,
|
||||||
any.word8 ==0.1.3,
|
any.word8 ==0.1.3,
|
||||||
any.xor ==0.0.1.0,
|
any.xor ==0.0.1.0,
|
||||||
any.yaml-streamly ==0.12.0,
|
|
||||||
yaml-streamly +no-examples +no-exe,
|
|
||||||
any.zlib ==0.6.2.3,
|
any.zlib ==0.6.2.3,
|
||||||
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
|
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
|
||||||
any.zlib-bindings ==0.1.1.5
|
any.zlib-bindings ==0.1.1.5
|
||||||
index-state: hackage.haskell.org 2021-10-24T10:21:56Z
|
index-state: hackage.haskell.org 2021-10-01T15:16:26Z
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ package ghcup
|
|||||||
flags: +tui
|
flags: +tui
|
||||||
|
|
||||||
constraints: http-io-streams -brotli,
|
constraints: http-io-streams -brotli,
|
||||||
any.Cabal ==3.6.2.0,
|
any.Cabal ==3.4.1.0 || ==3.6.2.0,
|
||||||
any.aeson >= 2.0.1.0
|
any.aeson >= 2.0.1.0
|
||||||
|
|
||||||
package libarchive
|
package libarchive
|
||||||
|
|||||||
@@ -36,10 +36,6 @@ key-bindings:
|
|||||||
show-all-tools:
|
show-all-tools:
|
||||||
KChar: 't'
|
KChar: 't'
|
||||||
|
|
||||||
# The caching for the metadata files containing download info, depending on last access time
|
|
||||||
# of the file. These usually are in '~/.ghcup/cache/ghcup-<ver>.yaml'.
|
|
||||||
meta-cache: 300 # in seconds
|
|
||||||
|
|
||||||
# Where to get GHC/cabal/hls download info/versions from. For more detailed explanation
|
# Where to get GHC/cabal/hls download info/versions from. For more detailed explanation
|
||||||
# check the 'URLSource' type in the code.
|
# check the 'URLSource' type in the code.
|
||||||
url-source:
|
url-source:
|
||||||
|
|||||||
16
docs/dev.md
16
docs/dev.md
@@ -95,19 +95,21 @@ Every subcommand now lives in its own module under [GHCup.OptParse.MyCommand](ht
|
|||||||
|
|
||||||
3. Add ChangeLog entry
|
3. Add ChangeLog entry
|
||||||
|
|
||||||
4. Commit and git push with tag. Wait for tests to succeed and release artifacts to build.
|
4. Add/fix downloads in `ghcup-<ver>.yaml` ([ghcup-metadata repo](https://github.com/haskell/ghcup-metadata)), then verify with `ghcup-gen check -f ghcup-<ver>.yaml` and possibly (example only) `ghcup-gen check-tarballs -f ghcup-<ver>.yaml -u 'ghc-8.10.7'`. Generally, new GHC/cabal/stack/hls versions are only added to the latest yaml file. New GHCup versions are added to all (great care must be taken here to not break the parser... e.g. ARM platforms don't parse in all older formats).
|
||||||
|
|
||||||
5. Download release artifacts and upload them `downloads.haskell.org/~ghcup` along with checksum files (`sha256sum --tag * > SHA256SUMS && gpg --detach-sign -u <your-email> SHA256SUMS`)
|
5. Commit and git push with tag. Wait for tests to succeed and release artifacts to build.
|
||||||
|
|
||||||
6. Add ghcup release artifacts to ALL yaml files, see [ghcup-metadata repo](https://github.com/haskell/ghcup-metadata)
|
6. Download release artifacts and upload them `downloads.haskell.org/~ghcup` along with checksum files (`sha256sum --tag * > SHA256SUMS && gpg --detach-sign -u <your-email> SHA256SUMS`)
|
||||||
|
|
||||||
7. Upload the final `ghcup-<ver>.yaml` (and a detached GPG sig of it) to `webhost.haskell.org/ghcup/data/` (for yaml versions <= 0.0.6) as well as [https://github.com/haskell/ghcup-metadata](https://github.com/haskell/ghcup-metadata) (for all versions).
|
7. Add ghcup release artifacts to ALL yaml files (see point 4.)
|
||||||
|
|
||||||
8. Upload `bootstrap-haskell` and `bootstrap-haskell.ps1` to `webhost.haskell.org/ghcup/sh/`
|
8. Upload the final `ghcup-<ver>.yaml` (and a detached GPG sig of it) to `webhost.haskell.org/ghcup/data/` (for yaml versions <= 0.0.6) as well as [https://github.com/haskell/ghcup-metadata](https://github.com/haskell/ghcup-metadata) (for all versions).
|
||||||
|
|
||||||
9. Update the top-level ghcup symlinks at `downloads.haskell.org/~ghcup`
|
9. Upload `bootstrap-haskell` and `bootstrap-haskell.ps1` to `webhost.haskell.org/ghcup/sh/`
|
||||||
|
|
||||||
10. Post on reddit/discourse/etc. and collect rewards
|
10. Update the top-level ghcup symlinks at `downloads.haskell.org/~ghcup`
|
||||||
|
|
||||||
|
11. Post on reddit/discourse/etc. and collect rewards
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
|
|
||||||
|
|||||||
@@ -53,25 +53,6 @@ as e.g. `/etc/bash_completion.d/ghcup` (depending on distro)
|
|||||||
and make sure your bashrc sources the startup script
|
and make sure your bashrc sources the startup script
|
||||||
(`/usr/share/bash-completion/bash_completion` on some distros).
|
(`/usr/share/bash-completion/bash_completion` on some distros).
|
||||||
|
|
||||||
## Caching
|
|
||||||
|
|
||||||
GHCup has a few caching mechanisms to avoid redownloads. All cached files end up in `~/.ghcup/cache` by default.
|
|
||||||
|
|
||||||
### Downloads cache
|
|
||||||
|
|
||||||
Downloaded tarballs (such as GHC, cabal, etc.) are not cached by default unless you pass `ghcup --cache` or set caching
|
|
||||||
in your [config](#configuration) via `ghcup config set cache true`.
|
|
||||||
|
|
||||||
### Metadata cache
|
|
||||||
|
|
||||||
The metadata files (also see [github.com/haskell/ghcup-metadata](https://github.com/haskell/ghcup-metadata))
|
|
||||||
have a 5 minutes cache per default depending on the last access time of the file. That means if you run
|
|
||||||
`ghcup list` 10 times in a row, only the first time will trigger a download attempt.
|
|
||||||
|
|
||||||
### Clearing the cache
|
|
||||||
|
|
||||||
If you experience problems, consider clearing the cache via `ghcup gc --cache`.
|
|
||||||
|
|
||||||
## Compiling GHC from source
|
## Compiling GHC from source
|
||||||
|
|
||||||
Compiling from source is supported for both source tarballs and arbitrary git refs. See `ghcup compile ghc --help`
|
Compiling from source is supported for both source tarballs and arbitrary git refs. See `ghcup compile ghc --help`
|
||||||
|
|||||||
68
ghcup.cabal
68
ghcup.cabal
@@ -1,6 +1,6 @@
|
|||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
name: ghcup
|
name: ghcup
|
||||||
version: 0.1.17.3
|
version: 0.1.17.2
|
||||||
license: LGPL-3.0-only
|
license: LGPL-3.0-only
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
copyright: Julian Ospald 2020
|
copyright: Julian Ospald 2020
|
||||||
@@ -18,6 +18,9 @@ build-type: Simple
|
|||||||
extra-doc-files:
|
extra-doc-files:
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
data/config.yaml
|
data/config.yaml
|
||||||
|
data/metadata/ghcup-0.0.4.yaml
|
||||||
|
data/metadata/ghcup-0.0.5.yaml
|
||||||
|
data/metadata/ghcup-0.0.6.yaml
|
||||||
README.md
|
README.md
|
||||||
|
|
||||||
extra-source-files:
|
extra-source-files:
|
||||||
@@ -43,11 +46,6 @@ flag internal-downloader
|
|||||||
default: False
|
default: False
|
||||||
manual: True
|
manual: True
|
||||||
|
|
||||||
flag no-exe
|
|
||||||
description: Don't build any executables
|
|
||||||
default: False
|
|
||||||
manual: True
|
|
||||||
|
|
||||||
library
|
library
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
GHCup
|
GHCup
|
||||||
@@ -96,7 +94,7 @@ library
|
|||||||
build-depends:
|
build-depends:
|
||||||
, aeson >=1.4
|
, aeson >=1.4
|
||||||
, async >=0.8 && <2.3
|
, async >=0.8 && <2.3
|
||||||
, base >=4.12 && <5
|
, base >=4.13 && <5
|
||||||
, base16-bytestring >=0.1.1.6 && <1.1
|
, base16-bytestring >=0.1.1.6 && <1.1
|
||||||
, binary ^>=0.8.6.0
|
, binary ^>=0.8.6.0
|
||||||
, bytestring ^>=0.10
|
, bytestring ^>=0.10
|
||||||
@@ -110,7 +108,7 @@ library
|
|||||||
, disk-free-space ^>=0.1.0.1
|
, disk-free-space ^>=0.1.0.1
|
||||||
, filepath ^>=1.4.2.1
|
, filepath ^>=1.4.2.1
|
||||||
, haskus-utils-types ^>=1.5
|
, haskus-utils-types ^>=1.5
|
||||||
, haskus-utils-variant ^>=3.2.1
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
, libarchive ^>=3.0.3.0
|
, libarchive ^>=3.0.3.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
|
||||||
@@ -219,15 +217,14 @@ executable ghcup
|
|||||||
, aeson >=1.4
|
, aeson >=1.4
|
||||||
, aeson-pretty ^>=0.8.8
|
, aeson-pretty ^>=0.8.8
|
||||||
, async ^>=2.2.3
|
, async ^>=2.2.3
|
||||||
, base >=4.12 && <5
|
, base >=4.13 && <5
|
||||||
, bytestring ^>=0.10
|
, bytestring ^>=0.10
|
||||||
, cabal-plan ^>=0.7.2
|
, cabal-plan ^>=0.7.2
|
||||||
, containers ^>=0.6
|
, containers ^>=0.6
|
||||||
, deepseq ^>=1.4
|
, deepseq ^>=1.4
|
||||||
, directory ^>=1.3.6.0
|
|
||||||
, filepath ^>=1.4.2.1
|
, filepath ^>=1.4.2.1
|
||||||
, ghcup
|
, ghcup
|
||||||
, haskus-utils-variant ^>=3.2.1
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
, libarchive ^>=3.0.3.0
|
, libarchive ^>=3.0.3.0
|
||||||
, megaparsec >=8.0.0 && <9.1
|
, megaparsec >=8.0.0 && <9.1
|
||||||
, mtl ^>=2.2
|
, mtl ^>=2.2
|
||||||
@@ -253,15 +250,56 @@ executable ghcup
|
|||||||
build-depends:
|
build-depends:
|
||||||
, brick ^>=0.64
|
, brick ^>=0.64
|
||||||
, transformers ^>=0.5
|
, transformers ^>=0.5
|
||||||
, unix ^>=2.7
|
|
||||||
, vector ^>=0.12
|
, vector ^>=0.12
|
||||||
, vty >=5.28.2 && <5.34
|
, vty >=5.28.2 && <5.34
|
||||||
|
|
||||||
if os(windows)
|
if os(windows)
|
||||||
cpp-options: -DIS_WINDOWS
|
cpp-options: -DIS_WINDOWS
|
||||||
|
|
||||||
if flag(no-exe)
|
executable ghcup-gen
|
||||||
buildable: False
|
main-is: Main.hs
|
||||||
|
hs-source-dirs: app/ghcup-gen
|
||||||
|
other-modules: Validate
|
||||||
|
default-language: Haskell2010
|
||||||
|
default-extensions:
|
||||||
|
DeriveGeneric
|
||||||
|
LambdaCase
|
||||||
|
MultiWayIf
|
||||||
|
NamedFieldPuns
|
||||||
|
PackageImports
|
||||||
|
QuasiQuotes
|
||||||
|
RecordWildCards
|
||||||
|
ScopedTypeVariables
|
||||||
|
StrictData
|
||||||
|
TupleSections
|
||||||
|
TypeApplications
|
||||||
|
TypeFamilies
|
||||||
|
ViewPatterns
|
||||||
|
|
||||||
|
ghc-options:
|
||||||
|
-Wall -fwarn-tabs -fwarn-incomplete-uni-patterns
|
||||||
|
-fwarn-incomplete-record-updates -threaded
|
||||||
|
|
||||||
|
build-depends:
|
||||||
|
, base >=4.13 && <5
|
||||||
|
, bytestring ^>=0.10
|
||||||
|
, containers ^>=0.6
|
||||||
|
, filepath ^>=1.4.2.1
|
||||||
|
, ghcup
|
||||||
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
|
, libarchive ^>=3.0.3.0
|
||||||
|
, mtl ^>=2.2
|
||||||
|
, optics ^>=0.4
|
||||||
|
, optparse-applicative >=0.15.1.0 && <0.17
|
||||||
|
, pretty ^>=1.1.3.1
|
||||||
|
, pretty-terminal ^>=0.1.0.0
|
||||||
|
, regex-posix ^>=0.96
|
||||||
|
, resourcet ^>=1.2.2
|
||||||
|
, safe-exceptions ^>=0.1
|
||||||
|
, text ^>=1.2.4.0
|
||||||
|
, transformers ^>=0.5
|
||||||
|
, versions >=4.0.1 && <5.1
|
||||||
|
, yaml-streamly ^>=0.12.0
|
||||||
|
|
||||||
test-suite ghcup-test
|
test-suite ghcup-test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
@@ -287,7 +325,7 @@ test-suite ghcup-test
|
|||||||
-fwarn-incomplete-record-updates
|
-fwarn-incomplete-record-updates
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
, base >=4.12 && <5
|
, base >=4.13 && <5
|
||||||
, bytestring ^>=0.10
|
, bytestring ^>=0.10
|
||||||
, containers ^>=0.6
|
, containers ^>=0.6
|
||||||
, generic-arbitrary ^>=0.1.0
|
, generic-arbitrary ^>=0.1.0
|
||||||
|
|||||||
2
hie.yaml
2
hie.yaml
@@ -4,5 +4,7 @@ cradle:
|
|||||||
path: ./lib
|
path: ./lib
|
||||||
- component: "ghcup:exe:ghcup"
|
- component: "ghcup:exe:ghcup"
|
||||||
path: ./app/ghcup
|
path: ./app/ghcup
|
||||||
|
- component: "ghcup:exe:ghcup-gen"
|
||||||
|
path: "./app/ghcup-gen"
|
||||||
- component: "ghcup:test:ghcup-test"
|
- component: "ghcup:test:ghcup-test"
|
||||||
path: ./test
|
path: ./test
|
||||||
|
|||||||
95
lib/GHCup.hs
95
lib/GHCup.hs
@@ -62,7 +62,7 @@ import Data.String ( fromString )
|
|||||||
import Data.Text ( Text )
|
import Data.Text ( Text )
|
||||||
import Data.Time.Clock
|
import Data.Time.Clock
|
||||||
import Data.Time.Format.ISO8601
|
import Data.Time.Format.ISO8601
|
||||||
import Data.Versions hiding ( patch )
|
import Data.Versions
|
||||||
import Distribution.Types.Version hiding ( Version )
|
import Distribution.Types.Version hiding ( Version )
|
||||||
import Distribution.Types.PackageId
|
import Distribution.Types.PackageId
|
||||||
import Distribution.Types.PackageDescription
|
import Distribution.Types.PackageDescription
|
||||||
@@ -84,7 +84,6 @@ import System.IO.Error
|
|||||||
import System.IO.Temp
|
import System.IO.Temp
|
||||||
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
import Text.Regex.Posix
|
import Text.Regex.Posix
|
||||||
import URI.ByteString
|
|
||||||
|
|
||||||
import qualified Crypto.Hash.SHA256 as SHA256
|
import qualified Crypto.Hash.SHA256 as SHA256
|
||||||
import qualified Data.List.NonEmpty as NE
|
import qualified Data.List.NonEmpty as NE
|
||||||
@@ -751,10 +750,9 @@ compileHLS :: ( MonadMask m
|
|||||||
-> Maybe Int
|
-> Maybe Int
|
||||||
-> Maybe Version
|
-> Maybe Version
|
||||||
-> Maybe FilePath
|
-> Maybe FilePath
|
||||||
-> Maybe (Either FilePath URI)
|
-> Maybe FilePath
|
||||||
-> Maybe URI
|
-> Maybe FilePath
|
||||||
-> Maybe (Either FilePath [URI]) -- ^ patches
|
-> Maybe FilePath
|
||||||
-> [Text] -- ^ additional args to cabal install
|
|
||||||
-> Excepts '[ NoDownload
|
-> Excepts '[ NoDownload
|
||||||
, GPGError
|
, GPGError
|
||||||
, DownloadFailed
|
, DownloadFailed
|
||||||
@@ -765,12 +763,11 @@ compileHLS :: ( MonadMask m
|
|||||||
, BuildFailed
|
, BuildFailed
|
||||||
, NotInstalled
|
, NotInstalled
|
||||||
] m Version
|
] m Version
|
||||||
compileHLS targetHLS ghcs jobs ov isolateDir cabalProject cabalProjectLocal patches cabalArgs = do
|
compileHLS targetHLS ghcs jobs ov isolateDir cabalProject cabalProjectLocal patchdir = do
|
||||||
PlatformRequest { .. } <- lift getPlatformReq
|
PlatformRequest { .. } <- lift getPlatformReq
|
||||||
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
||||||
Dirs { .. } <- lift getDirs
|
Dirs { .. } <- lift getDirs
|
||||||
|
|
||||||
|
|
||||||
(workdir, tver) <- case targetHLS of
|
(workdir, tver) <- case targetHLS of
|
||||||
-- unpack from version tarball
|
-- unpack from version tarball
|
||||||
Left tver -> do
|
Left tver -> do
|
||||||
@@ -837,51 +834,48 @@ compileHLS targetHLS ghcs jobs ov isolateDir cabalProject cabalProjectLocal patc
|
|||||||
liftE $ runBuildAction
|
liftE $ runBuildAction
|
||||||
workdir
|
workdir
|
||||||
Nothing
|
Nothing
|
||||||
(reThrowAll @_ @'[GPGError, DownloadFailed, DigestError, PatchFailed, ProcessError, FileAlreadyExistsError, CopyError] @'[BuildFailed] (BuildFailed workdir) $ do
|
(reThrowAll @_ @'[PatchFailed, ProcessError, FileAlreadyExistsError, CopyError] @'[BuildFailed] (BuildFailed workdir) $ do
|
||||||
let installDir = workdir </> "out"
|
let installDir = workdir </> "out"
|
||||||
liftIO $ createDirRecursive' installDir
|
liftIO $ createDirRecursive' installDir
|
||||||
|
|
||||||
-- apply patches
|
-- apply patches
|
||||||
liftE $ applyAnyPatch patches workdir
|
forM_ patchdir (\dir -> liftE $ applyPatches dir workdir)
|
||||||
|
|
||||||
-- set up project files
|
-- set up project files
|
||||||
cp <- case cabalProject of
|
cp <- case cabalProject of
|
||||||
Just (Left cp)
|
Just cp
|
||||||
| isAbsolute cp -> do
|
| isAbsolute cp -> do
|
||||||
copyFileE cp (workdir </> "cabal.project")
|
copyFileE cp (workdir </> "cabal.project")
|
||||||
pure "cabal.project"
|
pure "cabal.project"
|
||||||
| otherwise -> pure (takeFileName cp)
|
| otherwise -> pure (takeFileName cp)
|
||||||
Just (Right uri) -> do
|
|
||||||
tmpUnpack <- lift withGHCupTmpDir
|
|
||||||
cp <- liftE $ download uri Nothing Nothing tmpUnpack (Just "cabal.project") False
|
|
||||||
copyFileE cp (workdir </> "cabal.project")
|
|
||||||
pure "cabal.project"
|
|
||||||
Nothing -> pure "cabal.project"
|
Nothing -> pure "cabal.project"
|
||||||
forM_ cabalProjectLocal $ \uri -> do
|
forM_ cabalProjectLocal $ \cpl -> copyFileE cpl (workdir </> cp <.> "local")
|
||||||
tmpUnpack <- lift withGHCupTmpDir
|
|
||||||
cpl <- liftE $ download uri Nothing Nothing tmpUnpack (Just (cp <.> "local")) False
|
let targets = ["exe:haskell-language-server", "exe:haskell-language-server-wrapper"]
|
||||||
copyFileE cpl (workdir </> cp <.> "local")
|
|
||||||
artifacts <- forM (sort ghcs) $ \ghc -> do
|
artifacts <- forM (sort ghcs) $ \ghc -> do
|
||||||
let ghcInstallDir = installDir </> T.unpack (prettyVer ghc)
|
let ghcInstallDir = installDir </> T.unpack (prettyVer ghc)
|
||||||
liftIO $ createDirRecursive' installDir
|
liftIO $ createDirRecursive' ghcInstallDir
|
||||||
lift $ logInfo $ "Building HLS " <> prettyVer installVer <> " for GHC version " <> prettyVer ghc
|
lift $ logInfo $ "Building HLS " <> prettyVer installVer <> " for GHC version " <> prettyVer ghc
|
||||||
liftE $ lEM @_ @'[ProcessError] $
|
liftE $ lEM @_ @'[ProcessError] $
|
||||||
execLogged "cabal" ( [ "v2-install"
|
execLogged "cabal" ( [ "v2-build"
|
||||||
, "-w"
|
, "-w"
|
||||||
, "ghc-" <> T.unpack (prettyVer ghc)
|
, "ghc-" <> T.unpack (prettyVer ghc)
|
||||||
, "--install-method=copy"
|
|
||||||
] ++
|
] ++
|
||||||
maybe [] (\j -> ["--jobs=" <> show j]) jobs ++
|
maybe [] (\j -> ["--jobs=" <> show j]) jobs ++
|
||||||
[ "--overwrite-policy=always"
|
[ "--project-file=" <> cp
|
||||||
, "--disable-profiling"
|
] ++ targets
|
||||||
, "--disable-tests"
|
|
||||||
, "--installdir=" <> ghcInstallDir
|
|
||||||
, "--project-file=" <> cp
|
|
||||||
] ++ fmap T.unpack cabalArgs ++ [
|
|
||||||
"exe:haskell-language-server"
|
|
||||||
, "exe:haskell-language-server-wrapper"]
|
|
||||||
)
|
)
|
||||||
(Just workdir) "cabal" Nothing
|
(Just workdir) "cabal" Nothing
|
||||||
|
forM_ targets $ \target -> do
|
||||||
|
let cabal = "cabal"
|
||||||
|
args = ["list-bin", target]
|
||||||
|
CapturedProcess{..} <- lift $ executeOut cabal args (Just workdir)
|
||||||
|
case _exitCode of
|
||||||
|
ExitFailure i -> throwE (NonZeroExit i cabal args)
|
||||||
|
_ -> pure ()
|
||||||
|
let cbin = stripNewlineEnd . T.unpack . decUTF8Safe' $ _stdOut
|
||||||
|
copyFileE cbin (ghcInstallDir </> takeFileName cbin)
|
||||||
pure ghcInstallDir
|
pure ghcInstallDir
|
||||||
|
|
||||||
forM_ artifacts $ \artifact -> do
|
forM_ artifacts $ \artifact -> do
|
||||||
@@ -1108,7 +1102,7 @@ setGHC ver sghc = do
|
|||||||
pure $ Just (file <> "-" <> verS)
|
pure $ Just (file <> "-" <> verS)
|
||||||
|
|
||||||
-- create symlink
|
-- create symlink
|
||||||
forM_ mTargetFile $ \targetFile -> do
|
forM mTargetFile $ \targetFile -> do
|
||||||
let fullF = binDir </> targetFile <> exeExt
|
let fullF = binDir </> targetFile <> exeExt
|
||||||
fileWithExt = file <> exeExt
|
fileWithExt = file <> exeExt
|
||||||
destL <- lift $ ghcLinkDestination fileWithExt ver
|
destL <- lift $ ghcLinkDestination fileWithExt ver
|
||||||
@@ -1580,7 +1574,7 @@ listVersions lt' criteria = do
|
|||||||
|
|
||||||
currentGHCup :: Map.Map Version VersionInfo -> Maybe ListResult
|
currentGHCup :: Map.Map Version VersionInfo -> Maybe ListResult
|
||||||
currentGHCup av =
|
currentGHCup av =
|
||||||
let currentVer = fromJust $ pvpToVersion ghcUpVer ""
|
let currentVer = fromJust $ pvpToVersion ghcUpVer
|
||||||
listVer = Map.lookup currentVer av
|
listVer = Map.lookup currentVer av
|
||||||
latestVer = fst <$> headOf (getTagged Latest) av
|
latestVer = fst <$> headOf (getTagged Latest) av
|
||||||
recommendedVer = fst <$> headOf (getTagged Latest) av
|
recommendedVer = fst <$> headOf (getTagged Latest) av
|
||||||
@@ -2096,7 +2090,7 @@ compileGHC :: ( MonadMask m
|
|||||||
-> Either Version FilePath -- ^ version to bootstrap with
|
-> Either Version FilePath -- ^ version to bootstrap with
|
||||||
-> Maybe Int -- ^ jobs
|
-> Maybe Int -- ^ jobs
|
||||||
-> Maybe FilePath -- ^ build config
|
-> Maybe FilePath -- ^ build config
|
||||||
-> Maybe (Either FilePath [URI]) -- ^ patches
|
-> Maybe FilePath -- ^ patch directory
|
||||||
-> [Text] -- ^ additional args to ./configure
|
-> [Text] -- ^ additional args to ./configure
|
||||||
-> Maybe String -- ^ build flavour
|
-> Maybe String -- ^ build flavour
|
||||||
-> Bool
|
-> Bool
|
||||||
@@ -2125,7 +2119,7 @@ compileGHC :: ( MonadMask m
|
|||||||
]
|
]
|
||||||
m
|
m
|
||||||
GHCTargetVersion
|
GHCTargetVersion
|
||||||
compileGHC targetGhc ov bstrap jobs mbuildConfig patches aargs buildFlavour hadrian isolateDir
|
compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour hadrian isolateDir
|
||||||
= do
|
= do
|
||||||
PlatformRequest { .. } <- lift getPlatformReq
|
PlatformRequest { .. } <- lift getPlatformReq
|
||||||
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
||||||
@@ -2149,7 +2143,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patches aargs buildFlavour hadr
|
|||||||
workdir <- maybe (pure tmpUnpack)
|
workdir <- maybe (pure tmpUnpack)
|
||||||
(liftE . intoSubdir tmpUnpack)
|
(liftE . intoSubdir tmpUnpack)
|
||||||
(view dlSubdir dlInfo)
|
(view dlSubdir dlInfo)
|
||||||
liftE $ applyAnyPatch patches workdir
|
forM_ patchdir (\dir -> liftE $ applyPatches dir workdir)
|
||||||
|
|
||||||
pure (workdir, tmpUnpack, tver)
|
pure (workdir, tmpUnpack, tver)
|
||||||
|
|
||||||
@@ -2157,7 +2151,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patches aargs buildFlavour hadr
|
|||||||
Right GitBranch{..} -> do
|
Right GitBranch{..} -> do
|
||||||
tmpUnpack <- lift mkGhcupTmpDir
|
tmpUnpack <- lift mkGhcupTmpDir
|
||||||
let git args = execLogged "git" ("--no-pager":args) (Just tmpUnpack) "git" Nothing
|
let git args = execLogged "git" ("--no-pager":args) (Just tmpUnpack) "git" Nothing
|
||||||
tver <- reThrowAll @_ @'[PatchFailed, ProcessError, NotFoundInPATH, DigestError, DownloadFailed, GPGError] DownloadFailed $ do
|
tver <- reThrowAll @_ @'[PatchFailed, ProcessError, NotFoundInPATH] DownloadFailed $ do
|
||||||
let rep = fromMaybe "https://gitlab.haskell.org/ghc/ghc.git" repo
|
let rep = fromMaybe "https://gitlab.haskell.org/ghc/ghc.git" repo
|
||||||
lift $ logInfo $ "Fetching git repo " <> T.pack rep <> " at ref " <> T.pack ref <> " (this may take a while)"
|
lift $ logInfo $ "Fetching git repo " <> T.pack rep <> " at ref " <> T.pack ref <> " (this may take a while)"
|
||||||
lEM $ git [ "init" ]
|
lEM $ git [ "init" ]
|
||||||
@@ -2177,7 +2171,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patches aargs buildFlavour hadr
|
|||||||
|
|
||||||
lEM $ git [ "checkout", "FETCH_HEAD" ]
|
lEM $ git [ "checkout", "FETCH_HEAD" ]
|
||||||
lEM $ git [ "submodule", "update", "--init", "--depth", "1" ]
|
lEM $ git [ "submodule", "update", "--init", "--depth", "1" ]
|
||||||
liftE $ applyAnyPatch patches tmpUnpack
|
forM_ patchdir (\dir -> liftE $ applyPatches dir tmpUnpack)
|
||||||
lEM $ execWithGhcEnv "python3" ["./boot"] (Just tmpUnpack) "ghc-bootstrap"
|
lEM $ execWithGhcEnv "python3" ["./boot"] (Just tmpUnpack) "ghc-bootstrap"
|
||||||
lEM $ execWithGhcEnv "sh" ["./configure"] (Just tmpUnpack) "ghc-bootstrap"
|
lEM $ execWithGhcEnv "sh" ["./configure"] (Just tmpUnpack) "ghc-bootstrap"
|
||||||
CapturedProcess {..} <- lift $ makeOut
|
CapturedProcess {..} <- lift $ makeOut
|
||||||
@@ -2511,7 +2505,6 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patches aargs buildFlavour hadr
|
|||||||
execWithGhcEnv :: ( MonadReader env m
|
execWithGhcEnv :: ( MonadReader env m
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadThrow m)
|
, MonadThrow m)
|
||||||
=> FilePath -- ^ thing to execute
|
=> FilePath -- ^ thing to execute
|
||||||
@@ -2583,7 +2576,7 @@ upgradeGHCup mtarget force' = do
|
|||||||
|
|
||||||
lift $ logInfo "Upgrading GHCup..."
|
lift $ logInfo "Upgrading GHCup..."
|
||||||
let latestVer = fromJust $ fst <$> getLatest dls GHCup
|
let latestVer = fromJust $ fst <$> getLatest dls GHCup
|
||||||
(Just ghcupPVPVer) <- pure $ pvpToVersion ghcUpVer ""
|
(Just ghcupPVPVer) <- pure $ pvpToVersion ghcUpVer
|
||||||
when (not force' && (latestVer <= ghcupPVPVer)) $ throwE NoUpdate
|
when (not force' && (latestVer <= ghcupPVPVer)) $ throwE NoUpdate
|
||||||
dli <- liftE $ getDownloadInfo GHCup latestVer
|
dli <- liftE $ getDownloadInfo GHCup latestVer
|
||||||
tmp <- lift withGHCupTmpDir
|
tmp <- lift withGHCupTmpDir
|
||||||
@@ -2852,25 +2845,3 @@ rmTmp = do
|
|||||||
let p = tmpdir </> f
|
let p = tmpdir </> f
|
||||||
logDebug $ "rm -rf " <> T.pack p
|
logDebug $ "rm -rf " <> T.pack p
|
||||||
rmPathForcibly p
|
rmPathForcibly p
|
||||||
|
|
||||||
|
|
||||||
applyAnyPatch :: ( MonadReader env m
|
|
||||||
, HasDirs env
|
|
||||||
, HasLog env
|
|
||||||
, HasSettings env
|
|
||||||
, MonadUnliftIO m
|
|
||||||
, MonadCatch m
|
|
||||||
, MonadResource m
|
|
||||||
, MonadThrow m
|
|
||||||
, MonadMask m
|
|
||||||
, MonadIO m)
|
|
||||||
=> Maybe (Either FilePath [URI])
|
|
||||||
-> FilePath
|
|
||||||
-> Excepts '[PatchFailed, DownloadFailed, DigestError, GPGError] m ()
|
|
||||||
applyAnyPatch Nothing _ = pure ()
|
|
||||||
applyAnyPatch (Just (Left pdir)) workdir = liftE $ applyPatches pdir workdir
|
|
||||||
applyAnyPatch (Just (Right uris)) workdir = do
|
|
||||||
tmpUnpack <- lift withGHCupTmpDir
|
|
||||||
forM_ uris $ \uri -> do
|
|
||||||
patch <- liftE $ download uri Nothing Nothing tmpUnpack Nothing False
|
|
||||||
liftE $ applyPatch patch workdir
|
|
||||||
|
|||||||
@@ -242,18 +242,14 @@ getBase uri = do
|
|||||||
e <- liftIO $ doesFileExist json_file
|
e <- liftIO $ doesFileExist json_file
|
||||||
currentTime <- liftIO getCurrentTime
|
currentTime <- liftIO getCurrentTime
|
||||||
Dirs { cacheDir } <- lift getDirs
|
Dirs { cacheDir } <- lift getDirs
|
||||||
Settings { metaCache } <- lift getSettings
|
|
||||||
|
|
||||||
-- for local files, let's short-circuit and ignore access time
|
-- for local files, let's short-circuit and ignore access time
|
||||||
if | scheme == "file" -> liftE $ download uri' Nothing Nothing cacheDir Nothing True
|
if | scheme == "file" -> liftE $ download uri' Nothing Nothing cacheDir Nothing True
|
||||||
| e -> do
|
| e -> do
|
||||||
accessTime <- fmap utcTimeToPOSIXSeconds $ liftIO $ getAccessTime json_file
|
accessTime <- liftIO $ getAccessTime json_file
|
||||||
let sinceLastAccess = utcTimeToPOSIXSeconds currentTime - accessTime
|
|
||||||
let cacheInterval = fromInteger metaCache
|
|
||||||
lift $ logDebug $ "last access was " <> T.pack (show sinceLastAccess) <> " ago, cache interval is " <> T.pack (show cacheInterval)
|
|
||||||
-- access time won't work on most linuxes, but we can try regardless
|
-- access time won't work on most linuxes, but we can try regardless
|
||||||
if | metaCache <= 0 -> dlWithMod currentTime json_file
|
if | ((utcTimeToPOSIXSeconds currentTime - utcTimeToPOSIXSeconds accessTime) > 300) ->
|
||||||
| (sinceLastAccess > cacheInterval) ->
|
|
||||||
-- no access in last 5 minutes, re-check upstream mod time
|
-- no access in last 5 minutes, re-check upstream mod time
|
||||||
dlWithMod currentTime json_file
|
dlWithMod currentTime json_file
|
||||||
| otherwise -> pure json_file
|
| otherwise -> pure json_file
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
@@ -28,9 +27,6 @@ import GHCup.Utils.Logger
|
|||||||
import GHCup.Utils.Prelude
|
import GHCup.Utils.Prelude
|
||||||
import GHCup.Utils.String.QQ
|
import GHCup.Utils.String.QQ
|
||||||
|
|
||||||
#if !MIN_VERSION_base(4,13,0)
|
|
||||||
import Control.Monad.Fail ( MonadFail )
|
|
||||||
#endif
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
|||||||
@@ -294,7 +294,6 @@ instance NFData (URIRef Absolute) where
|
|||||||
|
|
||||||
data UserSettings = UserSettings
|
data UserSettings = UserSettings
|
||||||
{ uCache :: Maybe Bool
|
{ uCache :: Maybe Bool
|
||||||
, uMetaCache :: Maybe Integer
|
|
||||||
, uNoVerify :: Maybe Bool
|
, uNoVerify :: Maybe Bool
|
||||||
, uVerbose :: Maybe Bool
|
, uVerbose :: Maybe Bool
|
||||||
, uKeepDirs :: Maybe KeepDirs
|
, uKeepDirs :: Maybe KeepDirs
|
||||||
@@ -307,13 +306,12 @@ data UserSettings = UserSettings
|
|||||||
deriving (Show, GHC.Generic)
|
deriving (Show, GHC.Generic)
|
||||||
|
|
||||||
defaultUserSettings :: UserSettings
|
defaultUserSettings :: UserSettings
|
||||||
defaultUserSettings = UserSettings Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
|
defaultUserSettings = UserSettings Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
|
||||||
|
|
||||||
fromSettings :: Settings -> Maybe KeyBindings -> UserSettings
|
fromSettings :: Settings -> Maybe KeyBindings -> UserSettings
|
||||||
fromSettings Settings{..} Nothing =
|
fromSettings Settings{..} Nothing =
|
||||||
UserSettings {
|
UserSettings {
|
||||||
uCache = Just cache
|
uCache = Just cache
|
||||||
, uMetaCache = Just metaCache
|
|
||||||
, uNoVerify = Just noVerify
|
, uNoVerify = Just noVerify
|
||||||
, uVerbose = Just verbose
|
, uVerbose = Just verbose
|
||||||
, uKeepDirs = Just keepDirs
|
, uKeepDirs = Just keepDirs
|
||||||
@@ -337,7 +335,6 @@ fromSettings Settings{..} (Just KeyBindings{..}) =
|
|||||||
}
|
}
|
||||||
in UserSettings {
|
in UserSettings {
|
||||||
uCache = Just cache
|
uCache = Just cache
|
||||||
, uMetaCache = Just metaCache
|
|
||||||
, uNoVerify = Just noVerify
|
, uNoVerify = Just noVerify
|
||||||
, uVerbose = Just verbose
|
, uVerbose = Just verbose
|
||||||
, uKeepDirs = Just keepDirs
|
, uKeepDirs = Just keepDirs
|
||||||
@@ -413,7 +410,6 @@ instance NFData LeanAppState
|
|||||||
|
|
||||||
data Settings = Settings
|
data Settings = Settings
|
||||||
{ cache :: Bool
|
{ cache :: Bool
|
||||||
, metaCache :: Integer
|
|
||||||
, noVerify :: Bool
|
, noVerify :: Bool
|
||||||
, keepDirs :: KeepDirs
|
, keepDirs :: KeepDirs
|
||||||
, downloader :: Downloader
|
, downloader :: Downloader
|
||||||
@@ -425,12 +421,6 @@ data Settings = Settings
|
|||||||
}
|
}
|
||||||
deriving (Show, GHC.Generic)
|
deriving (Show, GHC.Generic)
|
||||||
|
|
||||||
defaultMetaCache :: Integer
|
|
||||||
defaultMetaCache = 300 -- 5 minutes
|
|
||||||
|
|
||||||
defaultSettings :: Settings
|
|
||||||
defaultSettings = Settings False defaultMetaCache False Never Curl False GHCupURL False GPGNone False
|
|
||||||
|
|
||||||
instance NFData Settings
|
instance NFData Settings
|
||||||
|
|
||||||
data Dirs = Dirs
|
data Dirs = Dirs
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ import Control.Monad.Reader
|
|||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
hiding ( throwM )
|
hiding ( throwM )
|
||||||
import Control.Monad.IO.Unlift ( MonadUnliftIO( withRunInIO ) )
|
import Control.Monad.IO.Unlift ( MonadUnliftIO( withRunInIO ) )
|
||||||
import Data.Bifunctor ( first )
|
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
import Data.Either
|
import Data.Either
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
@@ -67,7 +66,7 @@ import Data.List
|
|||||||
import Data.List.NonEmpty ( NonEmpty( (:|) ))
|
import Data.List.NonEmpty ( NonEmpty( (:|) ))
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Text ( Text )
|
import Data.Text ( Text )
|
||||||
import Data.Versions hiding ( patch )
|
import Data.Versions
|
||||||
import GHC.IO.Exception
|
import GHC.IO.Exception
|
||||||
import Haskus.Utils.Variant.Excepts
|
import Haskus.Utils.Variant.Excepts
|
||||||
import Optics
|
import Optics
|
||||||
@@ -111,8 +110,8 @@ import qualified Data.List.NonEmpty as NE
|
|||||||
-- >>> import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
-- >>> import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
-- >>> let lc = LoggerConfig { lcPrintDebug = False, consoleOutter = mempty, fileOutter = mempty, fancyColors = False }
|
-- >>> let lc = LoggerConfig { lcPrintDebug = False, consoleOutter = mempty, fileOutter = mempty, fancyColors = False }
|
||||||
-- >>> dirs' <- getAllDirs
|
-- >>> dirs' <- getAllDirs
|
||||||
-- >>> let installedVersions = [ ([pver|8.10.7|], "-debug+lol", Nothing), ([pver|8.10.4|], "", Nothing), ([pver|8.8.4|], "", Nothing), ([pver|8.8.3|], "", Nothing) ]
|
-- >>> let installedVersions = [ ([pver|8.10.7|], Nothing), ([pver|8.10.4|], Nothing), ([pver|8.8.4|], Nothing), ([pver|8.8.3|], Nothing) ]
|
||||||
-- >>> let settings = Settings True 0 False Never Curl False GHCupURL True GPGNone False
|
-- >>> let settings = Settings True False Never Curl False GHCupURL True GPGNone False
|
||||||
-- >>> let leanAppState = LeanAppState settings dirs' defaultKeyBindings lc
|
-- >>> let leanAppState = LeanAppState settings dirs' defaultKeyBindings lc
|
||||||
-- >>> cwd <- getCurrentDirectory
|
-- >>> cwd <- getCurrentDirectory
|
||||||
-- >>> (Right ref) <- pure $ parseURI strictURIParserOptions $ "file://" <> E.encodeUtf8 (T.pack cwd) <> "/data/metadata/" <> (urlBaseName . view pathL' $ ghcupURL)
|
-- >>> (Right ref) <- pure $ parseURI strictURIParserOptions $ "file://" <> E.encodeUtf8 (T.pack cwd) <> "/data/metadata/" <> (urlBaseName . view pathL' $ ghcupURL)
|
||||||
@@ -632,34 +631,34 @@ getGHCForPVP pvpIn mt = do
|
|||||||
ghcs <- rights <$> getInstalledGHCs
|
ghcs <- rights <$> getInstalledGHCs
|
||||||
-- we're permissive here... failed parse just means we have no match anyway
|
-- we're permissive here... failed parse just means we have no match anyway
|
||||||
let ghcs' = catMaybes $ flip fmap ghcs $ \GHCTargetVersion{..} -> do
|
let ghcs' = catMaybes $ flip fmap ghcs $ \GHCTargetVersion{..} -> do
|
||||||
(pvp_, rest) <- versionToPVP _tvVersion
|
pvp_ <- versionToPVP _tvVersion
|
||||||
pure (pvp_, rest, _tvTarget)
|
pure (pvp_, _tvTarget)
|
||||||
|
|
||||||
getGHCForPVP' pvpIn ghcs' mt
|
getGHCForPVP' pvpIn ghcs' mt
|
||||||
|
|
||||||
-- | Like 'getGHCForPVP', except with explicit input parameter.
|
-- | Like 'getGHCForPVP', except with explicit input parameter.
|
||||||
--
|
--
|
||||||
-- >>> getGHCForPVP' [pver|8|] installedVersions Nothing
|
-- >>> fmap prettyShow $ getGHCForPVP' [pver|8|] installedVersions Nothing
|
||||||
-- Just (GHCTargetVersion {_tvTarget = Nothing, _tvVersion = Version {_vEpoch = Nothing, _vChunks = (Digits 8 :| []) :| [Digits 10 :| [],Digits 7 :| []], _vRel = [Str "debug" :| []], _vMeta = Just "lol"}})
|
-- "Just 8.10.7"
|
||||||
-- >>> fmap prettyShow $ getGHCForPVP' [pver|8.8|] installedVersions Nothing
|
-- >>> fmap prettyShow $ getGHCForPVP' [pver|8.8|] installedVersions Nothing
|
||||||
-- "Just 8.8.4"
|
-- "Just 8.8.4"
|
||||||
-- >>> fmap prettyShow $ getGHCForPVP' [pver|8.10.4|] installedVersions Nothing
|
-- >>> fmap prettyShow $ getGHCForPVP' [pver|8.10.4|] installedVersions Nothing
|
||||||
-- "Just 8.10.4"
|
-- "Just 8.10.4"
|
||||||
getGHCForPVP' :: MonadThrow m
|
getGHCForPVP' :: MonadThrow m
|
||||||
=> PVP
|
=> PVP
|
||||||
-> [(PVP, Text, Maybe Text)] -- ^ installed GHCs
|
-> [(PVP, Maybe Text)] -- ^ installed GHCs
|
||||||
-> Maybe Text -- ^ the target triple
|
-> Maybe Text -- ^ the target triple
|
||||||
-> m (Maybe GHCTargetVersion)
|
-> m (Maybe GHCTargetVersion)
|
||||||
getGHCForPVP' pvpIn ghcs' mt = do
|
getGHCForPVP' pvpIn ghcs' mt = do
|
||||||
let mResult = lastMay
|
let mResult = lastMay
|
||||||
. sortBy (\(x, _, _) (y, _, _) -> compare x y)
|
. sortBy (\(x, _) (y, _) -> compare x y)
|
||||||
. filter
|
. filter
|
||||||
(\(pvp_, _, target) ->
|
(\(pvp_, target) ->
|
||||||
target == mt && matchPVPrefix pvp_ pvpIn
|
target == mt && matchPVPrefix pvp_ pvpIn
|
||||||
)
|
)
|
||||||
$ ghcs'
|
$ ghcs'
|
||||||
forM mResult $ \(pvp_, rest, target) -> do
|
forM mResult $ \(pvp_, target) -> do
|
||||||
ver' <- pvpToVersion pvp_ rest
|
ver' <- pvpToVersion pvp_
|
||||||
pure (GHCTargetVersion target ver')
|
pure (GHCTargetVersion target ver')
|
||||||
|
|
||||||
|
|
||||||
@@ -680,7 +679,7 @@ getLatestToolFor :: MonadThrow m
|
|||||||
getLatestToolFor tool pvpIn dls = do
|
getLatestToolFor tool pvpIn dls = do
|
||||||
let ls = fromMaybe [] $ preview (ix tool % to Map.toDescList) dls
|
let ls = fromMaybe [] $ preview (ix tool % to Map.toDescList) dls
|
||||||
let ps = catMaybes $ fmap (\(v, vi) -> (,vi) <$> versionToPVP v) ls
|
let ps = catMaybes $ fmap (\(v, vi) -> (,vi) <$> versionToPVP v) ls
|
||||||
pure . fmap (first fst) . headMay . filter (\((v, _), _) -> matchPVPrefix pvpIn v) $ ps
|
pure . headMay . filter (\(v, _) -> matchPVPrefix pvpIn v) $ ps
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -856,7 +855,6 @@ make :: ( MonadThrow m
|
|||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
)
|
)
|
||||||
=> [String]
|
=> [String]
|
||||||
@@ -892,22 +890,15 @@ applyPatches pdir ddir = do
|
|||||||
execBlank
|
execBlank
|
||||||
([s|.+\.(patch|diff)$|] :: ByteString)
|
([s|.+\.(patch|diff)$|] :: ByteString)
|
||||||
)
|
)
|
||||||
forM_ (sort patches) $ \patch' -> applyPatch patch' ddir
|
forM_ (sort patches) $ \patch' -> do
|
||||||
|
lift $ logInfo $ "Applying patch " <> T.pack patch'
|
||||||
|
fmap (either (const Nothing) Just)
|
||||||
applyPatch :: (MonadReader env m, HasDirs env, HasLog env, MonadIO m)
|
(exec
|
||||||
=> FilePath -- ^ Patch
|
"patch"
|
||||||
-> FilePath -- ^ dir to apply patches in
|
["-p1", "-i", patch']
|
||||||
-> Excepts '[PatchFailed] m ()
|
(Just ddir)
|
||||||
applyPatch patch ddir = do
|
Nothing)
|
||||||
lift $ logInfo $ "Applying patch " <> T.pack patch
|
!? PatchFailed
|
||||||
fmap (either (const Nothing) Just)
|
|
||||||
(exec
|
|
||||||
"patch"
|
|
||||||
["-p1", "-s", "-f", "-i", patch]
|
|
||||||
(Just ddir)
|
|
||||||
Nothing)
|
|
||||||
!? PatchFailed
|
|
||||||
|
|
||||||
|
|
||||||
-- | https://gitlab.haskell.org/ghc/ghc/-/issues/17353
|
-- | https://gitlab.haskell.org/ghc/ghc/-/issues/17353
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ executeOut path args chdir = liftIO $ captureOutStreams $ do
|
|||||||
|
|
||||||
execLogged :: ( MonadReader env m
|
execLogged :: ( MonadReader env m
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasLog env
|
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadThrow m)
|
, MonadThrow m)
|
||||||
@@ -86,7 +85,6 @@ execLogged :: ( MonadReader env m
|
|||||||
execLogged exe args chdir lfile env = do
|
execLogged exe args chdir lfile env = do
|
||||||
Settings {..} <- getSettings
|
Settings {..} <- getSettings
|
||||||
Dirs {..} <- getDirs
|
Dirs {..} <- getDirs
|
||||||
logDebug $ T.pack $ "Running " <> exe <> " with arguments " <> show args
|
|
||||||
let logfile = logsDir </> lfile <> ".log"
|
let logfile = logsDir </> lfile <> ".log"
|
||||||
liftIO $ bracket (openFd logfile WriteOnly (Just newFilePerms) defaultFileFlags{ append = True })
|
liftIO $ bracket (openFd logfile WriteOnly (Just newFilePerms) defaultFileFlags{ append = True })
|
||||||
closeFd
|
closeFd
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ module GHCup.Utils.File.Windows where
|
|||||||
import {-# SOURCE #-} GHCup.Utils ( getLinkTarget, pathIsLink )
|
import {-# SOURCE #-} GHCup.Utils ( getLinkTarget, pathIsLink )
|
||||||
import GHCup.Utils.Dirs
|
import GHCup.Utils.Dirs
|
||||||
import GHCup.Utils.File.Common
|
import GHCup.Utils.File.Common
|
||||||
import GHCup.Utils.Logger
|
|
||||||
import GHCup.Types
|
import GHCup.Types
|
||||||
import GHCup.Types.Optics
|
import GHCup.Types.Optics
|
||||||
|
|
||||||
@@ -41,7 +40,6 @@ import qualified Control.Exception as EX
|
|||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import qualified Data.ByteString.Lazy as BL
|
import qualified Data.ByteString.Lazy as BL
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Text as T
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +149,6 @@ executeOut path args chdir = do
|
|||||||
|
|
||||||
execLogged :: ( MonadReader env m
|
execLogged :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadThrow m)
|
, MonadThrow m)
|
||||||
@@ -163,7 +160,6 @@ execLogged :: ( MonadReader env m
|
|||||||
-> m (Either ProcessError ())
|
-> m (Either ProcessError ())
|
||||||
execLogged exe args chdir lfile env = do
|
execLogged exe args chdir lfile env = do
|
||||||
Dirs {..} <- getDirs
|
Dirs {..} <- getDirs
|
||||||
logDebug $ T.pack $ "Running " <> exe <> " with arguments " <> show args
|
|
||||||
let stdoutLogfile = logsDir </> lfile <> ".stdout.log"
|
let stdoutLogfile = logsDir </> lfile <> ".stdout.log"
|
||||||
stderrLogfile = logsDir </> lfile <> ".stderr.log"
|
stderrLogfile = logsDir </> lfile <> ".stderr.log"
|
||||||
cp <- createProcessWithMingwPath ((proc exe args)
|
cp <- createProcessWithMingwPath ((proc exe args)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import Control.Monad.IO.Class
|
|||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
import Data.List ( nub, intercalate, stripPrefix, isPrefixOf, dropWhileEnd, intersperse )
|
import Data.List ( nub, intercalate, stripPrefix, isPrefixOf, dropWhileEnd )
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.List.NonEmpty ( NonEmpty( (:|) ))
|
import Data.List.NonEmpty ( NonEmpty( (:|) ))
|
||||||
@@ -313,46 +313,18 @@ removeLensFieldLabel str' =
|
|||||||
maybe str' T.unpack . T.stripPrefix (T.pack "_") . T.pack $ str'
|
maybe str' T.unpack . T.stripPrefix (T.pack "_") . T.pack $ str'
|
||||||
|
|
||||||
|
|
||||||
pvpToVersion :: MonadThrow m => PVP -> Text -> m Version
|
pvpToVersion :: MonadThrow m => PVP -> m Version
|
||||||
pvpToVersion pvp_ rest =
|
pvpToVersion =
|
||||||
either (\_ -> throwM $ ParseError "Couldn't convert PVP to Version") pure . version . (<> rest) . prettyPVP $ pvp_
|
either (\_ -> throwM $ ParseError "Couldn't convert PVP to Version") pure . version . prettyPVP
|
||||||
|
|
||||||
-- | Convert a version to a PVP and unparsable rest.
|
versionToPVP :: MonadThrow m => Version -> m PVP
|
||||||
--
|
versionToPVP v = either (\_ -> alternative v) pure . pvp . prettyVer $ v
|
||||||
-- -- prop> \v -> let (Just (pvp', r)) = versionToPVP v in pvpToVersion pvp' r === Just v
|
|
||||||
versionToPVP :: MonadThrow m => Version -> m (PVP, Text)
|
|
||||||
versionToPVP (Version (Just _) _ _ _) = throwM $ ParseError "Unexpected epoch"
|
|
||||||
versionToPVP v = either (\_ -> (, rest v) <$> alternative v) (pure . (, mempty)) . pvp . prettyVer $ v
|
|
||||||
where
|
where
|
||||||
alternative :: MonadThrow m => Version -> m PVP
|
alternative :: MonadThrow m => Version -> m PVP
|
||||||
alternative v' = case NE.takeWhile isDigit (_vChunks v') of
|
alternative v' = case NE.takeWhile isDigit (_vChunks v') of
|
||||||
[] -> throwM $ ParseError "Couldn't convert Version to PVP"
|
[] -> throwM $ ParseError "Couldn't convert Version to PVP"
|
||||||
xs -> pure $ pvpFromList (unsafeDigit <$> xs)
|
xs -> pure $ pvpFromList (unsafeDigit <$> xs)
|
||||||
|
|
||||||
rest :: Version -> Text
|
|
||||||
rest (Version _ cs pr me) =
|
|
||||||
let chunks = NE.dropWhile isDigit cs
|
|
||||||
ver = intersperse (T.pack ".") . chunksAsT $ chunks
|
|
||||||
me' = maybe [] (\m -> [T.pack "+",m]) me
|
|
||||||
pr' = foldable [] (T.pack "-" :) $ intersperse (T.pack ".") (chunksAsT pr)
|
|
||||||
prefix = case (ver, pr', me') of
|
|
||||||
(_:_, _, _) -> T.pack "."
|
|
||||||
_ -> T.pack ""
|
|
||||||
in prefix <> mconcat (ver <> pr' <> me')
|
|
||||||
where
|
|
||||||
chunksAsT :: Functor t => t VChunk -> t Text
|
|
||||||
chunksAsT = fmap (foldMap f)
|
|
||||||
where
|
|
||||||
f :: VUnit -> Text
|
|
||||||
f (Digits i) = T.pack $ show i
|
|
||||||
f (Str s) = s
|
|
||||||
|
|
||||||
foldable :: Foldable f => f b -> (f a -> f b) -> f a -> f b
|
|
||||||
foldable d g f | null f = d
|
|
||||||
| otherwise = g f
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
isDigit :: VChunk -> Bool
|
isDigit :: VChunk -> Bool
|
||||||
isDigit (Digits _ :| []) = True
|
isDigit (Digits _ :| []) = True
|
||||||
isDigit _ = False
|
isDigit _ = False
|
||||||
|
|||||||
@@ -53,9 +53,6 @@ deriving instance Data VUnit
|
|||||||
|
|
||||||
#if !MIN_VERSION_base(4,13,0)
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
deriving instance Lift (NonEmpty Word)
|
deriving instance Lift (NonEmpty Word)
|
||||||
deriving instance Lift (NonEmpty VChunk)
|
|
||||||
deriving instance Lift (NonEmpty MChunk)
|
|
||||||
deriving instance Lift (NonEmpty VUnit)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qq :: (Text -> Q Exp) -> QuasiQuoter
|
qq :: (Text -> Q Exp) -> QuasiQuoter
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
plat="$(uname -s)"
|
plat="$(uname -s)"
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
ghver="0.1.17.3"
|
ghver="0.1.17.2"
|
||||||
base_url="https://downloads.haskell.org/~ghcup"
|
base_url="https://downloads.haskell.org/~ghcup"
|
||||||
|
|
||||||
export GHCUP_SKIP_UPDATE_CHECK=yes
|
export GHCUP_SKIP_UPDATE_CHECK=yes
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ extra-deps:
|
|||||||
- composition-prelude-3.0.0.2@sha256:1ffed216bd28d810fce0b5be83a661e2a892696d73b3f8de5c0f5edb9b5f0090,1216
|
- composition-prelude-3.0.0.2@sha256:1ffed216bd28d810fce0b5be83a661e2a892696d73b3f8de5c0f5edb9b5f0090,1216
|
||||||
- haskus-utils-data-1.4@sha256:bfa94363b94b14779edd6834fbd59dbb847c3d7b8f48e3844f456ffdc077da4a,1466
|
- haskus-utils-data-1.4@sha256:bfa94363b94b14779edd6834fbd59dbb847c3d7b8f48e3844f456ffdc077da4a,1466
|
||||||
- haskus-utils-types-1.5.1@sha256:991c472f4e751e2f0d7aab6ad4220ef151d6160876dcf0511bbf876bbd432020,1298
|
- haskus-utils-types-1.5.1@sha256:991c472f4e751e2f0d7aab6ad4220ef151d6160876dcf0511bbf876bbd432020,1298
|
||||||
|
- haskus-utils-variant-3.1@sha256:e602dd23e068c98d03c1027af20503addef8df6368577622453f44ccabea2a5b,2159
|
||||||
- heaps-0.3.6.1@sha256:7928b759ca5180d35722c45948c0bde264229f3c99c1888188a3d9285f13d3d2,1340
|
- heaps-0.3.6.1@sha256:7928b759ca5180d35722c45948c0bde264229f3c99c1888188a3d9285f13d3d2,1340
|
||||||
- hpath-filepath-0.10.4@sha256:e9e44fb5fdbade7f30b5b5451257dbee15b6ef1aae4060034d73008bb3b5d878,1269
|
- hpath-filepath-0.10.4@sha256:e9e44fb5fdbade7f30b5b5451257dbee15b6ef1aae4060034d73008bb3b5d878,1269
|
||||||
- hpath-posix-0.13.3@sha256:abe472cf16bccd3a8b8814865ed3551a728fde0f3a2baea2acc03023bec6c565,1615
|
- hpath-posix-0.13.3@sha256:abe472cf16bccd3a8b8814865ed3551a728fde0f3a2baea2acc03023bec6c565,1615
|
||||||
@@ -39,11 +40,6 @@ extra-deps:
|
|||||||
- xor-0.0.1.0@sha256:f8362b4a68562b9afbcd727ff64c1a303970df3a032e0033d2f4c094c3501df3,2243
|
- xor-0.0.1.0@sha256:f8362b4a68562b9afbcd727ff64c1a303970df3a032e0033d2f4c094c3501df3,2243
|
||||||
- yaml-streamly-0.12.0
|
- yaml-streamly-0.12.0
|
||||||
|
|
||||||
- git: https://github.com/hasufell/packages.git
|
|
||||||
commit: cc0b4688f8bb374fa92f17c856949de795b56291
|
|
||||||
subdirs:
|
|
||||||
- haskus-utils-variant
|
|
||||||
|
|
||||||
flags:
|
flags:
|
||||||
http-io-streams:
|
http-io-streams:
|
||||||
brotli: false
|
brotli: false
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
module GHCup.Types.JSONSpec where
|
module GHCup.Types.JSONSpec where
|
||||||
|
|
||||||
import GHCup.ArbitraryTypes ()
|
import GHCup.ArbitraryTypes ()
|
||||||
import GHCup.Types hiding ( defaultSettings )
|
import GHCup.Types
|
||||||
import GHCup.Types.JSON ()
|
import GHCup.Types.JSON ()
|
||||||
|
|
||||||
import Test.Aeson.GenericSpecs
|
import Test.Aeson.GenericSpecs
|
||||||
|
|||||||
Reference in New Issue
Block a user