-
Notifications
You must be signed in to change notification settings - Fork 17
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
Cabal package version macros #65
Comments
This issue is ready to be worked on. |
Re package databases:
Edit: actually, to make it easier to test, etc., I will implicitly add the user package db if the explicit list of package databases is Nothing. Edit2: in the newest version of the code the UserPackageDB i controlled explicitly at session init, but the default again includes UserPackageDB. |
I'm not sure about the global package database, I think instead you should not assume that you're adding it, or at least provide an option for that. We may need to generate dummy global databases to implement a separate feature. If we need to change the package databases, we can always kill the session configs and start them up again, so (3) seems like a fair assumption. @jwiegley Do you agree? |
To be sure we use the same terminology, the global database is the one containing rts, ghc-prim, base. Below is a snippet from http://www.haskell.org/ghc/docs/7.2.2/html/users_guide/packages.html
|
Yes, that's what I'm referring to. We want to ensure that there is only ever one copy of a package in scope, so in some cases (e.g., user installs a new copy of binary), we would want to modify the global database. An individual user clearly shouldn't be allowed to do that, so what we might do is create a new database including all packages from the global database and then remove (e.g.) binary. |
OK, great, so if you give me a |
Cabal raises "unexpected package db stack" when there's no special case of the default GlobalPackageDB among the package db stack. So we need to patch cabal to allow stacks without the default GlobalPackageDB. The patch should be trivial, just disabling the check (unless @dcoutts points out this should be done differently). The refactoring of ide-backend to allow 2 different cabals is already approved on our list, so we'll start it soon. Edit.: specifying DBs to use is ready (including the API) and we are ready to fork cabal and remove the check for GlobalPackageDB. |
@snoyberg I agree to the question asked above. |
There is a problem with package dbs: in 7.4.2 http://www.haskell.org/ghc/docs/7.4.2/html/users_guide/packages.html#package-databases as opposed to 7.6 http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/packages.html#package-databases we cannot disable (or substitute) the global database (it's reflected in the API and that's not a problem of exposing some names). We'd need to backport the new functionality to 7.4.2, which unfortunately invalidates the estimates for this part (DBs) of the feature. I'm pinging @dcoutts in hopes he proves me wrong. Edit: |
It appears it's impossible to build exes with Cabal, using the required macros, without patching Cabal. The reason is Cabal overwrites the macros file with it's own as a first step of building and the subsequent steps are are not exposed in the API. So, at least in the fist prototype, exes will be built with Cabal using a smaller macros file (referring to just the real dependencies) than what the GHC API uses during the compilation (all packages in the dbs, because at this point (without the macros) the dependencies are not yet known.). That should only break freak code that refers to macros of packages that it does not use (the code will compile via GHC API, but not via cabal buildExe). Edit: a possible solution (not to be attempted right now and not without confirmation): |
I've just noticed the macros can't be generated for package DBs that contain multiple versions of the same package (we get multiple macro definitions). So I will be choosing the newest version and I assume that's OK (e.g., the package DBs we receive only have one version of each package). |
It is safe to assume one package version. We may allow users to override that assumption, but will warn that they must do so at their own risk. |
This feature is ready for integration and testing (all internal ide-backend tests pass (some are on experimental, the basic ones on master)). |
Original issue: https://github.com/fpco/fpco/issues/1167
Two changes:
The text was updated successfully, but these errors were encountered: