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

Bad error message No hackage.haskell.org repository for legacy remote-repo entry in the cabal configuration #70

Open
andreasabel opened this issue Jan 4, 2021 · 3 comments

Comments

@andreasabel
Copy link
Member

It would be good if the help texts contained some example uses.
I fail to discover how to invoke cabal-plan to get my license report.

This is what I tried:

$ cabal install -f license-report cabal-plan
...

$ cabal-plan --version
cabal-plan 0.7.2.0

$ cabal-plan license-report --help
Usage: cabal-plan license-report [--licensedir DIR] PATTERN
  Generate license report for a component

Available options:
  --licensedir DIR         Write per-package license documents to folder
  PATTERN                  Pattern to match.
  -h,--help                Show this help text

$ cabal-plan license-report Agda:exe:agda
cabal-plan: user error (No hackage.haskell.org repository)

$ ping hackage.haskell.org
PING ...: 56 data bytes
64 bytes from ... icmp_seq=0 ttl=60 time=15.678 ms

In particular, I do not understand the error No hackage.haskell.org repository and how to address it.

@andreasabel
Copy link
Member Author

andreasabel commented Jan 4, 2021

After some research, looking at the source code of cabal-plan(passing the safety pig ;-)), I could fix the problem by replacing in my .cabal/config

remote-repo: hackage.haskell.org:http://hackage.haskell.org/packages/archive

with

repository hackage.haskell.org
  url: http://hackage.haskell.org/

However, according to https://cabal.readthedocs.io/en/latest/installing-packages.html#legacy-repositories this is just expanding a synonym:

  remote-repo: hackage.haskell.org:http://hackage.haskell.org/packages/archive

This is just syntactic sugar for

  repository hackage.haskell.org
    url: http://hackage.haskell.org/packages/archive

although, in (and only in) the specific case of Hackage, the URL http://hackage.haskell.org/packages/archive will be silently translated to http://hackage.haskell.org/.

@nomeata
Copy link

nomeata commented Jan 25, 2021

JFTR: I just ran into this as well

@andreasabel andreasabel changed the title Can't discover how to use license-report Bad error message No hackage.haskell.org repository for legacy remote-repo entry in the cabal configuration Nov 13, 2021
@sellout
Copy link

sellout commented Apr 28, 2024

I just ran into this, and wanted to make the workaround/fix more explicit in case anyone else still has an ancient .cabal/config around.

Basically, the remote-repo field in Cabal config files is “legacy” (read: obsolete and not well supported). To fix it, rewrite any

remote-repo: {{repository}}:{{url}}

to

repository {{repository}}
  url: {{url}}

Since providing a better error message here would basically entail parsing remote-repo anyway, it seems like it’s no harder to just support the legacy syntax. I.e., I feel like this issue should be closed, and instead, it would be nice if Cabal itself warned on legacy syntax.

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

No branches or pull requests

3 participants