-
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
Cannot run a script using cabal run
which depends on a local package with cabal-install 3.8
#8562
Comments
cabal run
which depends on a local packagecabal run
which depends on a local package with cabal-install 3.8
I suspect that the regression is likely due to refactors induced by #7851 |
Yes, let’s page in @bacchanalia. |
I'll try to take a look at it next week. |
I also have this problem. I tried adding a |
@bacchanalia if you don't have time to take a look, would you be able to orient me so I can see what's going on? I.e. which Cabal module is responsible for determining if local packages are in-scope? Unfortunately, all commits from #7851 were squashed, so I can't use git-bisect to pinpoint where exactly is the regression |
@LaurentRDC: the commits seem preserved in the PR, so presumably also on the bacchanalia:master branch. Is it any help? |
I understand the desire to get back the feature that suddenly disappeared. But when I think about it in isolation of cabal history, it feels to me that scripts are meant to be self contained, and I consider them using a cabal.project a bug rather than a feature. Scripts support (a part of) cabal.project fields inside themselves not for nothing: for me, it's a clear indication that you're not supposed to have an external cabal.project. Overall, this ticket sounds to me like a feature request to extend (back) abilities of scripts beyond what they are meant to be. It's a fine request, of course, but if not for the history, I'd probably prefer this ability to be controlled by a flag, which, by default, would ignore nearby project files. But then, there's "if not for the history bit", so perhaps it should be the other way around. Another thought: if you really need a setup sophisticated enough to reach beyond basic project file capabilities supported in the script header, then you might as well bite the bullet and turn your code into a proper package. Sometimes, people dislike creating .cabal files, but with |
I agree with @ulysses4ever. You could add a cabal.project to your project, with something like |
In this case, I think it would be useful to specify specific versions/revisions of script dependencies (i.e., versions not available on Hackage but only on Gitlab or GitHub, or somewhere else). Is this possible in a cabal script? |
Thank you @fgaz , that's a great suggestion which works well. I'm satisfied. |
@dschrempf see #8024. |
So, is resolution here: won't fix because doesn't align with the idea of scripts? It may still be a reasonable feature request... |
This hasn't worked since Cabal 3.6: haskell/cabal#8562.
We still have to run the build script with GHC 9.4, since we need to override `dhall`, and can't override `source-repository-package` for scripts (haskell/cabal#8562, haskell/cabal#8024 (comment)).
Description
Let's say I have a project with an executable and a library. The repository looks like:
I'd like to run the following script with
cabal v2-run
:The command
cabal run scripts/MyScript.hs
with cabal-install 3.6.2.0 works as expected. However, with cabal=install 3.8.1.0 I get an error like this:Error: cabal: Could not resolve dependencies: [__0] trying: fake-package-0 (user goal) [__1] unknown package: my-lib (dependency of fake-package) [__1] fail (backjumping, conflict set: fake-package, my-lib) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: fake-package, my-lib
To reproduce
I have set up a repository to show this behavior:
Expected behavior
I'm expecting to be able to compile and run
scripts/MyScript.hs
System information
cabal-install
version 3.8.1.0ghc
9.4.2The text was updated successfully, but these errors were encountered: