Skip to content
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

"Error: cabal: There is no <pkgname>.cabal package file or cabal.project file." in directory with .cabal file #9353

Open
juhp opened this issue Oct 19, 2023 · 2 comments
Labels
re: project-file Concerning cabal.project files re: user experience User experience (UX) issue type: enhancement

Comments

@juhp
Copy link
Collaborator

juhp commented Oct 19, 2023

Describe the bug
cabal build gives a very confusing error message in a (unknown) package subdirectory under a cabal.project.

To Reproduce

  1. have a project with cabal.project
  2. in a tmp/ subdir unpack a cabal package
  3. try to build said package:
Error: cabal: There is no <pkgname>.cabal package file or cabal.project file.
To build packages locally you need at minimum a <pkgname>.cabal file. You can
use 'cabal init' to create one.

but there is a .cabal file right there!

Expected behavior
Package in unrelated subdir to build normally.
Also complaining there is no .cabal file is rather confusing.

System information

  • Operating system: Fedora Linux
  • cabal-3.8+, ghc-9.4

Additional context
Currently used by hkgr to do pristine sanity builds from tarball before publishing to Hackage.

Related discussion: #8519

@juhp
Copy link
Collaborator Author

juhp commented Oct 19, 2023

I would like to propose a better behaviour: to ignore cabal.project once it is established that the immediate .cabal file is not part of that project.

@gbaz
Copy link
Collaborator

gbaz commented Oct 19, 2023

I like this proposal -- I've run into this issue before, and I can't think of a case where this would be problematic. It might be worth printing a notification when this situation arises however, just to avoid potential confusion.

juhp added a commit to juhp/hkgr that referenced this issue Oct 20, 2023
…ject

This prevents cabal build from getting confused and giving up with:
"Error: cabal: There is no <pkgname>.cabal package file or cabal.project file."

see haskell/cabal#9353
@ulysses4ever ulysses4ever added type: enhancement re: user experience User experience (UX) issue re: project-file Concerning cabal.project files and removed type: bug needs triage labels Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re: project-file Concerning cabal.project files re: user experience User experience (UX) issue type: enhancement
Projects
None yet
Development

No branches or pull requests

3 participants