提及`cabal.project`文件中的`index-state`的好处

huangapple go评论63阅读模式
英文:

Benefits of mentioning `index-state` in `cabal.project` file

问题

我不需要翻译的代码部分:

"index-state" 在 "cabal.project" 文件中一直有提到。我可以在 cabal 文档 中看到一个使用案例:

这在与 freeze-files 结合使用时特别有用,以便在冻结安装计划时也冻结包索引的状态。

但我认为还有更多内容。

英文:

I keep on seeing the mention of index-state in cabal.project file. I can see one use case mentioned in cabal docs:

> This is particularly useful in combination with freeze-files in order to also freeze the state the package index was in at the time the install-plan was frozen.

But I think there is more to it.

答案1

得分: 2

索引状态只锁定特定的 Hackage 索引(通过日期标识)。这可以防止由于包索引的更改而导致构建中断。

我的前公司曾因包 X 依赖于包 Y 而导致构建中断。我们有一个冻结文件,指定了这两个包的版本。但这并不足够,因为 Hackage 有“修订版”,这是对 .cabal 文件的更改(通常是依赖版本范围的更改)。一个新的修订版被设置为排除我们所使用的包 Y 与包 X 一起构建,因此我们的构建中断了。如果构建使用了 index-state,那么构建系统将不会看到这个新的修订版,事情将继续正常运行。就目前而言,整个团队不得不暂停工作(或至少暂停正常流程的测试)来解决这个问题。

英文:

The index state just locks in a particular hackage index (identified by date). This prevents your build from breaking due to changes to the package index.

My previous company had a build break because package X depended on Y. We had a freeze file which specified the versions for both packages. This isn't sufficient because Hackage has 'revisions' which are changes to the .cabal file (usually dependency version bounds). A new revision was set to exclude the version of Y we used from building with package X, so our build broke. If the build used index-state then the build system would not have seen this new revision and things would have continued to function. As it stood the whole team had to pause work (or at least pause testing with the normal process) to get this ironed out.

huangapple
  • 本文由 发表于 2023年4月6日 21:44:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75950258.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定