This commit is contained in:
Julian Ospald 2021-06-15 14:00:30 +02:00
parent 7189998f3b
commit 0ad5dc4583
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
6 changed files with 72 additions and 50 deletions

View File

@ -7,7 +7,7 @@ variables:
GIT_SSL_NO_VERIFY: "1" GIT_SSL_NO_VERIFY: "1"
# 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: 1ac7f435c9312f10422a82d304194778378e2a1a DOCKER_REV: 8d0224e6b2a08157649651e69302380b2bd24e11
############################################################ ############################################################
# CI Step # CI Step
@ -149,17 +149,19 @@ variables:
script: | script: |
set -Eeuo pipefail set -Eeuo pipefail
function runInNixShell() { function runInNixShell() {
time nix-shell .gitlab/shell.nix \ time nix-shell $CI_PROJECT_DIR/.gitlab/shell.nix \
-I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \ -I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \
--argstr system "aarch64-darwin" \ --argstr system "aarch64-darwin" \
--pure \ --pure \
--keep GHC_VERSION --keep CABAL_INSTALL_VERSION --keep BUILD_FLAVOUR \ --keep CI_PROJECT_DIR \
--keep BIN_DIST_PREP_TAR_COMP --keep CPUS --keep PROJECT_DIR \ --keep MACOSX_DEPLOYMENT_TARGET \
--keep CI_PROJECT_DIR --keep MAKE_ARGS --keep HADRIAN_ARGS --keep CABAL_CACHE \ --keep JSON_VERSION \
--keep LANG --keep CONFIGURE_ARGS --keep TEST_ENV --keep BIN_DIST_NAME \ --keep ARTIFACT \
--keep MACOSX_DEPLOYMENT_TARGET --keep ac_cv_func_clock_gettime --keep HACKAGE_INDEX_STATE \ --keep OS \
--keep CABAL_DIR --keep ARCH --keep OS --keep CABAL_VERSION --keep GHC_VERSION \ --keep ARCH \
--keep JSON_VERSION --ARTIFACT \ --keep CABAL_DIR \
--keep GHC_VERSION \
--keep CABAL_VERSION \
--run "$1" 2>&1 --run "$1" 2>&1
} }
runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1 runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1
@ -405,13 +407,9 @@ release:darwin:aarch64:
-I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \ -I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \
--argstr system "aarch64-darwin" \ --argstr system "aarch64-darwin" \
--pure \ --pure \
--keep GHC_VERSION --keep CABAL_INSTALL_VERSION --keep BUILD_FLAVOUR \
--keep BIN_DIST_PREP_TAR_COMP --keep CPUS --keep PROJECT_DIR \
--keep CI_PROJECT_DIR --keep MAKE_ARGS --keep HADRIAN_ARGS --keep CABAL_CACHE \ --keep CI_PROJECT_DIR --keep MAKE_ARGS --keep HADRIAN_ARGS --keep CABAL_CACHE \
--keep LANG --keep CONFIGURE_ARGS --keep TEST_ENV --keep BIN_DIST_NAME \ --keep MACOSX_DEPLOYMENT_TARGET \
--keep MACOSX_DEPLOYMENT_TARGET --keep ac_cv_func_clock_gettime --keep HACKAGE_INDEX_STATE \ --keep JSON_VERSION --keep ARTIFACT \
--keep CABAL_DIR --keep ARCH --keep OS --keep CABAL_VERSION --keep GHC_VERSION \
--keep JSON_VERSION --ARTIFACT \
--run "$1" 2>&1 --run "$1" 2>&1
} }
runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1 runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1

View File

@ -19,4 +19,14 @@ fi
./ghcup-bin set ${GHC_VERSION} ./ghcup-bin set ${GHC_VERSION}
./ghcup-bin install-cabal ${CABAL_VERSION} ./ghcup-bin install-cabal ${CABAL_VERSION}
if [ $ARCH = 'ARM64' ] ; then
cabal update
mkdir vendored
cd vendored
cabal unpack network-3.1.2.1
cd network*
autoreconf -fi
cd ../..
fi
exit 0 exit 0

View File

