首页 文章

使用具有额外deps的堆栈解算器时的Hackage名称冲突

提问于
浏览
1

好吧,事实证明我的应用程序名称与上传到hackage的其中一个软件包相同,所以当我尝试使用 stack solver --resolver lts 7.12 解析额外的依赖项时,我收到以下错误:

$ stack solver --resolver lts-7.12
Using configuration file: stack.yaml
Using cabal packages:
- html-parse.cabal

Using resolver: lts-7.12
Using compiler: ghc-8.0.1
Asking cabal to calculate a build plan...
Trying with packages from lts-7.12 as hard constraints...
Attempt failed.

>>>> Cabal errors begin
cabal.exe: Could not resolve dependencies:
next goal: html-parse (user goal)
rejecting: html-parse-0.2.0.0, 0.1.0.0 (global constraint requires ==0.0.0.3)
trying: html-parse-0.0.0.3
next goal: hunit (dependency of html-parse-0.0.0.3)
Dependency tree exhaustively searched.
<<<< Cabal errors end

Could not parse cabal-install errors:

>>>> Cabal errors begin
cabal.exe: Could not resolve dependencies:
next goal: html-parse (user goal)
rejecting: html-parse-0.2.0.0, 0.1.0.0 (global constraint requires ==0.0.0.3)
trying: html-parse-0.0.0.3
next goal: hunit (dependency of html-parse-0.0.0.3)
Dependency tree exhaustively searched.
<<<< Cabal errors end

我在.cabal文件中的app / package名称是 html-parse ,当前版本是0.0.0.3 . 看起来我自己的包被列为一个约束为 ==0.0.0.3 的依赖项,但是有另一个关于hackage的pacakge具有相同的名称但不同的版本 .

我可以在不重命名自己的应用程序的情况下解决此问题吗?

1 回答

  • 0

    引用Cabal user guide(强调我的):

    包名称和版本所有包都有一个名称,例如“HUnit” . 假设包名称是唯一的 . Cabal包名称可以使用字母,数字和连字符,但不能使用空格 . Cabal包的命名空间是扁平的,而不是分层的 .

    因此,Cabal库没有处理包名冲突的功能,也没有cabal-install和stack . 既然如此,您将不得不重命名您的包裹 .

    PS:我故意不认真考虑设置你的项目使用private Hackage排除同名包的可能性,因为我不知道它在实践中会如何发挥,因为它比它值得多麻烦 .

相关问题