Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • changelog.d/hadrian-warn-missing-package-index-16484
    1
    +section: packaging
    
    2
    +synopsis: Hadrian now warns when the Hackage package index is missing instead of
    
    3
    +  failing with an unhelpful error message.
    
    4
    +issues: #16484
    
    5
    +mrs: !15878

  • hadrian/build-cabal
    ... ... @@ -23,14 +23,19 @@ fi
    23 23
     CABVERSTR=$("$CABAL" --numeric-version)
    
    24 24
     CABVER=( ${CABVERSTR//./ } )
    
    25 25
     
    
    26
    -if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ];
    
    27
    -then
    
    28
    -    "$CABAL" --project-file="$PROJ" new-build "${CABFLAGS[@]}" -j exe:hadrian
    
    29
    -    # use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
    
    30
    -    "$CABAL" --project-file="$PROJ" new-exec  "${CABFLAGS[@]}"    hadrian -- \
    
    31
    -        --directory "$PWD" \
    
    32
    -        "$@"
    
    33
    -else
    
    26
    +if [ "${CABVER[0]}" -lt 3 ]; then
    
    34 27
         echo "Cabal version is too old; you need at least cabal-install 3.0"
    
    35 28
         exit 2
    
    36 29
     fi
    
    30
    +
    
    31
    +REMOTE_REPO_CACHE=$("$CABAL" --with-compiler="$GHC" path --output-format=key-value 2>/dev/null | awk '/^remote-repo-cache:/ { print $2 }')
    
    32
    +if ! [ -d "$REMOTE_REPO_CACHE/hackage.haskell.org" ]; then
    
    33
    +    echo "Please run 'cabal update' first"
    
    34
    +    exit 2
    
    35
    +fi
    
    36
    +
    
    37
    +"$CABAL" --project-file="$PROJ" new-build "${CABFLAGS[@]}" -j exe:hadrian
    
    38
    +# use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
    
    39
    +"$CABAL" --project-file="$PROJ" new-exec  "${CABFLAGS[@]}"    hadrian -- \
    
    40
    +    --directory "$PWD" \
    
    41
    +    "$@"

  • hadrian/build-cabal.bat
    ... ... @@ -34,18 +34,20 @@ for /F "delims=. tokens=1,2,3,4" %%a in ("%CABVERSTR%") do (
    34 34
         set CABPATCH=%%d
    
    35 35
     )
    
    36 36
     
    
    37
    -set "_cabal_ok=0"
    
    38
    -if %CABMAJOR% gtr 2 set _cabal_ok=1
    
    39
    -if %CABMAJOR% equ 2 (
    
    40
    -    if %CABMINOR% geq 2 set _cabal_ok=1
    
    41
    -)
    
    42
    -if %_cabal_ok% equ 1 (
    
    43
    -    "%CABAL%" --project-file=%PROJ% new-build %CABFLAGS% -j exe:hadrian
    
    44
    -    rem use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
    
    45
    -    "%CABAL%" --project-file=%PROJ% new-exec  %CABFLAGS%    hadrian -- ^
    
    46
    -        --directory "%CD%" ^
    
    47
    -        %*
    
    48
    -) else (
    
    49
    -    echo Cabal version is too old; you need at least cabal-install 2.2
    
    37
    +if %CABMAJOR% lss 3 (
    
    38
    +    echo Cabal version is too old; you need at least cabal-install 3.0
    
    50 39
         exit /B 2
    
    51 40
     )
    
    41
    +
    
    42
    +for /F "tokens=*" %%a in ('"%CABAL%" --with-compiler=%GHC% path --output-format=key-value 2^>NUL ^| findstr /B "remote-repo-cache:"') do set REMOTE_REPO_CACHE=%%a
    
    43
    +set REMOTE_REPO_CACHE=%REMOTE_REPO_CACHE:remote-repo-cache: =%
    
    44
    +if not exist "%REMOTE_REPO_CACHE%\hackage.haskell.org" (
    
    45
    +    echo Please run 'cabal update' first
    
    46
    +    exit /B 2
    
    47
    +)
    
    48
    +
    
    49
    +"%CABAL%" --project-file=%PROJ% new-build %CABFLAGS% -j exe:hadrian
    
    50
    +rem use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
    
    51
    +"%CABAL%" --project-file=%PROJ% new-exec  %CABFLAGS%    hadrian -- ^
    
    52
    +    --directory "%CD%" ^
    
    53
    +    %*