Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System-wide Stackage Install #67

Closed
creichert opened this issue Dec 20, 2014 · 18 comments
Closed

System-wide Stackage Install #67

creichert opened this issue Dec 20, 2014 · 18 comments

Comments

@creichert
Copy link

While there is plenty of documentation for setting up stackage in a cabal project, I don't think it's completely clear how to setup a system-wide stackage install.

For example:

I have a fresh install of ghc and cabal, now I want to install yesod-bin and start a new project. However, I want to install yesod-bin from a stackage snapshot.

Currently, most of the instructions are for existing cabal projects or sandbox directories.

My suggestion was to change the remote-repo in the ~/.cabal/config to match the cabal.config distributed on the quick start guide.

This guide suggest copying into cabal project:
http://www.stackage.org/

This Stackage FAQ does suggest changing the remote-repo but not in the ~/.cabal/config file:
https://github.com/fpco/stackage/wiki/Stackage-Server-FAQ

I could be confused myself on the system-wide instructions as I primarily sandbox projects. Could this use some clarification? (I can make these updates)

@creichert
Copy link
Author

The quickstart guide also suggests installing the cabal.config into the directory you are in and cabal updating there. I understand that there are a few ways to do this but it could be confusing for newcomers: http://www.yesodweb.com/page/quickstart

(I just worked through this with someone in IRC).

@snoyberg
Copy link
Contributor

Let me describe the situation fully, and then let's figure out how to update documentation. (And help on that front will be very much appreciated, thank you.)

We can state the goal of "Stackage installation" as "make sure that cabal-install only installs acceptable versions of packages." There are two methods of doing that currently:

  1. Pointing to a different remote-repo from Hackage that only includes the approved package versions.
  2. Providing a (long) list of constraints to cabal-install so that it only includes those versions.

There are slightly differences between these two approaches (exclusive vs inclusive, whether to allow locally modified packages), but that's not terribly important right now. There are also two locations where these instructions can be given:

  1. The global cabal config file (~/.cabal/config)
  2. In the current directory's cabal.config file.

There's a bug with all but the most recent cabal-install versions where it ignores remote-repo statements in the local cabal.config file. That has now been resolved, but most people are still using older cabal-installs.

Either approach (remote-repo or constraints) can be used with either config file location (global or local). The default instructions tell you to use constraints + local cabal.config. However, for a global installation, it's as simple as copying the constraints into the ~/.cabal/config file. Or, you can modify the remote-repo in ~/.cabal/config as well.

I hope that clarifies things a bit.

@creichert
Copy link
Author

Either approach (remote-repo or constraints) can be used with either config file location (global or local).

If that is the case than I like how the documentation is currently stated.

I suppose I was confused because if I append the contents of the cabal.config here: http://www.stackage.org/lts/cabal.config to my ~/.cabal/config, then there is a warning when upating.

$ cabal update
Warning: /home/christopher/.cabal/config: Unrecognized field constraints on
line 176
Downloading the latest package list from hackage.haskell.org
Skipping download: Local and remote files match.

This might have been what originally led me to believe that the remote-repo was necessary in ~/.cabal/config.

I do like the current way of using cabal.config to specify the version constraints by default, though.

@snoyberg
Copy link
Contributor

Actually that message has me a bit worried, maybe I'm wrong and the global
file doesn't support constraints. That requires some investigation.

On Sat, Dec 20, 2014, 7:43 PM Christopher Reichert notifications@github.com
wrote:

Either approach (remote-repo or constraints) can be used with either
config file location (global or local).

If that is the case than I like how the documentation is currently stated.

I suppose I was confused because if I append the contents of the
cabal.config here: http://www.stackage.org/lts/cabal.config to my
~/.cabal/config, then there is a warning when upating.

$ cabal update
Warning: /home/christopher/.cabal/config: Unrecognized field constraints on
line 176
Downloading the latest package list from hackage.haskell.org
Skipping download: Local and remote files match.

This might have been what originally led me to believe that the
remote-repo was necessary in ~/.cabal/config.

I do like the current way of using cabal.config to specify the version
constraints by default, though.


Reply to this email directly or view it on GitHub
#67 (comment).

@creichert
Copy link
Author

I think this is the issue: https://github.com/haskell/cabal/blob/64761550bb617ee5d9449512bd3e500489cfd491/cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs#L408

The ~/.cabal/config only supports individual version constraints (e.g. prepend every one with constraint:).

https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Setup.hs#L528
https://github.com/haskell/cabal/blob/ea8735aafc301b3726a3c959130cb20441b38461/cabal-install/Distribution/Client/Config.hs#L595

I just tested with constraint: appended to every constraint and it seems to be working correctly.

@snoyberg
Copy link
Contributor

Wow, thanks for digging into that. We should provably raise this question on the cafe to see if this is a generally known issue.

So if the cabal.config file used a separate constraint on each line, would it work for both global and local config files.

@creichert
Copy link
Author

I didn't quite have time to send a mail out today but I'd be happy to send it tomorrow morning, if you haven't already.

It looks to me like separate constraints are supported in both configs but there could definitely be caveats or issues.

It shouldn't be too hard to patch cabal to support constraints globally but we can cross that road after getting some feedback.

@snoyberg
Copy link
Contributor

I haven't sent off the email yet, if you could do so it would be much appreciated.

@creichert
Copy link
Author

@snoyberg
Copy link
Contributor

Thanks! Look forward to seeing some responses.

snoyberg added a commit that referenced this issue Dec 23, 2014
@snoyberg
Copy link
Contributor

I've added a global config file link to the snapshot pages, which I think does this correctly. Can you give it a shot?

@creichert
Copy link
Author

That works great. I'll be testing it a bit more today since there are also the new base target versions (e.g. array ==installed). Looks good so far, though.

@snoyberg
Copy link
Contributor

It seems like this is working. I'm going to close the issue, and let's reopen (or start a new one) if issues arise. Thanks for bringing this up @creichert!

@garry-cairns
Copy link

Don't know if this is related but I'm having terrible trouble trying to set up stackage and yesod inside a Docker container.

I've tried the Dockerfile linked to in that question and also a more basic one using the hvr ppa. In the latter case using the global cabal config results in cabal complaining about an unrecognised field constraint on every line and finishing with the cryptic (to me) cabal: fromFlag NoFlag. Use fromFlagOrDefault.

@creichert
Copy link
Author

@garry-cairns I commented on: yesodweb/yesod#960

The global cabal config (http://www.stackage.org/snapshot/nightly-2014-12-22/cabal.config?global=true) only works at ~/.cabal/config.

There could be a discrepancy in the install instructions but try sticking as close to the install instructions as possible and pasting your output so we can help.

@psibi
Copy link
Member

psibi commented Apr 20, 2015

@snoyberg I feel the current quick-start section is confusing in stackage.org. Currently it states that:

"Download the following file, place it next to your cabal config file "

Now it's not clear which config file ? Is it system-wide ~/.cabal/config or the cabal file related to a package. In fact this comment of yours explains them properly. I think that message should be clearly conveyed in the home page.

snoyberg added a commit to commercialhaskell/stackage-content that referenced this issue Apr 20, 2015
@snoyberg
Copy link
Contributor

Good catch, do you think this clears it up? commercialhaskell/stackage-content@a5e6b04

@psibi
Copy link
Member

psibi commented Apr 20, 2015

Thanks, that's perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants