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

Extend cabal get to be affected by v2- projects #8584

Open
fgaz opened this issue Nov 11, 2022 · 5 comments
Open

Extend cabal get to be affected by v2- projects #8584

fgaz opened this issue Nov 11, 2022 · 5 comments

Comments

@fgaz
Copy link
Member

fgaz commented Nov 11, 2022

So that it can use --index-state from the project file, get source-repository-package packages, possibly get local packages...

My main use case is --index-state, since parsing it out of project files manually is a pain

@fendor
Copy link
Collaborator

fendor commented Nov 11, 2022

Last time something like this was discussed, it was said that this feature makes only very limited about of sense. cabal.project files are usually not uploaded to hackage, you'd have to add them as extra-source files (so if you do that, you can already have the feature you want for packages that do exactly that).

Even if you included cabal.project files by default in sdists, they'd be wrong usually since they are project specific and may contain fields like packages:. So, you'd have to remove this field and its entries before you upload it to hackage, because otherwise cabal get will produce a nonsense package.

The proposed feature sounds more like a complete project clone than something that cabal get is currently designed to do where the unit of work is a package, while you seem to propose that Hackage learns about projects?

@fgaz fgaz changed the title Extend cabal get to v2- projects Extend cabal get to be affected by v2- projects Nov 11, 2022
@fgaz
Copy link
Member Author

fgaz commented Nov 11, 2022

I'm not proposing to make cabal get fetch entire project, I'm proposing to let the current project affect the packages it fetches. This behavior could even be disabled by default unless --project-file is passed.

For example, if cabal.project contains index-state: xyz, calling cabal get foo in that project would still get only the foo package, but as if --index-state=xyz was passed.
Another example, if cabal.project contains source-repository-package [...] location: https://...foo.git, cabal get foo would get foo from that repository.

I edited the title to make this clearer.

@fendor
Copy link
Collaborator

fendor commented Nov 11, 2022

Ah, thank you for your clarification! That makes sense in my opinion!

@michaelpj
Copy link
Collaborator

I think this is especially important if you use additional repositories. I would expect to be able to get packages from those repositories but I can't.

e.g.

  1. Put this in a cabal.project
repository cardano-haskell-packages
  url: https://input-output-hk.github.io/cardano-haskell-packages
  secure: True
  root-keys:
    3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f
    443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1
    a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82
    bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413
    c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
    d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

  1. cabal update
  2. cabal get cardano-crypto-class
Error: cabal: There is no package named 'cardano-crypto-class'.
You may need to run 'cabal update' to get the latest list of available
packages.

@andreabedini
Copy link
Collaborator

I think the same applies to cabal list. Should we open a separate issue for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants