-
Notifications
You must be signed in to change notification settings - Fork 846
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
Extra package database support #990
Extra package database support #990
Conversation
Thanks for the PR. Just to make sure I'm not missing any background, is there an issue where this idea was discussed? I have some misgivings about the feature, because it breaks one of the fundamental purposes of |
@borsboom Check out this email thread: https://groups.google.com/d/msg/haskell-stack/bCzgxqcbKKA/D5DuMSCTFwAJ The idea here is that we're not making the situation any worse than we already have it from allowing packages in the global database, but we additionally gain the advantage of allowing easy sharing of binary package databases between systems. |
When running this on my system, I see the following package databases:
At the very least, the order of these databases is incorrect; the snapshot database ended up in the middle of the lib1 and lib2 databases, and the local database does not appear anywhere in that list. It should be ordered:
|
I think in the above case the script is building lib2 which means that On Wed, Sep 16, 2015, 05:45 Michael Snoyman notifications@github.com
|
So there are 3 stack runs, and I think the correct package-db order for each is:
|
The problem is that you're reinstalling global packages - which are depended on by the Cabal library - in the local database. This means that (at least for GHC 7.8, which your example is using) the local version shadows the global version, and the dependencies of Cabal are unavailable. Concretely, I'm seeing on my system that Cabal depends on bytestring-0.10.4.0-d6f1d17d717e8652498cab8269a0acd5, but bytestring-0.10.4.0-9a9bbd95e0709e7cafd40d5934840c75 is in the local database. |
I saw that too but wasn't sure it's the real problem. I'm a but confused here. Why does the |
Different GHC installations may place different packages in the global It seems like this PR is attempting to do more than we originally On Thu, Sep 17, 2015, 12:13 PM Daniel Vigovszky notifications@github.com
|
I did not want to make it implicit, that's why added a separate option for it ( If you think it's too complicated and/or against the way stack should work, I can remove the |
I wasn't aware that To be honest though, I'm still not convinced that this is the best way to achieve your goal of cached binary builds, but I have no objection to having the multiple package database support in stack. |
I tried out what I described above, and it works. vigoo/stack-sandbox-chain-test@667cb75 |
cf585b6
to
1311564
Compare
1311564
to
ecc89f8
Compare
I rebased this again; is there anything else I can do to make this merged? |
I'm OK with this, I think it'll probably come in handy even though I still think the example use case is a bad idea. @snoyberg, can you make the final determination and merge if you agree? |
wc <- getWhichCompiler | ||
(lhs1, dps) <- ghcPkgDump menv wc (fmap snd mdb) | ||
$ conduitDumpPackage =$ sink | ||
(lhs1, dps) <- ghcPkgDump menv wc (extraDBs ++ (fmap snd (maybeToList mdb))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be necessary to pass in the extraDBs I think, the packages in those databases should be inherited automatically from the passed in lhs0
. Do things break without them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't pass the extra databases to ghc-pkg
it will report the packages depending on any of them in the actual database as broken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stack itself does the dependencies check and ignores ghc-pkg's opinion on the matter. You can see that we currently do the databases one at a time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm checking what happens if I'm not passing them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work without it, I'll test a bit more and clean it up soon
Mostly looks OK, I added some inline comments. |
Commented issues fixed |
Extra package database support
Thanks! |
This pull-request adds support for creating and using reusable extra package database with stack.
This test repository demonstrates how it would work:
stack build
inlib1
builds the library into the local package database and nothing elsestack build
inlib2
builds its dependencies (ansi-wl-pprint
and everything it needs) andlib2
itself to its local package database.stack build
inapp
builds the executable using bothlib1
andlib2
from the previously built package databases.The change adds two new options to the stack yaml:
extra-package-dbs
is a list of relative or absolute paths to extra package databases, which will be added on top of the global package database, before snapshot and localforce-install-local
we still use the snapshots to determine the package versions to be installed, but they are not installed to the shared snapshot package database but always to the current local package database. This is required to make the built package databases redistributable.NOTE Currently this does not work. But it worked before I rebased it, so I'm opening the PR to get some help in fixing it before we can merge. To reproduce the issue, build this branch, and run the test script from the above linked repository, giving it the built stack executable as its parameter.