-
-
Notifications
You must be signed in to change notification settings - Fork 154
Don't use hpack when cabal file is in the directory #508
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
Conversation
I'm not in favor of this and also suggest either hpack should be disabled by the user in such cases or the updated cabal file checked in. If the |
What's you're reasoning for this? It seems to me like this is in general an improvement. |
If a newer hpack version was used for generating the cabal file, this implies that newer features not supported by our hpack version may have been used. Therefore this is a serious warning in my opinion, indicating that we may generate an incorrect cabal file. |
My guess is that this is not a big problem in practice. I think we have these three different cases to deal with:
I think case 1 is by far what is mostly likely to happen, so using |
I think forcing the user to check in a downgraded hpack file sounds like a weird solution. I think what we actually want is this.
But well, that’s not easy to achieve. I am not sure what bullet to bite here. But I actually think the probability of having a user loose 2h in figuring this out or just giving up is higher than the probability of us quietly compiling in a wrong way. |
Another option is to just not run Looks like the default option is to use |
Yeah, that sounds like the most sensible way forward. The logic is a bit more complicated though since the cabal file's name changes with the package name (can there even be multiple ones in a single directory?). |
I've updated the PR to not run |
I've tested that this works as advertised. If no @maralorn @sternenseemann any objection to merging this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
Since this changes user facing behavior I think this should probably have a changelog entry, because it could theoretically break projects with out-dated checked-in cabal files. But apparently this project has no changelog. So whatever, I guess?^^
My plan was to release a bunch of non-breaking changes and fixes as a minor release (Milestone #1), we'd be able to backport. If we still want to do that, we should push this PR into Milestone #2 and hold off on merging for now — unless we want to maintain two branches in this repository I think the minor release would be great because it would be backport-able and includes a fix to the annoying |
hpack will only be used if no appropriate cabal file is found in the source. This now means that cabal2nix will see the cabal file as the single source of truth and prevent the previous problem that hpack would fail when building if the checked-in cabal file was generated with a different hpack version than is in nixpkgs / used by the builder.
Rebased on master and squashed the commits. Would be fine with merging later! |
So far these only consists of #508.
So far these only consists of NixOS#508.
Just my 2c: while I think this is ultimately a good change I think it should have been marked as breaking in the changelog. Previously the workings of
from the generated derivation and then those derivations break in an environment where .cabal files are not present (eg. CI). |
Yeah, because of the severity of the change it is the first item in the changelog. FWIW the stuff marked as “API breaking change” is mostly not that severe a change, but requires adjustments from downstream users. I note them explicitly when creating the changelog because it is important to keep track of API changes for figuring out the new PVP-compliant version number. But it's a good point, I'll try making a section “Changes the average user needs to care about” for the next release. |
@sternenseemann first of all thank you for your amazing work on all of haskell-nix! My comment above is mostly for anyone else stumbling on this issue. Nevertheless I think flagging these as you say in the changelog would be good, if possible. |
Closes #507
This PR makes
hpack
force generation of acabal
file.hpack
will bail out early if the version ofhpack
used to generate an existingcabal
file is newer than itself. This results in a package that can't be built.