begriffs / haskell-vim-now

One-line Haskell Vim install
MIT License
989 stars 101 forks source link

Use default resolver to solve for and install helper bins #276

Closed harendra-kumar closed 6 years ago

harendra-kumar commented 6 years ago

Fixes #270

There is no significant advantage of choosing a resolver. However, there are significant disadvantages:

1) The cabal-install version installed using default resolver may mismatch with the chosen resolver and therefore stack solver itself may fail. See issue #270.

2) A different resolver may take more space and pollute the users' .stack with more snapshots.

Therefore we solve using the user's resolver and use the same to install.

I added a few "XXX" in the code where it can be improved.

This works well with lts-9.13, however as I suggested in one of the fixup comments in the code for best results we should solve for each helper bin independently so that we do not have conflicting deps and therefore avoid the failure of solver.

begriffs commented 6 years ago

I tried running this installer on a fresh Debian 9.3 virtual server and had trouble.

# using the modified installer script that I created in another pull request
./hvn --branch solver --repo https://github.com/harendra-kumar/haskell-vim-now.git

--> Existing Haskell-Vim-Now installation detected at /home/j/.config/haskell-vim-now.
--- Syncing Haskell-Vim-Now with upstream...
Current branch solver is up to date.
--- Installing system packages [libcurl4-openssl-dev] using [APT]...
--- Installing with apt-get...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Skipping libcurl4-openssl-dev, it is already installed and upgrade is not set.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
--- Checking ctags' exuberance...
--- Setting git to use fully-pathed vim for messages...
--- Backing up current vim config using timestamp 20180127_003017...
    /home/j/.config/haskell-vim-now/backup/.vim.20180127_003017
    /home/j/.config/haskell-vim-now/backup/.vimrc.20180127_003017
--- Creating vim config symlinks
    ~/.vimrc -> /home/j/.config/haskell-vim-now/.vimrc
    ~/.vim   -> /home/j/.config/haskell-vim-now/.vim
--- Installing plugins using vim-plug...
Downloaded lts-8.14 build plan.
Downloaded ghc-nopie-8.0.2.
Installed GHC.
Update complete
Populated index cache.
[1 of 2] Compiling Main             ( /home/j/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /home/j/.stack/setup-exe-src/setup-mPHDZzAJ.o )
[2 of 2] Compiling StackSetupShim   ( /home/j/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /home/j/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
Linking /home/j/.stack/setup-exe-cache/x86_64-linux-nopie/tmp-Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 ...
Completed 49 action(s).
HvnArgs {hvnArgsNoHoogleDb = False, hvnArgsNoHelperBinaries = False}
Setting up GHC if needed...
Downloaded lts-10.3 build plan.
Downloaded ghc-nopie-8.2.2.
Installed GHC.
    Stack bin path: /home/j/.local/bin
    Stack global path: /home/j/.stack
    Stack global config location: /home/j/.stack/global-project/stack.yaml
    Stack resolver: lts-10.3
    /home/j/.config/haskell-vim-now/.stack-bin -> /home/j/.local/bin
Installing helper binaries...
    stack --resolver lts-10.3 install ghc-mod --install-ghc --verbosity warning
Plan construction failed.
"stack --resolver lts-10.3 install ghc-mod --install-ghc --verbosity warning" failed with error 1
*** setup_haskell.hs failed with error 1.
*** Aborting...

As a test I'm triggering a CI rebuild without the cache, to see if we get the same result when old build artifacts are gone.

jship commented 6 years ago

Looks like this error is coming from trying to install ghc-mod with LTS-10.3's GHC 8.2.2 version: https://github.com/begriffs/haskell-vim-now/issues/282

LTS-9.13 has GHC 8.0.2., which has been compatible with ghc-mod for a while to my knowledge. LTS-10.3 has GHC 8.2.2 which ghcmod has experimental support for.

jship commented 6 years ago

Based on discussion over in #282, going ahead and merging this. This should unblock @bidhan-a, who has some changes to prevent us from bailing out on a failed ghc-mod install.

Thanks, @harendra-kumar!