@ -104,35 +104,39 @@ if [ "${OS}" != "WINDOWS" ] ; then
fi fi
# test installing new ghc doesn't mess with currently set GHC if [ "${OS}" = "DARWIN" ] && [ "${ARCH}" = "ARM64" ] ; then
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7 echo
if [ "${OS}" = "LINUX" ] ; then else
eghcup --downloader=wget install 8.10.3 # test installing new ghc doesn't mess with currently set GHC
else # test wget a bit # https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
eghcup install 8.10.3 if [ "${OS}" = "LINUX" ] ; then
fi eghcup --downloader=wget install 8.10.3
[ "$(ghc --numeric-version)" = "${ghc_ver}" ] else # test wget a bit
eghcup set 8.10.3 eghcup install 8.10.3
eghcup set 8.10.3 fi
[ "$(ghc --numeric-version)" = "8.10.3" ] [ "$(ghc --numeric-version)" = "${ghc_ver}" ]
eghcup set ${GHC_VERSION} eghcup set 8.10.3
[ "$(ghc --numeric-version)" = "${ghc_ver}" ] eghcup set 8.10.3
eghcup rm 8.10.3 [ "$(ghc --numeric-version)" = "8.10.3" ]
[ "$(ghc --numeric-version)" = "${ghc_ver}" ] eghcup set ${GHC_VERSION}
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
eghcup rm 8.10.3
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
if [ "${OS}" = "DARWIN" ] ; then if [ "${OS}" = "DARWIN" ] ; then
eghcup install hls
haskell-language-server-wrapper --version
eghcup install stack
stack --version
elif [ "${OS}" = "LINUX" ] ; then
if [ "${ARCH}" = "64" ] ; then
eghcup install hls eghcup install hls
haskell-language-server-wrapper --version haskell-language-server-wrapper --version
eghcup install stack eghcup install stack
stack --version stack --version
elif [ "${OS}" = "LINUX" ] ; then
if [ "${ARCH}" = "64" ] ; then
eghcup install hls
haskell-language-server-wrapper --version
eghcup install stack
stack --version
fi
fi fi
fi fi
@ -150,3 +154,11 @@ fi
eghcup upgrade eghcup upgrade
eghcup upgrade -f eghcup upgrade -f
# nuke
eghcup nuke
if [ "${OS}" = "WINDOWS" ] ; then
[ ! -e "${GHCUP_INSTALL_BASE_PREFIX}/ghcup" ]
else
[ ! -e "${GHCUP_INSTALL_BASE_PREFIX}/.ghcup" ]
fi

View File

