-
Notifications
You must be signed in to change notification settings - Fork 701
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 new-install --only-dependencies --enable-tests
doesn't work
#5650
Comments
It'll depend precisely what you want to do.
|
I want the former. My usage pattern for GHC is probably highly unusual, in that I rarely work on discrete projects (other than GHC, which doesn't really use cabal). Instead, I'm usually compiling project-less Because my situation is unusual, I'm OK with needing to specify a lesser-used flag or twiddle some settings, but I'd be sad if I can't do what I like anymore. In general, I'm always a bit saddened by the general trend in Haskell tooling (both |
Maybe the new script feature of |
Interesting. I like the idea of specifying, right in my code, what its dependencies are. I might indeed use this. I still see two shortcomings:
Again, I know I'm an unusual consumer here... but I don't think I'm so unusual as to be unique, and so it seems there should be some way to do this. |
You can have a |
I could also have a In any case, you proposed in your first response a way forward: just allow the command in the title. |
Installing without the tests + installing the test deps manually should work though |
Of course it would.... but I'd prefer that |
I often find myself in similar "tinkering" scenarios as @goldfirere. For those scenarios, I often use Unfortunately, I don't yet have a convenient alias for what |
`new-build --only-dependencies` will install deps in store, or am I missing something?
…Sent from my iPhone
On 12 Feb 2019, at 14.17, Ryan Scott ***@***.***> wrote:
I often find myself in similar "tinkering" scenarios as @goldfirere. For those scenarios, I often use ghci -package-db ~/.cabal/store/ghc-<ver>/package.db (where <ver> might be, say, 8.6.3) to fire up a repl with the latest versions of every package I've installed via new-build, new-install, new-repl -b, etc. Then, if I want to make more packages available in my package.db, it's just a matter of running the right new-* command.
Unfortunately, I don't yet have a convenient alias for what cabal install --enable-tests --only-dependencies used to accomplish. The most direct workaround I can think of is cabal get <package-name> && cd package-name-x.y.z && cabal new-build --only-dependencies --enable-tests, which is rather indirect. It would be good to make new-install --only-dependencies --enable-tests do the right thing.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Correct. The thing that's missing is the ability to do this for any package that lives on Hackage by just specifying the name of the package. (Note that |
I'm confused. Does One could make a wrapper of
but that fixes the version of Maybe someone else could figure out the sane Cli UI for this, but I think trying to cater for an exceptional (as Richard mentions himself) use case. I want to point out that working with The above works ok-ish (not really: #5888)
|
Can @goldfirere confirm you try to run
(note: I think that @RyanGlScott's follow-up is asking for something different (and IMHO difficult). Note that
is free to pick any version of |
It works in the sense that it installs the test dependencies, yes. Note that I don't really care if there are different build plans for the library and the test suite—I just want to make sure that there is some build plan installed so that I'm then free to tinker afterwards. (I suspect @goldfirere is in the same boat here.)
I agree that using a package database directly like this isn't the best state of affairs, but there's not really a better alternative. Package environments didn't appear to work beyond trivial examples when I last tried it (I'm not sure if #5888 is the direct reason for this, but it looks related). I'm just offering what works well for me at the moment. It's also worth noting that this |
|
Here is what I observe with the latest released
When I use |
The packages are installed also in ~/.cabal/store/... database as Ryan pointed out above. `cabal v2-build` doesn't touch and won't touch global database, that's the point of `v2-build`.
…Sent from my iPhone
On 12 Feb 2019, at 17.31, Richard Eisenberg ***@***.***> wrote:
Here is what I observe with the latest released cabal, in a project directory:
rae:10:25:40 ~/work/packages/singletons> cabal new-install --only-dependencies --enable-test --enable-bench
cabal: --enable-tests was specified, but tests can't be enabled in a remote
package
When I use new-build instead of new-install, something happens, but not what I want: cabal has installed all the necessary dependencies locally, in the package-local package database. I want these packages in my global package database, so that they are available when I try to compile a non-cabalized source file, independent of any project.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Right -- I know that Right now, I can say |
Note that `new-install` doesn't touch global database either. `new-install --lib` works by maintaining a package environment, so it appears that packages are in global database.
So yes, `v2-build` is less powerful, as it doesn't allow any modifications to global database. I argue you don't want that ever (except maybe for ghc-dev where you might tear the whole compiler version after a week, so you don't have time to run into Cabal Hell).
…Sent from my iPhone
On 12 Feb 2019, at 17.39, Richard Eisenberg ***@***.***> wrote:
Right -- I know that new-build doesn't touch the global database. That's why I want new-install to work in this scenario. I was following your suggestion in #5650 (comment), to see if maybe I misunderstood new-build.
Right now, I can say cabal install --only-dependencies --enable-tests to get cabal to globally install the dependencies of a package, including that package's tests. It seems that behavior is impossible to replicate with the new- commands. My understanding is that the new style is meant to be strictly more powerful than the old style, but it seems that this is not the case in this one use-case.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I suspect there are sub-issues which e.g. `v2-repl` (instead of raw ghci) could solve if we take a step back and think properly what we are trying to do, X, instead of concentrating on "operational" problem Y = "we need to populate specific package database". Similarly, writing a `*.cabal` file to accompany single `.hs` is not much asked, IMHO; especially with new improvements in the format, `.cabal` can be very terse; yet explicit about a lot of things, incl. dependencies.
…Sent from my iPhone
On 12 Feb 2019, at 17.49, Oleg Grenrus ***@***.***> wrote:
Note that `new-install` doesn't touch global database either. `new-install --lib` works by maintaining a package environment, so it appears that packages are in global database.
So yes, `v2-build` is less powerful, as it doesn't allow any modifications to global database. I argue you don't want that ever (except maybe for ghc-dev where you might tear the whole compiler version after a week, so you don't have time to run into Cabal Hell).
Sent from my iPhone
> On 12 Feb 2019, at 17.39, Richard Eisenberg ***@***.***> wrote:
>
> Right -- I know that new-build doesn't touch the global database. That's why I want new-install to work in this scenario. I was following your suggestion in #5650 (comment), to see if maybe I misunderstood new-build.
>
> Right now, I can say cabal install --only-dependencies --enable-tests to get cabal to globally install the dependencies of a package, including that package's tests. It seems that behavior is impossible to replicate with the new- commands. My understanding is that the new style is meant to be strictly more powerful than the old style, but it seems that this is not the case in this one use-case.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub, or mute the thread.
|
I agree about the focus on the "operational" problem. So I'll describe my use-case: I frequently have a scrap of code that I wish to interact with. This happens both as I'm poking around with GHC, and when I'm teaching. (So my being a GHC dev isn't the only reason I want this.) I want to have a set of libraries available so that when I compile that scrap of code, it can import what it needs. When I teach, I organize my course into separate lectures, with the example code in a folder corresponding to the lecture. There is no I recognize that these are not common scenarios, but I also can't imagine I'm the only one who wants to compile Haskell files without writing a project. The |
@goldfirere #6481 may be what you want! You could try the |
I've been using |
@goldfirere if you're happy about If you're unhappy that passing some v1- flags isn't... hmm... got flagged, then it's also a known issue. I don't know if we have a reference ticket for that. Perhaps, we should have, but in that case we need a new one, because it affects much more combinations of v2-command/v1-flag than |
I suppose you could close this. It's still an ongoing shame that a simple task -- installing a library globally -- has become so fraught. It was so easy 10 years ago! And, if anything, it's become even more necessary, with HLS, which sometimes can't find or load my .cabal files (and then a globally installed library would work). |
I agree. But as noted above, there's plenty of tickets about that, and the reference one is #6481. If we create more tickets about the same thing, we just end up with a scattered discussion where it's easy to miss an important detail. |
Thanks for discussing this. Let move further discussion to #6481 and elsewhere. Closing. |
The title says it all. If I want to install the dependencies of a project (but not the project itself), including the dependencies of its testsuite, how do I do that in the brave new world?
The text was updated successfully, but these errors were encountered: