You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to use the same freeze file for a plethora of internal projects, then a "global" freeze file might make sense. Currently this would require copying and synchronising such a file across repositories, or having a mono-repo. Being able to set a remote location as a freeze file in cabal.project would solve this use case.
Cli options could allow to say what to do in case fetching fails:
abort resolution
continue without a freeze file
Reacted by Dmitry Ivanov, Hécate, gbaz, Emily Pillmore and Ondřej Weis
@hvr spent considerable time to keep the critical path to produce a plan.json fast, so that a no-op cabal build and cabal run latency would be <100ms in order to keep unconditional cabal build and cabal run usable in interactive settings or when integrating with other build tools.
Such a remote fetch for a freeze file would be and almost certainly ruin this criticial path.
IMO, it's very reasonable to be concerned about re-fetching a remote freeze file every time you run cabal build, and this is a convincing reason not to do it that way.
There are other ways to do it:
A cache that would only re-fetch a freeze file occasionally. Taking an extra couple seconds once a day isn't anything like the same barrier. But the unpredictable timing of picking up changes would be unfortunate.
My favorite: Give names to packaged constraint sets, and fetch them as part of cabal update. This opens the door to future work mirroring them in case one source is down, migrating hosting or even hosting on Hackage, integrating with signing and other security measures, etc.
It's not like the latency concern is a dead end for the concept. It's just an argument against one of many possible implementations.
Wrt 2.: Sounds like a controversial choice to me, since remote freeze files very likely would be per project (although there might be a global one too). cabal update so far has no project specific semantics afaik, so this would be a pretty drastic change in workflow.
As for the latency concerns: I do not share them.
This is an optional feature
Users who rely on it will care more about the feature than latency. It has zero impact on hackage and no impact on repos you use through source-repository-package. If you don't want it, it doesn't impact you.
There are a bunch of reasons cabal today is already pretty slow. Fetching of source-repository-package is one of them. I have never seen people complain about that.
Fetch strategies could be added to the configuration, to allow for immutable remote freeze files (uniquely identified by the name). Then you would only fetch once.
I believe that configure would be the correct place for this, since it also fetches remote repos at that stage.
Recent discussions have convinced me this would be a great feature to have. I think we should give the current freeze workflows a once-over as a first pass to make sure they're sufficiently ergonomic, then just tweak them to allow http fetch with caching. There are at least three features to reduce repeated fetch latency -- cache-control, etag, and last-modified checks. Our current transport backends should have decent support for them, last I checked :-)
I believe that configure would be the correct place for this, since it also fetches remote repos at that stage.
I agree with this. I was thinking too complex and missing a simpler answer here. I think it needs to be possible to do cabal build and cabal run without internet access, but if network fetching can already happen during configure, then adding remote freeze files at the same time sounds good to me.
@ptkato: does v2-configure still fetch remote repos or did we focus it exclusively on translating build flags to caba.project syntax and overwriting project files?
Even if it still does, given that the use of cabal configure is deprecated in normal workflows and that fetching remote repos is a part of cabal build, wouldn't it be more natural to call cabal build --fetch-remote-only or something similar and include repos and freeze files in that? [Edit: the same as for cabal build applies to cabal install.]
I didn't read closely about your use cases in this issue, so pardon me if I don't make sense.
Even if it still does, given that the use of cabal configure is deprecated in normal workflows and that fetching remote repos is a part of cabal build, wouldn't it be more natural to call cabal build --fetch-remote-only or something similar and include repos and freeze files in that?
I was under the impression that configure is an internal phase in cabal-install that is run by both cabal configure and cabal build, while the former seems to do additional work.
I was under the impression that configure is an internal phase in cabal-install that is run by both cabal configure and cabal build, while the former seems to do additional work.
Yes, that was a misguided attempt at backward compatibilty with v1-configure, which was a mandatory first step in the standard v1- workflow and which was not duplicated in v1-install. Now the overlap of cabal v2-configure and cabal v2-build (and the same in the alternative cabal v2-install) is gone (in cabal 3.6, I think), which makes it easier to tell which action fits into which command and so I'm just trying to establish exactly that. :)
I think if cabal build consists of stage1 and stage2, it makes perfect sense to have cabal build --stage1-only and cabal build-stage2-only. The remaining work it delineating the stages sensibly (re-ordering some things, if needed), agreeing on self-explanatory names, porting the flags to cabal install and possibly elsewhere. I'm guessing this is quite tangential to your original issue and your needs and can be done in a separate bike-shedding ticket. However, if you can refine what precise stage1 would fit your use cases best, that would fit in here, certainly.
I think if cabal build consists of stage1 and stage2, it makes perfect sense to have cabal build --stage1-only and cabal build-stage2-only. The remaining work it delineating the stages sensibly (re-ordering some things, if needed), agreeing on self-explanatory names, porting the flags to cabal install and possibly elsewhere. I'm guessing this is quite tangential to your original issue and your needs and can be done in a separate bike-shedding ticket. However, if you can refine what precise stage1 would fit your use cases best, that would fit in here, certainly.
Well, I don't have too much of a clear picture how current or future cabal-install are structured. But I'd argue that internal phases and external cli interface is a different matter entirely.
and possibly more (again, see the link to the gentoo PMS).
My impression was that configure is basically doing fetch, unpack and configure. If it doesn't anymore, I'd argue the only sensible way forward is to have more fine-grained phases, that will also allow users to hook into them. That would also make it trivial to decide on when remote freeze file fetching ought to happen.
The user might only be exposed to the name build and install, while cabal will clearly indicate in its output which phase is currently running.
On its own it doesn't, because unlike cabal.projec.tfreeze it doesn't include index-state. if index-state is added next to the import, then package versions are completely fixed, including revisions.
Freezing index state freezes the entire set of revisions. You can't specify individual revisions.
I understand what cabal does, I am just wondering what stack does. E.g. I would expect a package to build with stack and lts-18.26 IFF it builds with cabal and import: https://www.stackage.org/lts-18.26/cabal.config. But this might not be true if cabal follow revisions and stack doesn't.
I was under the impression that since the pantry reform, stackage snapshots will fix all the cabal files too, but I might be wrong here.
I understand what cabal does, I am just wondering what stack does. E.g. I would expect a package to build with stack and lts-18.26 IFF it builds with cabal and import: https://www.stackage.org/lts-18.26/cabal.config. But this might not be true if cabal follow revisions and stack doesn't.
I was under the impression that since the pantry reform, stackage snapshots will fix all the cabal files too, but I might be wrong here.
Stack has 3 forms:
acme-missiles-0.3: uses the most recent revision
acme-missiles-0.3@rev:1 uses revision 1
acme-missiles-0.3@sha256:2ba66a092a32593880a87fb00f3213762d7bca65a687d45965778deb8694c5d1,631: uses the revision with the given hash (this is discovered automatically)
I don't think the revisions stuff is important. I do think that we're missing another thing still -- the logic for combining constraints remains totally additive -- so if there is a constraint from some imported freeze file, there's no way to override it.
We need a PR that says "within processing project files, constraints on versions should be combined under Last, not under union.
Because as discussed here #7556 specifying a package algebra is a lot of work and new code which may be subtle and just changing the behavior this way will handle the use cases people are concerned about in a much more straightforward fashion
Because as discussed here #7556 specifying a package algebra is a lot of work and new code which may be subtle and just changing the behavior this way will handle the use cases people are concerned about in a much more straightforward fashion
How can you specify non-overridable constraints with this approach (e.g. security masks)? Wasn't that one of the major use cases?
you can't specify non-overridable constraints, but if someone wants to deliberately override a security mask that's their right, prerogative, and problem.
As an aside, I'm starting to come to the view that the "correct" way to handle security masks is a proper notion of a "vulnerability-warning-list" either orthogonal to or integrated into the main package index, rather than just trying to beef up existing tools to cover this sort of situation.
Activity
Kleidukos commentedon Feb 14, 2021
This is a great idea and will certainly help bringing cabal to feature parity with stack in enterprise environments.
merijn commentedon Feb 14, 2021
@hvr spent considerable time to keep the critical path to produce a
plan.jsonfast, so that a no-opcabal buildandcabal runlatency would be <100ms in order to keep unconditionalcabal buildandcabal runusable in interactive settings or when integrating with other build tools.Such a remote fetch for a freeze file would be and almost certainly ruin this criticial path.
cdsmith commentedon Jun 1, 2021
IMO, it's very reasonable to be concerned about re-fetching a remote freeze file every time you run
cabal build, and this is a convincing reason not to do it that way.There are other ways to do it:
cabal update. This opens the door to future work mirroring them in case one source is down, migrating hosting or even hosting on Hackage, integrating with signing and other security measures, etc.It's not like the latency concern is a dead end for the concept. It's just an argument against one of many possible implementations.
hasufell commentedon Jun 1, 2021
Wrt 2.: Sounds like a controversial choice to me, since remote freeze files very likely would be per project (although there might be a global one too).
cabal updateso far has no project specific semantics afaik, so this would be a pretty drastic change in workflow.As for the latency concerns: I do not share them.
source-repository-package. If you don't want it, it doesn't impact you.source-repository-packageis one of them. I have never seen people complain about that.I believe that
configurewould be the correct place for this, since it also fetches remote repos at that stage.gbaz commentedon Jun 2, 2021
Recent discussions have convinced me this would be a great feature to have. I think we should give the current freeze workflows a once-over as a first pass to make sure they're sufficiently ergonomic, then just tweak them to allow http fetch with caching. There are at least three features to reduce repeated fetch latency -- cache-control, etag, and last-modified checks. Our current transport backends should have decent support for them, last I checked :-)
cdsmith commentedon Jun 6, 2021
I agree with this. I was thinking too complex and missing a simpler answer here. I think it needs to be possible to do
cabal buildandcabal runwithout internet access, but if network fetching can already happen during configure, then adding remote freeze files at the same time sounds good to me.Kleidukos commentedon Jun 7, 2021
I too agree with this.
Mikolaj commentedon Jun 7, 2021
@ptkato: does v2-configure still fetch remote repos or did we focus it exclusively on translating
buildflags tocaba.projectsyntax and overwriting project files?Even if it still does, given that the use of
cabal configureis deprecated in normal workflows and that fetching remote repos is a part ofcabal build, wouldn't it be more natural to callcabal build --fetch-remote-onlyor something similar and include repos and freeze files in that? [Edit: the same as forcabal buildapplies tocabal install.]I didn't read closely about your use cases in this issue, so pardon me if I don't make sense.
hasufell commentedon Jun 7, 2021
I was under the impression that
configureis an internal phase in cabal-install that is run by bothcabal configureandcabal build, while the former seems to do additional work.Mikolaj commentedon Jun 7, 2021
Yes, that was a misguided attempt at backward compatibilty with v1-configure, which was a mandatory first step in the standard v1- workflow and which was not duplicated in v1-install. Now the overlap of
cabal v2-configureandcabal v2-build(and the same in the alternativecabal v2-install) is gone (in cabal 3.6, I think), which makes it easier to tell which action fits into which command and so I'm just trying to establish exactly that. :)hasufell commentedon Jun 7, 2021
Well in that case, the user definitely needs a way to:
cabal build, even if that's a completely different commandcabal buildto not fetch anything ever (I believe--offlineexists for that purpose)Mikolaj commentedon Jun 7, 2021
I think if
cabal buildconsists of stage1 and stage2, it makes perfect sense to havecabal build --stage1-onlyandcabal build-stage2-only. The remaining work it delineating the stages sensibly (re-ordering some things, if needed), agreeing on self-explanatory names, porting the flags tocabal installand possibly elsewhere. I'm guessing this is quite tangential to your original issue and your needs and can be done in a separate bike-shedding ticket. However, if you can refine what precise stage1 would fit your use cases best, that would fit in here, certainly.fgaz commentedon Jun 7, 2021
That'd be the new --only-download flag
hasufell commentedon Jun 7, 2021
Well, I don't have too much of a clear picture how current or future cabal-install are structured. But I'd argue that internal phases and external cli interface is a different matter entirely.
Internally, especially in the light of #7394 I'd argue that an approach similar to classic linux distro package managers is desirable. See for example https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-850009.1
So cabal would have at least phases, such as:
and possibly more (again, see the link to the gentoo PMS).
My impression was that
configureis basically doingfetch,unpackandconfigure. If it doesn't anymore, I'd argue the only sensible way forward is to have more fine-grained phases, that will also allow users to hook into them. That would also make it trivial to decide on when remote freeze file fetching ought to happen.The user might only be exposed to the name
buildandinstall, while cabal will clearly indicate in its output which phase is currently running.14 remaining items
hasufell commentedon Apr 7, 2022
Freezing index state freezes the entire set of revisions. You can't specify individual revisions.
andreabedini commentedon Apr 7, 2022
I understand what cabal does, I am just wondering what stack does. E.g. I would expect a package to build with stack and lts-18.26 IFF it builds with cabal and
import: https://www.stackage.org/lts-18.26/cabal.config. But this might not be true if cabal follow revisions and stack doesn't.I was under the impression that since the pantry reform, stackage snapshots will fix all the cabal files too, but I might be wrong here.
hasufell commentedon Apr 7, 2022
Stack has 3 forms:
acme-missiles-0.3: uses the most recent revisionacme-missiles-0.3@rev:1uses revision 1acme-missiles-0.3@sha256:2ba66a092a32593880a87fb00f3213762d7bca65a687d45965778deb8694c5d1,631: uses the revision with the given hash (this is discovered automatically)stackage snapshots usually specify hashes and as such implicitly pin revisions: https://github.com/commercialhaskell/stackage-snapshots/blob/6b1cf107d88d0ac78573d843c26a075d6bfff9c3/lts/19/2.yaml#L62
Also see https://docs.haskellstack.org/en/stable/pantry/
gbaz commentedon Apr 7, 2022
I don't think the revisions stuff is important. I do think that we're missing another thing still -- the logic for combining constraints remains totally additive -- so if there is a constraint from some imported freeze file, there's no way to override it.
We need a PR that says "within processing project files, constraints on versions should be combined under Last, not under union.
hasufell commentedon Apr 7, 2022
Wasn't duncans idea to write a nice algebra with combinators?
gbaz commentedon Apr 7, 2022
yes but we're not doing that.
hasufell commentedon Apr 7, 2022
Why not?
gbaz commentedon Apr 7, 2022
Because as discussed here #7556 specifying a package algebra is a lot of work and new code which may be subtle and just changing the behavior this way will handle the use cases people are concerned about in a much more straightforward fashion
hasufell commentedon Apr 7, 2022
How can you specify non-overridable constraints with this approach (e.g. security masks)? Wasn't that one of the major use cases?
gbaz commentedon Apr 7, 2022
you can't specify non-overridable constraints, but if someone wants to deliberately override a security mask that's their right, prerogative, and problem.
gbaz commentedon Apr 7, 2022
As an aside, I'm starting to come to the view that the "correct" way to handle security masks is a proper notion of a "vulnerability-warning-list" either orthogonal to or integrated into the main package index, rather than just trying to beef up existing tools to cover this sort of situation.
hasufell commentedon Apr 7, 2022
I still think an algebra is cooler and more powerful. Is this left open as a future option?
gbaz commentedon Apr 7, 2022
Sure, there's nothing in the plan that would rule such a thing out.
hasufell commentedon Apr 7, 2022
I added cabal pre-releases, so people can test this feature on current HEAD comfortably:
andreabedini commentedon Apr 7, 2022
Thank you @hasufell, exactly the summary I needed!