@ -44,9 +44,6 @@
# unconditionally add the MacOSX.sdk and TargetConditional.h # unconditionally add the MacOSX.sdk and TargetConditional.h
export NIX_CFLAGS_COMPILE+=" -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" export NIX_CFLAGS_COMPILE+=" -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
# Use an architecture specific home, so cabal for different architectures don't confuse each other.
export HOME="$HOME/$(uname -m)-home"
mkdir -p $HOME
''; '';
nativeBuildInputs = (with pkgs; [ nativeBuildInputs = (with pkgs; [
@ -81,6 +78,7 @@
which which
wget wget
curl
file file
xz xz

View File

@ -1,5 +1,7 @@
packages: ./ghcup.cabal packages: ./ghcup.cabal
optional-packages: ./vendored/*/*.cabal
optimization: 2 optimization: 2
package ghcup package ghcup

View File

@ -42,6 +42,7 @@ import GHCup.Version
import Codec.Archive ( ArchiveResult ) import Codec.Archive ( ArchiveResult )
#endif #endif
import Control.Applicative import Control.Applicative
import Control.Exception ( evaluate )
import Control.Exception.Safe import Control.Exception.Safe
import Control.Monad import Control.Monad
#if !MIN_VERSION_base(4,13,0) #if !MIN_VERSION_base(4,13,0)
@ -1295,7 +1296,7 @@ rmGhcup = do
let ghcupFilename = "ghcup" <> exeExt let ghcupFilename = "ghcup" <> exeExt
let ghcupFilepath = binDir </> ghcupFilename let ghcupFilepath = binDir </> ghcupFilename
currentRunningExecPath <- liftIO $ getExecutablePath currentRunningExecPath <- liftIO getExecutablePath
-- if paths do no exist, warn user, and continue to compare them, as is, -- if paths do no exist, warn user, and continue to compare them, as is,
-- which should eventually fail and result in a non-standard install warning -- which should eventually fail and result in a non-standard install warning
@ -1310,8 +1311,7 @@ rmGhcup = do
let areEqualPaths = equalFilePath p1 p2 let areEqualPaths = equalFilePath p1 p2
when (not areEqualPaths) $ do unless areEqualPaths $ $logWarn $ nonStandardInstallLocationMsg currentRunningExecPath
$logWarn $ nonStandardInstallLocationMsg currentRunningExecPath
#if defined(IS_WINDOWS) #if defined(IS_WINDOWS)
-- since it doesn't seem possible to delete a running exec in windows -- since it doesn't seem possible to delete a running exec in windows
@ -1400,16 +1400,18 @@ rmGhcupDirs = do
$logInfo "removing Ghcup Config File" $logInfo "removing Ghcup Config File"
hideError doesNotExistErrorType $ liftIO $ deleteFile confFilePath hideError doesNotExistErrorType $ liftIO $ deleteFile confFilePath
rmDir :: (MonadLogger m, MonadIO m) => FilePath -> m () rmDir :: (MonadLogger m, MonadIO m, MonadCatch m) => FilePath -> m ()
rmDir dir = do rmDir dir = do
$logInfo [i|removing #{dir}|] $logInfo [i|removing #{dir}|]
contents <- liftIO $ getDirectoryContentsRecursive dir contents <- hideErrorDef [doesNotExistErrorType] []
$ liftIO
(getDirectoryContentsRecursive dir >>= evaluate)
forM_ contents (liftIO . deleteFile . (dir </>)) forM_ contents (liftIO . deleteFile . (dir </>))
rmBinDir :: (MonadCatch m, MonadIO m) => FilePath -> m () rmBinDir :: (MonadCatch m, MonadIO m) => FilePath -> m ()
rmBinDir binDir = do rmBinDir binDir = do
#if !defined(IS_WINDOWS) #if !defined(IS_WINDOWS)
isXDGStyle <- liftIO $ useXDG isXDGStyle <- liftIO useXDG
if not isXDGStyle if not isXDGStyle
then removeDirIfEmptyOrIsSymlink binDir then removeDirIfEmptyOrIsSymlink binDir
else pure () else pure ()
@ -1421,7 +1423,7 @@ rmGhcupDirs = do
reportRemainingFiles dir = do reportRemainingFiles dir = do
remainingFiles <- liftIO $ getDirectoryContentsRecursive dir remainingFiles <- liftIO $ getDirectoryContentsRecursive dir
let normalizedFilePaths = fmap normalise remainingFiles let normalizedFilePaths = fmap normalise remainingFiles
let sortedByDepthRemainingFiles = reverse $ sortBy compareFn normalizedFilePaths let sortedByDepthRemainingFiles = sortBy (flip compareFn) normalizedFilePaths
let remainingFilesAbsolute = fmap (dir </>) sortedByDepthRemainingFiles let remainingFilesAbsolute = fmap (dir </>) sortedByDepthRemainingFiles
pure remainingFilesAbsolute pure remainingFilesAbsolute
@ -1803,14 +1805,14 @@ upgradeGHCup :: ( MonadMask m
] ]
m m
Version Version
upgradeGHCup mtarget force = do upgradeGHCup mtarget force' = do
AppState { dirs = Dirs {..} AppState { dirs = Dirs {..}
, pfreq , pfreq
, ghcupInfo = GHCupInfo { _ghcupDownloads = dls } , ghcupInfo = GHCupInfo { _ghcupDownloads = dls }
, settings } <- lift ask , settings } <- lift ask
lift $ $(logInfo) [i|Upgrading GHCup...|] lift $ $(logInfo) [i|Upgrading GHCup...|]
let latestVer = fromJust $ fst <$> getLatest dls GHCup let latestVer = fromJust $ fst <$> getLatest dls GHCup
when (not force && (latestVer <= pvpToVersion ghcUpVer)) $ throwE NoUpdate when (not force' && (latestVer <= pvpToVersion ghcUpVer)) $ throwE NoUpdate
dli <- lE $ getDownloadInfo GHCup latestVer pfreq dls dli <- lE $ getDownloadInfo GHCup latestVer pfreq dls
tmp <- lift withGHCupTmpDir tmp <- lift withGHCupTmpDir
let fn = "ghcup" <> exeExt let fn = "ghcup" <> exeExt