-
Notifications
You must be signed in to change notification settings - Fork 710
Support for managing sandbox packages #1195
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
Comments
I would hope that you would never had to manually touch the sandbox. The idea is that it should be enough to just update your project's .cabal file and, in some cases, the (optional) per-project cabal.config file. To better understand what the right fix is, could you describe in which circumstance you want to unregister a package or list the packages in the sandbox. |
It happens all the time. Before sandboxes, ghc-pkg has been indispensable to me for maintenance of my package repository. Never manually touching the sandbox may sound good in theory, but the real world just doesn't work that nicely. Sometimes multiple versions of a package get installed and sometimes I get linker errors because the wrong version is getting used in the wrong place. I don't want to have to specify constraints from now on, so I unregister the one I don't want. In the absence of fine-grained control over packages, I would resort to blowing away the whole repository, which would be a huge waste of time as I'd often have to rebuild 100+ packages. The case that just happened to me was that I installed my package foo and it retrieved a dependency bar from hackage. Then I discovered that I in fact needed my locally modified version of bar. So I do |
Note that you can still use ghc-pkg on a sandbox directory. It's a valid package DB. Just use the ghc-pkg flag to point ghc-pkg to it. For what it's worth I almost never touch my package DB, except when it has broken due to Cabal dependency hell. I don't understand how you arrive at linker errors. If you don't want to specify constraints you will have a bad time. The compiler needs them to pick the right versions of things. Perhaps that's why you're getting linker errors? That a Hackage package is picked over a |
Hmmmm, then it would be nice if ghc-pkg would just work on the sandbox in the current or most recent parent directory if it exists. I don't manually touch my package DB either unless dependency hell comes along. The problem is that it comes along on a very regular basis. I specify both upper and lower version bounds in my packages religiously. I'm talking about adding manual command-line version constraints. I'll add another ticket for the priority thing, but that won't eliminate the need to manually modify the repository. I can just as easily imagine a scenario where I'd want the reverse behavior. I agree that add-source should have the highest priority, but that's not always the right thing. I opened a new issue for the sub-problem at #1197. |
Hopefully that should happen much less often with sandboxing. The only shared package DB will be the global one and as long as you don't install anything there (you shouldn't) separate project shouldn't be able to stomp on each other (the infamous
You might want to try the new per-project |
Once #1104 is fixed, |
Well, I've been using sandboxing for less than a week and I've already had at least three or four instances where I wanted to unregister packages from my sandbox. I don't think constraints in a per-project config file will solve my problems because I'm often making changes to four or more packages in concert.
|
@mightybyte Then lets figure out why you wanted to unregister packages and make sure that's no longer needed. Building a system where that is common practice is not desirable. |
I agree, but that's a separate (and longstanding) issue (#227). |
Re. installing. We've set a bad precedence by focusing on installing in the past. Installing is the wrong thing to do. Rarely do you need software under development or software you intend to ship somewhere else to be installed on your system. The focus should be on projects. You're working on something and you need to build it (to test it or whatever). cabal build (or cabal test, etc) should do that. What it needs to do in order to do that (build dependencies, etc.) is not important from the user point of view. Having experience a build system that works like this, is used on tens of millins of lines of code, and by thousands of developers I'm sure that it's both possible and desirable. The chance of a system based on installing things working goes towards 0 as the number of packages goes towards BIG_NUMBER. cabal build in a project dir should work as-if you wiped your whole system clean, reinstalled GHC and all your dependencies from scratch. If you can tell, from within a project directory, that there are other projects on the same machine, we still have work to do. |
I'm not sure that I agree with this, but that discussion should probably take place somewhere else.
This would be true, except for the fact that Haskell builds are slow, therefore they need to be cached....i.e. installed. If you have a system for caching builds, then you either need a mechanism for removing things from the cache or you need more granular build disambiguation than the current system gives us. |
Nix-style builds give us the latter. It makes the cache key be dependent on all inputs and thus the cache is always valid and never needs to be manually pruned. |
Right, so since we don't have nix-style builds right now, we need a way to manage the package cache. |
@mightybyte Just use ghc-pkg. |
There is |
If/when we'll have an |
@23Skidoo Ok, that sounds good to me. |
I've been using the sandbox functionality from HEAD, and the lack of list/unregister/etc functionality is a big problem. We need the equivalent of ghc-pkg for managing packages in sandboxes, or at least basic list and unregister functionality. Right now the only solution is to delete the whole sandbox, which is a huge waste of time, or manually hunt down directories to delete and hope that this doesn't leave the sandbox in a broken state.
The text was updated successfully, but these errors were encountered: