From 01e64c5325eb556455c942845257e5a601263b61 Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Sun, 28 Jul 2024 13:05:17 -0400 Subject: [PATCH] stack is removed from the hlint steps --- hlint-from-scratch-cabal-build-test.sh | 30 ++-- hlint-from-scratch.sh | 201 +++---------------------- 2 files changed, 26 insertions(+), 205 deletions(-) diff --git a/hlint-from-scratch-cabal-build-test.sh b/hlint-from-scratch-cabal-build-test.sh index 1f3101f..a35c978 100755 --- a/hlint-from-scratch-cabal-build-test.sh +++ b/hlint-from-scratch-cabal-build-test.sh @@ -24,7 +24,7 @@ opts: " usage="usage: $prog ARGS" -ghc_version="$(ghc --version | sed -e 's/The Glorious Glasgow Haskell Compilation System, version //g' -e 's/^/ghc-/g')" +ghc_version="ghc-$(echo -n "$(ghc --numeric-version)")" version_tag="" ghc_lib_dir="" ghc_lib_parser_ex_dir="" @@ -89,14 +89,6 @@ if [ -d "$HOME/$ghc_version" ]; then export PATH fi -# Make sure cabal-install is up-to-date with the most recent -# available. At this time there aren't build plans for compilers > -# ghc-9.2.4. -# (PATH=$HOME/ghc-9.2.4/bin:$PATH; export PATH && \ -# cabal update && \ -# cabal new-install cabal-install --overwrite-policy=always \ -# ) - echo "cabal-install: $(which cabal)" echo "cabal-install version: $(cabal -V)" echo "ghc: $(which ghc)" @@ -163,7 +155,6 @@ fi # (reference https://cabal.readthedocs.io/en/3.8/index.html) constraints="constraints: $extra_constraints hlint +ghc-lib, ghc-lib-parser-ex -auto -no-ghc-lib, ghc-lib $threaded_rts, ghc-lib-parser $threaded_rts" -cat > cabal.project< cabal.project< "$build_dir_for_this_ghc"/ghc-lib-test-mini-hlint "cabal -v0 new-run exe:ghc-lib-test-mini-hlint --project-file $cabal_project -- " - echo -n > "$build_dir_for_this_ghc"/ghc-lib-test-mini-compile "cabal -v0 new-run exe:ghc-lib-test-mini-compile --project-file $cabal_project -- " - (cd "ghc-lib-test-mini-hlint-$version_tag" && eval 'cabal' 'new-test' '--test-show-details' 'direct' '--project-file' "$cabal_project" '--test-options="--test-command ../ghc-lib-test-mini-hlint"') - (cd "ghc-lib-test-mini-compile-$version_tag" && eval 'cabal' 'new-test' '--test-show-details' 'direct' '--project-file' "$cabal_project" '--test-options="--test-command ../ghc-lib-test-mini-compile"') -fi -(cd "ghc-lib-parser-ex-$version_tag" && eval 'cabal' 'new-test' '--test-show-details' 'direct' '--project-file' "$cabal_project") -(cd "hlint-$version_tag" && eval "cabal new-run exe:hlint" "--project-file" "$cabal_project" "--" "--test") +cabal_project="$build_dir_for_this_ghc"/cabal.project +echo -n > "$build_dir_for_this_ghc"/ghc-lib-test-mini-hlint "cabal run exe:ghc-lib-test-mini-hlint --project-dir .. -- " +echo -n > "$build_dir_for_this_ghc"/ghc-lib-test-mini-compile "cabal run exe:ghc-lib-test-mini-compile --project-dir .. -- " +(cd ghc-lib-test-mini-hlint-"$version_tag" && eval 'cabal' 'test' '--project-dir' '..' '--test-show-details' 'direct' '--test-options="--color always --test-command ../ghc-lib-test-mini-hlint"') +(cd ghc-lib-test-mini-compile-"$version_tag" && eval 'cabal' 'test' '--project-dir' '..' '--test-show-details' 'direct' '--test-options="--color always --test-command ../ghc-lib-test-mini-compile"') +(cd ghc-lib-parser-ex-"$version_tag" && eval 'cabal' 'test' '--project-dir' '..' '--test-show-details' 'direct' '--test-options="--color always"') +(cd hlint-"$version_tag" && eval 'cabal' 'run' 'exe:hlint' '--project-dir' '..' '--' '--test') exit 0 diff --git a/hlint-from-scratch.sh b/hlint-from-scratch.sh index 0c6dbd8..093c01c 100755 --- a/hlint-from-scratch.sh +++ b/hlint-from-scratch.sh @@ -30,12 +30,6 @@ args=" --repo-dir=ARG A directory of git clones. Defaults to $HOME/project. - --stack-yaml=ARG - Stack configuration file. - - --resolver=ARG - Stack resolver. - --matrix-build Invoke matrix build behaviors. @@ -64,11 +58,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) GHC_FLAVOR="" no_builds="" no_cabal="" -cabal_with_ghc="$(ghc --version | sed -e 's/The Glorious Glasgow Haskell Compilation System, version //g' -e 's/^/ghc-/g')" -stack_yaml="" -stack_yaml_flag="" -resolver="" -resolver_flag="" +cabal_with_ghc="$(echo -n "ghc-$(ghc --numeric-version)")" repo_dir="$HOME/project" with_haddock_flag="--with-hadock" no_threaded_rts=false @@ -89,12 +79,6 @@ while [ $# -gt 0 ]; do exit 0 elif [[ "$1" =~ --repo-dir=([^[:space:]]+) ]]; then repo_dir="${BASH_REMATCH[1]}" - elif [[ "$1" =~ --stack-yaml=([^[:space:]]+) ]]; then - stack_yaml="${BASH_REMATCH[1]}" - stack_yaml_flag="--stack-yaml $stack_yaml" - elif [[ "$1" =~ --resolver=([^[:space:]]+) ]]; then - resolver="${BASH_REMATCH[1]}" - resolver_flag="--resolver $resolver" elif [[ "$1" =~ --cabal-with-ghc=([^[:space:]]+) ]]; then cabal_with_ghc="${BASH_REMATCH[1]}" elif [ "$1" = "--no-checkout" ]; then @@ -134,10 +118,6 @@ set -u echo "uname: $(uname)" echo "ghc-flavor: $GHC_FLAVOR" -echo "stack-yaml: $stack_yaml" -echo "stack-yaml flag: $stack_yaml_flag" -echo "resolver: $resolver" -echo "resolver flag: $resolver_flag" echo "repo-dir: $repo_dir" echo "no-builds: $no_builds" echo "no-cabal: $no_cabal" @@ -147,22 +127,10 @@ echo "no-threaded-rts: $no_threaded_rts" echo "no-threaded-rts-flag: $no_threaded_rts_flag" echo "threaded-rts: \"$threaded_rts\"" -packages="--package extra --package optparse-applicative" -runhaskell="stack runhaskell $packages" DOLLAR="$" locals="locals" everything="everything" -# If there's a new release, let's have it. -if true; then - # cd "$repo_dir/stack" - # git fetch origin && git merge origin/master - # stack install - : -else - stack upgrade # Upgrade to the latest official -fi - cd "$repo_dir"/ghc-lib git checkout ghc-next @@ -175,9 +143,7 @@ fi if ! [[ -d ./ghc ]]; then echo "There is no ghc checkout here to update." - echo "Building with ghc-flavor 'ghc-master' to get started." - eval "$runhaskell $stack_yaml_flag $resolver_flag CI.hs -- $stack_yaml_flag $resolver_flag --ghc-flavor ghc-master" - echo "Now restarting build at the latest GHC commit." + exit 1 fi # It's common for the git fetch step to report errors of the form @@ -223,18 +189,6 @@ else version="$flavor"".""$(date -u +'%Y%m%d')" fi -# Set these both to false for quick iteration. Set false/true for -# matrix builds. -if false; then - rm -rf ~/.stack/programs/x86_64-osx/"$resolver" - : -fi -if $matrix_build; then - set +e - rm -rf ~/.stack/snapshots/x86_64-osx/ - set -e -fi - # ghc-lib cmd="cabal run exe:ghc-lib-build-tool -- $no_checkout_flag $no_builds --ghc-flavor " @@ -256,18 +210,9 @@ if [ -z "$GHC_FLAVOR" ]; then grep "current = .*" "$repo_dir"/ghc-lib/CI.hs fi -ghc_lib_parser_sha256="" -if [[ $(uname) == 'Darwin' ]]; then - sha_ghc_lib_parser="$(shasum -a 256 "$repo_dir"/ghc-lib/ghc-lib-parser-"$version".tar.gz | awk '{ print $1 }')" - ghc_lib_parser_sha256="sha256: \"${sha_ghc_lib_parser}\"" -fi - # ghc-lib-parser-ex cd "$repo_dir"/ghc-lib-parser-ex && git checkout . -if [ -z "$ghc_lib_parser_sha256" ]; then - rm -f *.yaml.lock -fi branch=$(git rev-parse --abbrev-ref HEAD) @@ -295,92 +240,19 @@ else fi fi -# If a resolver hasn't been set, set it now to this. -[[ -z "$resolver" ]] && resolver=nightly-2022-08-04 # ghc-9.2.4 - -# Record the ghc-version (e.g. 9.8.1). Since this is the first time -# calling stack it will pause for a while to setup here. -build_comp_version="$(stack $stack_yaml_flag $resolver_flag --silent exec -- ghc --version | sed 's/The Glorious Glasgow Haskell Compilation System, version //g')" - -# This an elaborate step to create a config file'stack-head.yaml'. -# -# If a stack-yaml argument was provided, seed its contents from it -# otherwise, assume a curated $resolver and create it from scratch. - -# Enable 'allow-newer' if using ghc-9.10.1. -allow_newer="" -if [[ "$build_comp_version" == 9.10.* ]]; then - allow_newer="allow-newer: True" -fi - -# windows hack: repo_dir_stripped is the path with ^/[a-z]/ removed -# e.g. /c/users/... -> /users/... -repo_dir_stripped=$(echo "${repo_dir}" | sed -e "s;^/./;/;g") - cat > cabal.project< stack-head.yaml -# else -# cat > stack-head.yaml <= ghc-master - resolver=lts-22.19 # ghc-9.6.4 (and it must provide os-string) -else - resolver=lts-21.6 # ghc-9.4.5 -fi - -# Currently in sync with 'hlint/stack.yaml'. - -cat > stack-head.yaml < cabal.project<