如何在Stack中用git分支覆盖hackage depedency?

问题描述 投票:0回答:1

我在GHC 8.10上遇到了proto-lens库的问题,它一直不被支持。团队修复了这个问题,但没有在Hackage上发布更新,我正试图从github标签中提取修复。

在stack.yaml中添加了以下部分后,我没有看到构建过程有任何不同。

allow-newer: true

extra-deps:
- github: google/proto-lens
  commit: 0bef8c2f3da645f068b8a26ac168c1da41608182
  subdirs: proto-lens

我想我错过了一些东西,我不清楚Stack是如何看待这个自定义的依赖关系的,它是proto-len的源头,如果我在subdirs或url中打错了怎么办?所以Stack可能会得到其他的东西,甚至可能是一个正确的Stack库,但不是proto-lens。

构建失败的日志

Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.0.2.0 supports
'ghc' version < 8.10): /opt/ghc/8.10.1/bin/ghc is version 8.10.1
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: megaexample-0.4.2 (user goal)
[__1] trying: base-4.14.0.0/installed-4.1... (dependency of megaexample)
[__2] trying: opentelemetry-extra-0.4.2 (user goal)
[__3] next goal: proto-lens (dependency of opentelemetry-extra)
[__3] rejecting: proto-lens-0.6.0.0 (conflict:
base==4.14.0.0/installed-4.1..., proto-lens => base>=4.10 && <4.14)
[__3] rejecting: proto-lens-0.5.1.0, proto-lens-0.5.0.1, proto-lens-0.5.0.0,
proto-lens-0.4.0.1 (conflict: base==4.14.0.0/installed-4.1..., proto-lens =>

另一个补充问题:Stack中的库版本是在哪里指定的?Stack以0.6开头,但在源代码树中没有这样的文字。

链接到源代码

我是否也要调整cabal文件?cabal文件中引用了proto-lens库,我在GHC 8.10上遇到了proto-lens库的问题。

executable eventlog-to-opentelemetry
  import: options
  main-is:    Main.hs
  hs-source-dirs: exe/eventlog-to-opentelemetry
  other-modules: Console, Json, Resource, Attribute, Spans
  build-depends:
    aeson,
    base,
    bytestring,
    clock,
    filepath,
    microlens,
    microlens-th,
    opentelemetry >= 0.4.0,
    opentelemetry-extra,
    opentelemetry-proto,
    optparse-applicative,
    proto-lens,
    text,
    unordered-containers,
  default-language: Haskell2010

haskell protocol-buffers cabal haskell-stack
1个回答
0
投票

构建失败的日志

这个错误日志来自Cabal,而不是堆栈,Cabal不读。stack.yamlcabal.project.

这里是cabal文档中指定远程依赖的相关部分。Cabal用户手册

栈不会尝试不同版本的包。栈中的 stack.yaml 文件预先指定了软件包的版本:每个软件包最多设置为一个特定的版本,可以是通过 extra-deps (您明确地指定了单个软件包)或 resolver (这是一套完整的特定包版本,你可以在 https:/stackage.org。).

我想我错过了什么。我不清楚 Stack 如何看待这个自定义依赖。它是 proto-len 的源码的关联在哪里?如果我在subdirs或url中打错了字怎么办?所以Stack可能会得到别的东西,它甚至可能是一个正确的Stack库,但不是proto-len。

这确实很奇怪,似乎没有一个选项来明确命名预期的远程包。这是个值得向堆栈维护者提出的问题。

© www.soinside.com 2019 - 2024. All rights reserved.