Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions packcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2540,14 +2540,20 @@ setup_environment() {
# XXX add paths only if not already on PATH, but sometimes we have to add path
# at head for precedence even if it is already on PATH.
#echo "Original PATH is [$PATH]..."
PATH_PREFIX=$LOCAL_BIN:$GHCUP_BIN

# XXX We should not add anything to PATH, respect the user's PATH. For example,
# we may be running in a nix shell which has overridden ghc, and adding
# ghcup/bin to the front of PATH will change the ghc and all the packages
# that were available.
#
PATH_SUFFIX=$LOCAL_BIN:$GHCUP_BIN
if test "$BUILD" = "cabal-v2"
then
PATH_PREFIX=$PATH_PREFIX:$OS_APP_HOME/$OS_CABAL_DIR/bin
PATH_SUFFIX=$PATH_PREFIX:$OS_APP_HOME/$OS_CABAL_DIR/bin
fi

echo "Prefixing [$PATH_PREFIX] to PATH"
export PATH=$PATH_PREFIX:$PATH
echo "Suffixing [$PATH_SUFFIX] to PATH"
export PATH=$PATH:$PATH_SUFFIX
echo

# XXX we should be able to set multiple paths in it
Expand All @@ -2560,10 +2566,6 @@ setup_environment() {
# TOOLS_DIR="$GHCUP_PATH"
#fi

# if we are running from a stack environment remove GHC_PACKAGE_PATH so that
# cabal does not complain
# XXX this should be done from outside via env
unset GHC_PACKAGE_PATH
# stack does not work well with empty STACK_YAML env var
test -n "$STACK_YAML" || unset STACK_YAML

Expand Down Expand Up @@ -2612,6 +2614,14 @@ case $BUILD in
*) ;;
esac

# if we are running from a stack environment remove GHC_PACKAGE_PATH so that
# cabal does not complain.
# XXX this should be done from outside via env
# NOTE: do this before eval_env, so that it can later be set by eval_env if
# passed on command line.
echo "WARNING! unsetting GHC_PACKAGE_PATH if you really want to use it pass it on the command line"
unset GHC_PACKAGE_PATH

# This allows only SYSTEM_ENVVARS to be set on the command line
eval_env "$@"
# After eval_env the PATH changes
Expand Down
Loading