-
Notifications
You must be signed in to change notification settings - Fork 701
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
Move --allow-{newer,older} back to ./Setup.hs #9016
base: master
Are you sure you want to change the base?
Conversation
005a027
to
080e54d
Compare
Based on the discussion on the issue, I think the change is welcome. We just need to get the reviews. |
hi, thanks for the pr, out of curiosity, any plans to add also tests 🤖 |
Thing is: There are tests for this but they currently reside in cabal-install. I can port them over if desired. |
Okay, so Cabal apparently has no testsuite. I can change the cabal-install tests to use the Types from Cabal but that will break compatibility with other Cabal versions. I'd be thankful for guidance on this. |
080e54d
to
450aa57
Compare
Do you mean test components in There are some curious discussions about compatibility requirements over at #8998 (esp. #8998 (comment)) |
This only uses Also, the syntax (I have some doubts in going in this direction (see my comment here) but here I will restrict myself to discussing the implementation here) |
I didn't know about the testsuite package. We can move tests from cabal-install to the testsuite if that's desired. |
Well, as written in the other issue Cabal has a very simple solver and that is the thin being affected here. You are right that the specification of the relaxed dependencies is overly complex for Cabal. Otoh having the same option format for Cabal and cabal-install is certainly easier to users. Also I could imagine a situation where we would pass "pkg-2.3.4:base" so that the override does not apply for older or newer versions. I think that's a nice to have. We can certainly explain this situation in the docs to limit user confusion. |
Ah, from a look at cabal-install bounds and reading the compat discussion my impression is now, that cabal-install is allowed to have tight constraints on Cabal for being compiled against, it just needs to be able to drive older versions of Cabal, right? Can I have a confirmation on that? In that case I will just modify cabal-install to use the allow newer tooling from Cabal. |
450aa57
to
cc251c0
Compare
@grayjay could you, please, express your opinion on this issue (moving allow-newer to Cabal and the compatibility story)? |
I am currently refactoring the PR. So I am putting it into draft mode. Please continue with the general discussion. |
c0c9996
to
feaaf6d
Compare
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.
Even if we want to use the same --allow-{newer,older}
flags, I don't think we need to use
the machinery in Distribution.Client.Dependecy
.
In Distribution.Simple.Configure
we have dependencySatisfiable
which does the job do checking dependencies. We should adapt that function to relax the version range passed to PackageIndex.lookupInternalDependency
in here.
Another thought is: if we suppor this in |
I'm not very familiar with the issue of whether the code should be in Cabal or cabal-install, but I thought that previously the plan was to refactor I think that we should support |
Thanks for the feedback. First let me say: Better error output, even by the simple Cabal solver would be awesome. Especially, printing which non-matching versions of a dependency were found would make our lives in Nixpkgs immensely easier. That being said: Carving out the two days to write this pr was quite hard (and actually a bit irresponsible) for me, and carving out two more to rewrite it is probably not possible. Also, I was very much hoping to backport this PR to our older GHCs in Nixpkgs so the larger the refactoring becomes the harder that gets. This pr is not making the code worse. It is simply using functions which were already there, and is imo a strict improvement. I totally understand that you want to improve the code base, but I would ask you to not force it onto me as an external one-time contributor. I agree that the solution you describe is nicer, so I will have a look if it looks so easy that I can quickly do it. Will report back. |
I had a look at that. I think I could do it with manageable effort, but I see three problems:
|
…al Distribution.Types.AllowNewer In this first step only copy so the diff in the next commit makes clear what is happening.
(Just rebased to resolve merge-conflicts, no other changes.) |
@maralorn Thank for the time you are spending on this, I do appreciate it. I volunteer to push this across the line (if you wish). @grayjay I don't think this is going to impact #4203 in any way. I think they are orthogonal features, although they appear to have the same name (btw, @ulysses4ever, @fgaz @Kleidukos are we still ok with this? we won't be able to change it later). |
That’s very kind, thanks. Let’s first see what needs to be done. I am curious what the answer to my questions above is. |
We discussed this PR today in the cabal-devs meeting. So the only thing missing from my point of view is that we agree on a solution @andreabedini. I had asked some questions above and will be curious to read what you think, when you have time to reply. |
Hi @maralorn, let me say first that I don't want to be a blocker. I do think we can achieve your goal with a smaller and simpler change; perhaps even non-breaking. I worked on this last night. You are correct in that if only change satisfyDeps we end up with a wrong error message. So I changed configureFinalizedPackage instead; remembering which dependencies had their bounds removed and improving the error message exactly like you suggest. (I would have preferred to wrap Dependency, maybe one day) I think it works, but I would need another couple of day to clean it up, push it somewhere and test it properly. Re your questions: If the other maintainers think we should proceed with this PR as it is, I'm happy to shelf my attempt for another day. No hard feelings |
I am not entirely sure what you mean with non-breaking. Apart from that, most of the change in this PR is moving the datatypes and the parsing for the command line flag into Cabal and I don’t see how or why we would avoid that. If we can keep
Cool! Better output is a huge win!
Yeah, regarding 2) I think it’s likely that it will just work. I liked editing the package description because it has the abstraction advantage of being very likely to work without understanding or touching the inner workings of the solver.
If this change could still make it into 3.10 I would love to see that happen, but I assume that ship has sailed. So we have time. I’ll just let you take over. If this gets resolved in, let's say, a month or two, I am totally fine. |
@andreabedini just a gentle ping here. Do you think you could flesh out your experiment in the coming weeks? |
Yes, I will. Apologies and thanks for the ping. |
I ended up in a rabbit hole trying to separate Cabal flags from cabal-install flags. Even we want to keep the same flags name, I don't think we should use the same representation for AllowNewer since it's really geared toward a more complex use case (the one of cabal-install) but the fact that we just re-use and re-export Cabal configure flags made everything a mess. I think I will try again with the same trick that cabal-install does: Cabal can have an extra set of flags that are not shared with cabal-install. I guess cabal-install could still build on top of Cabal's simpler representation (adding the scope part). Anyway. The meat of my proposed change is here. ed2253b#diff-fff9e57c2727835086925d886619deb3fafd33a06e1af760d60d485ae07cec68R1213-R1293 I think it's pretty minimal and a part of it is there to just rework the representation of |
@andreabedini That looks good to me! |
I cannot shake the feeling I have thrown a wrench in this PR's wheel. Let me try to first summarise the situation (please correct me if I am mistaken!) and then propose a plan forward:
Note that both changes are API breaking and will require a major version bump (In a comment above I mentioned it could be done in a non-breaking way but I was mistaken: the change in I am not sure this is acceptable for everyone but I propose the following:
I am of course happy to consider suggestions or alternative plan (or straight-on accept a different outcome if there is wide consensus). Let me know what you think, thank you 🙏 [1] |
@andreabedini Thank you for your thoughts. Honestly I am really grateful for you working on this. For years this issue lingered in the "sure, if you want it write it" state and nothing moved forward and now after I invested a bit of time, a cabal contributor is actually commited to do this right. That’s awesome from my point of view. Also I am really not in a terrible hurry, so don’t feel to stressed about this, anything which makes it into Cabal 3.12 would be totally fine from my point of view. Only reason to urge you on this is that generally live happens and then things fall under the radar. I am for the next few weeks much to busy myself to e.g. apply patches in Nixpkgs. In any way my plan was to wait until this feature is merged into the master branch before actually doing backports. In theory we can do what we want in Nixpkgs, but we want to be as faithful and respectful of upstream as possible and are careful about applying random patches. Especially I would like to avoid backporting a flag which then suddenly changes in a later version of Cabal or does not get merged at all, because perpetually maintaining a patch like that is a huge burden. On the other hand, I think an exception to this rule can be made, especially if a patch is semi-sanctioned by upstream. So I am fine with your suggested way forward and the help you offered. Implementation wise I still think having the exact same flag shared between cabal-install and Cabal is the right solution even if we ignore the fact that it’s easier to implement. But I admit, that I might not be objective since that was the solution I implemented. Maybe other Cabal devs can voice their opinions on this. |
Please don't stop thinking about this and please kindly post here links to any new related tickets! |
Hey there! I have no clue what the release schedule for Cabal is, but I would be very happy if this could be in the next Cabal release. Can someone tell me the timeline which we would need to meet? I will gladly fix the current merge conflicts and make all tests run again if there is a reasonable chance of a merge. |
@maralorn: yours is a serious change, not a simple bugfix (e.g., a real design discussion is taking place; potentially a RFC might be needed), so I wouldn't expect this can be fast-tracked. We don't have the two positive reviews yet and with this kind of a change we might additionally need an extra buy-in from subsystem maintainers (e.g., @grayjay and @gbaz) and a backward compatibility discussion (I'm making this up, I haven't thought this through yet). The next major release 3.12.1.0 may be out as soon as within a month, so it may be hard to get enough visibility and user testing by then and get this included. All the more reason to resume the discussion to get this finalised by the next major release (probably in around half a year). BTW, it would be unofficially released in a nightly (https://github.com/haskell/cabal/releases/tag/cabal-head) as soon as it's merged so that users can test it in the wild. |
I admit this reply does not make me super happy. I went to a Cabal dev meeting where this PR was discussed and was met with a general consensus. The vibe there was "resolve your discussion with Andrea and then we can go ahead". I was not even informed that there is an RFC process and that I would need to propose anything there. @grayjay already commented on this PR and seemed to be in favor. I generally don’t want this PR to be fast-tracked. My aim at 3.12 was months ago. But okay, let’s aim for 3.14 then. I just want it to move forward somehow. @andreabedini would you be willing to work with me on unblocking this? I am available to come to another dev meeting where we could discuss this. I could also just bring this PR in a mergeable state in its current form if you have too much on your plate. |
@maralorn: apologies, I didn't mean to discourage you and my conservative estimate of 3.14 is based on a superficial knowledge of this PR and its subject matter. Please prove me wrong and get it ready for 3.12 with some margin for user testing. :) Re RFC, it's not mandatory in general. It's just a tool. Reviewers and others more informed than myself would know better whether to recommend it and you'd decide whether to go for it. |
@andreabedini I’d love to. But I am sadly too busy for another few weeks. (I have a big deadline on the 18th of October.) |
@maralorn @andreabedini any chance you guys can push forward here? 3.12 is still not cut, so there's chance to get the feature there. |
I had a very nice call with @andreabedini and we decided on how to proceed. I currently don‘t have the capacity to work on it, so it will have to wait until I do. |
Splendid! Would you like to jot down a couple of sentences, hinting at the core design decisions you arrived at? |
Certainly. So @andreabedini has a branch somewhere where they started their approach (I guess based/inspired by my first attempt.), I will shortly take that branch and build on that. Differences to this first try:
|
@andreabedini @maralorn are there any updates on this work? It's sad to see a good PR lingering for so long... |
I agree. I tried to work on this at zurihac but I had a lot of cache misses on the details because this took so long … I still want to work on this, but live happens. |
Here I am trying to bring back
--allow-newer
and--allow-older
into./Setup.hs
.This fixes #7445, #5407 and #7859.
I gave this a shot, and it seems to work, but I found the code base hard to navigate.
So please tell me if anything should be organized differently.
I have prepared code for cabal-install to use the methods from Cabal. I did not include in this PR, because I assume cabal-install needs to be backwards compatible with older Cabal versions.There still seems to be a bug with argument parsing where the following are valid:--allow-newer
--allow-newer=True
--allow-newer=False
--allow-newer=*:base
--allow-newer=*:base,*:aeson
--allow-newer=*:base,foo:aeson
but not--allow-newer=foo:base
.That is especially weird, because the same parser works in all of those cases incabal-install.
I will add changelog entries and documentation later, if this PR is generally well received.Edit: I have fixed the option parsing. It now behaves exactly like in cabal-install, which is actually simpler than I thought before.
I suggest evaluating this PR commit by commit.
Bonus points for added automated tests!