-
Notifications
You must be signed in to change notification settings - Fork 697
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
Cabal should perhaps reexport all the modules from Cabal-syntax to reduce breakage #7974
Comments
@patrickdoc, @gbaz, @fgaz, what do you think? |
Hrm. I recall there's one general issue that discourages module reexports: If package A re-exports package B, then the api surface of package B becomes part of the surface of package A. So to stick to the PVP, each version of package A should in pin the dependency on package B to within a single minor revision range. This can be a bit of a pain. In our case, it may be ok, given that we control everything. I don't recall any other things we may need to worry about offhand, but also I am not sure... |
I'm 👎 on this. One of the reasons to separate Cabal-syntax was to decouple the two release processes. We could only reexport those module in the next version as a transitory period, but that would only delay the breakage, wouldn't it? |
I imagine most people who are depending on |
There's more discussion about this starting from #7620 (comment) |
For reference, here's a significant part of the original motivation: #7559, In particular, it seems re-exporting all of Cabal in Cabal-syntax would be a deal breaker, but I'm not sure about the reverse. However, another part of the motivation, not mentioned there [edit: @fgaz just linked to it], is permitting people to bundle their own versions of Cabal-syntax that parse their .xml or .tex .cabal file mutations. Could we perhaps work towards a small and general enough API that it fits any wild experiments with .cabal files formats and so can be included in Cabal without stifling progress? Or is exposing the implementation of datatypes required? @mpickering: in your particular use case(s), which parts of Cabal-syntax would you find convenient to be exported in Cabal? |
My particular concern is unnecessary downstream breakage but if the cost of this change has been evaluated and the breakage is deemed acceptable then I don't have a further opinion. |
Any other comments? @fendor? @andreasabel? I hope users of Cabal the library are going to try the master branch and will let us know if the migration can/should be made easier. |
Maybe we should send a message in the mailing list alerting of this change? We should also do proper release candidates this time. |
Looking at hackage reverse deps, we can see that almost 700 packages depend on Cabal. Admittedly, almost 200 have an outdated dependency, but that's still potentially 500 packages that break now. For comparison, ghc has 250 reverse deps on Hackage. The comparison is not fair at all, since every package can bump their dependencies individually, and does not have to wait for its dependencies to update as well, etc... But my point being, that a lot of packages break. I think we have the following goals:
Since the changes are mostly mechanical, maybe we can introduce a migration tool for cabal files (called from now on I think we can tick most of the boxes from above in the following way:
Unfortunately, all of this is a fair amount of work (exactprinter, |
I strongly suspect that most packages that build with the That said, @mpickering, I can't determine from the output of what you linked which packages fail and for what reason. I suspect that |
Also the fix is trivial: just add Cabal-syntax to the dependencies. A dummy Cabal-syntax was released so there's no need for conditionals (please correct me if I'm wrong @patrickdoc) |
For end users, yeah, you should be able to just add Cabal-syntax. For packages that want to support many versions of Cabal, you can use the conditionals recommended here: https://hackage.haskell.org/package/Cabal-syntax |
My experience is that you can't just add a My latest attempt at patches is here and I need to debug why these are failing. |
Huh, I thought we made it so those kind of conflicts are excluded |
Cross-package dependencies are a little hard to express, and I don't think it's possible as a consumer of a library to express: If all of your dependencies that require Cabal have applied the conditional linked above, then you can safely request only Cabal-syntax. If any of your dependencies that require Cabal have not applied the conditionals, then your options are:
In short, based on my understanding of how resolution works, you can't use Cabal-syntax until all of your dependencies that care have added support for it. Edit: That came off a little more "final" than intended. The conclusion is that you can't end up with a solved dependency tree that includes Cabal-syntax until all of your dependencies that use Cabal have handled the split. Which is sort of understandable as that would be the result of any breaking change I think. |
hmmm and what about adding |
oh, i forgot you cant add new dependencies via revisions :-/ EDIT: It would not help packages with a exact bound (f.e. Cabal == 2.4), i hope they will not be many |
The regex |
hmm i see a lot of them similar to |
Looking at @mpickering 's patches, I am worried. Atm, there will be only one To solve the problem of coupling
If you depend on Would this work? (Maybe someone more immersed in the matter can answer this.) |
And keep the shim idefinitely (or until all sensible packages switch to |
Moreover hackage revisions could be done for those cases Cabal == x.y.z |
It turns out your can't write conditionals in a setup-depends field so for head.hackage I have
|
Sadly, that won't work in the long run --- all custom script packages will be stuck at Cabal 3.6 until that starts conflicting with other things and then they should all at once switch to >= 3.7 (can be done in bulk in Hackage, but it won't work if some of them have genuine problems with newer Cabals). |
Yes, this shim could be auto-generated by just reexporting the modules of these two packages (or is there a lighter way?). If we want to nudge folks to get away from the shim |
Right, this just unblocks me for head.hackage, not a long-term solution. |
I'm +1 on the shim. What's the cheapest scheme?
Custom setups are destined to die anyway, so there's not much point helping users improve them. But for tool builders depending on only Cabal-syntax or only Cabal-engine may have many advantages. OTOH, they are quite likely to become aware of the split just from changelogs or looking at the source, without any aggressive advertising. So I wouldn't worry. |
A wizard of yore tells me
which makes me +0.5 on the shim and +0.5 on full re-export. If we want limited and mostly opt-in breakage in the short and in the long run, do we have any other options? |
I completely understand the reluctance to reexport Does this sound like a plausible approach? |
I think at this point the actual cost of reexporting is not so great, and we probably should just do it. If someone could try to enumerate the disadvantages of doing so clearly, it would be good to see that all in one place so we can evaluate it. |
@bgamari: what you propose looks similar to the shim idea discussed starting at #7974 (comment) For the shim idea we agreed that reexporting seems preferable in this particular case, but if you have new arguments, let's restart the discussion. |
Ahh, apologies! Somehow I missed that comment. Yes, this is precisely what I was thinking. Sorry for the noise. |
It seems nobody objects to the idea of (temporarily) re-exporting Cabal-syntax from Cabal. We talked at today's dev call and probably the easiest way is to re-export everything. We might also immediately warn in release notes that this shim is going to be removed at some point. We could also, at once or not, deprecate all the re-exported things with proper pragmas, somehow explaining that they are still available, but in Cabal-syntax. Any last minute objections? Any refinements of the idea? Would anybody like to implement that after we wait for a few days for any objections? |
In writing up some notes on this, I just also came up with one more "evil trick" that we can consider -- we "simulate" flags by introducing a new "virtual flag" via a phantom dependency. Create a new package, "cabal-syntax-split" that is empty and has two versions, call them 1 and 2. Force cabal-syntax to depend on version 2. Revise all pre-split versions of Cabal to depend on version 1. This resolves the issue raised by @phadej that
which also I think was what motivated mpickering to raise this issue when he wrote that
Sorry to raise this only just after our meeting, but it just only occurred to me. |
This is strictly worse (= new package) then just revising |
Fair point. Why don't we just revise all prior cabals to depend on empty cabal-syntax then? |
What if a sneaky cabal hides somewhere and we don't apprehend it and don't revise it? E.g., perhaps some Hackage mirrors that people use have some extra versions of cabal? I can't easily imagine other failure scenarios but are we sure there are none? |
That seems like very much a corner case. (also I see @jneira suggested what I am suggesting above, and nobody responded). @mpickering do you think that just making such revisions would suffice? |
I guess it was due to
which would need
Or we could do those extraordinary revisions this time summoning some hackage demon :-P |
Right. In this case the hackage admins could certainly grant special ops to perform these revisions. |
Doesn't fix anything. Unrevisioned versions exist, and they are a problem. |
Please remember what was the goal of #7559 Which started from my comment #7548
Note especially, that then (and now) I see the only use for Exporting everything from Also, I thought that So I expect that stuff will still be shuffled between As a person who put the If "Cabal devs" disagree, then I seriously suggest reverting, and figuring out first, why this change is made to begin with?. Note: |
Oleg, respectfully, please chill out. I don't think anyone is that strongly in disagreement with you. I don't understand why you are being so combative, or what you think you are being combative against. That said, I do see the argument that if we're expecting the dividing line to evolve in the future, then for now re-exports are just fine. Module re-exports are always somewhat irritating, and so there has been a reluctance to adopt them. We all agreed at the cabal advisors meeting that it was a pragmatic choice -- as mikolaj described earlier today! I think it was good to have a full discussion about the design space of other alternatives. I think the revisions on hackage seem like a nice approach. I still don't understand why people are dismissive of it. But if dragging this discussion out will continue to cause such vitriol and angst, then lets just do the damn re-export, and reconsider later. |
Agree we could wait to have a stable division to cut the umbilical cord. But with a concrete deprecation plan there are high probabilities of keeping the reexports forever. Almost same arguments (but the stabilization one) will be raised when trying to do.
The other way around also holds, coupling technically both packages would make more difficult decoupling them organizationally or having more than a cabal syntax so it will influence any decision about. |
Amazing. So we have an agreement once again. :) Let me repeat myself:
|
for those interested, i opened a discussion about how we might more generally be able to have a deprecation path for re-exported module shims ghc-proposals/ghc-proposals#489 |
Would it make sense to re-export now? We'd all have ample time to dogfood before the release... |
I think we all agree to reexport, it's just that nobody made a pr yet |
We discussed this in the advisors call. |
To preserve compatibility for downstream users Cabal will reexport all of Cabal-syntax for the time being. In the future we may deprecate these reexports. Closes haskell#7974.
To preserve compatibility for downstream users Cabal will reexport all of Cabal-syntax for the time being. In the future we may deprecate these reexports. This requires that we bump the cabal-version of Cabal.cabal to 1.22 and drops support for GHC < 7.10. Closes haskell#7974.
To preserve compatibility for downstream users Cabal will reexport all of Cabal-syntax for the time being. In the future we may deprecate these reexports. This requires that we bump the cabal-version of Cabal.cabal to 1.22 and drops support for GHC < 7.10. Closes haskell#7974.
The changes to split up
Cabal
andCabal-syntax
cause most packages which use theCabal
library to fail to build (https://gitlab.haskell.org/ghc/head.hackage/-/jobs/944876).Perhaps it would be worthwhile to make
Cabal
reexport all the modules inCabal-syntax
to minimise this kind of distruption.cc @Mikolaj
The text was updated successfully, but these errors were encountered: