snowleopard / hadrian

Hadrian: a new build system for the Glasgow Haskell Compiler. Now merged into the GHC tree!
https://gitlab.haskell.org/ghc/ghc/tree/master/hadrian
MIT License
208 stars 37 forks source link

build.cabal.sh breaks badly if hadrian's dependencies do not successfully install. #463

Closed duog closed 6 years ago

duog commented 6 years ago

running build.cabal.sh with Cabal <2.1 triggers this code path:

    if ! ( "$CABAL" sandbox hc-pkg list > /dev/null 2>&1); then
        "$CABAL" sandbox init
        "$CABAL" sandbox add-source ../libraries/Cabal/Cabal
        "$CABAL" install                \
            --dependencies-only         \
            --disable-library-profiling \
            --disable-shared
    fi

If dependencies do not cleanly install one must manually delete the sandbox to proceed.

snowleopard commented 6 years ago

Thanks @duog! I suppose the right solution is to detect the failure and delete the sandbox?

I'm not familiar with Cabal sandboxes so it will take me some time to dig out the right commands to run. Presumably this is an easy fix, so a PR is very welcome.

chitrak7 commented 6 years ago

@snowleopard @izgzhen deleting .sandbox file and then rerunning build works whenever I get this error. I believe this should be a good fix here. We can simply add command $CABAL sandbox delete method with a check. if [-e cabal.sandbox.config] then cabal sandbox delete

izgzhen commented 6 years ago

related to #524