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

Fix index-state syntax in cabal.project #3265

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

andreabedini
Copy link
Contributor

@andreabedini andreabedini commented Jan 19, 2023

The index-state stanza in cabal.project is "last wins", so

index-state: 2022-12-24T00:00:00Z
index-state: cardano-haskell-packages 2022-11-02T15:34:17Z

would set the index state of hackage to HEAD.

The correct syntax to set the index-state of both repositories is

index-state:
  , hackage.haskell.org 2022-12-24T00:00:00Z
  , cardano-haskell-packages 2022-11-02T15:34:17Z

haskell.nix has trouble parsing the index-state syntax with multiple repositories, so we repeat the index-state for Hackage. Cabal will ignore the first index-state stanza anyway.

Description

Add your description here, if it fixes a particular issue please provide a
link
to the issue.

Checklist

  • Commit sequence broadly makes sense
  • Commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Any changes are noted in the changelog
  • Code is formatted with fourmolu (which can be run with scripts/fourmolize.sh
  • Self-reviewed the diff

@lehins
Copy link
Collaborator

lehins commented Jan 19, 2023

Cabal will ignore the first index-state stanza anyway.

Are you sure about this? I definitely did not observe this behavior: "would set the index state of hackage to HEAD."

I can say for sure because this repo would have problems building for a month if hackage was at HEAD. It was deliberately set to:

index-state: 2022-12-24T00:00:00Z

because starting with 26th of December our tooling was broken due to incorrect bounds on Hackage starting with this index:

index-state: 2022-12-26T00:00:00Z

It was only recently fixed, but my point still stands, if hackage was set to HEAD I would expect it to be broken.
Could you also please link to some issues on cabal or haskell.nix repos, so we know exactly why we have to do this duplicate work, and more importantly when we can stop doing.

cabal.project Show resolved Hide resolved
@andreabedini
Copy link
Contributor Author

andreabedini commented Jan 19, 2023

Are you sure about this? I definitely did not observe this behavior: "would set the index state of hackage to HEAD."

100% sure, the cabal issue reference is haskell/cabal#8568. Also the prompt to fix the all the repos I can find is because it broke cardano-node today (link).

Note that if you use nix, you are always safe because haskell.nix can parse the index-state: 2022-12-24T00:00:00Z line and give you an appropriate hackage tarball. So what cabal thinks is irrelevant in that case.

index-state stanza in cabal.project is "last wins", so 
```
index-state: 2022-12-24T00:00:00Z
index-state: cardano-haskell-packages 2022-11-02T15:34:17Z
``` would set the index state of hackage to HEAD.
The correct syntax to set the index-state of both repositories is
```
index-state:
  , hackage.haskell.org 2022-12-24T00:00:00Z
  , cardano-haskell-packages 2022-11-02T15:34:17Z
```
haskell.nix has trouble parsing the index-state syntax with multiple repositories, so we repeat the index-state for Hackage. Cabal will ignore the first index-state stanza anyway.
@JaredCorduan JaredCorduan merged commit 597d40e into IntersectMBO:master Jan 24, 2023
@andreabedini andreabedini deleted the patch-1 branch January 24, 2023 08:21
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

Successfully merging this pull request may close these issues.

3 participants