Cabal沙盒与全局软件包数据库的区别

3

在cabal沙盒内安装时,cabal仍然会使用全局软件包数据库中的软件包(特别是来自Haskell平台的软件包)。这可能会导致安装冲突。是否可以配置cabal忽略全局软件包数据库?

我发现ghc本身已经实现了相应的功能,通过-no-global-package-db选项(参见https://ghc.haskell.org/trac/ghc/ticket/5977),如果您没有传递--global标志,ghc-pkg将忽略全局软件包数据库。是否有一种类似于配置cabal的方法?

此外,存在针对cabal的已关闭问题,暗示相反的行为(重新构建所有内容而不是使用从已安装的Haskell平台中获取的软件包),因此我不确定这种行为是否随时间而改变; 请参阅https://github.com/haskell/cabal/issues/1695

1个回答

1

您应该能够传递 cabal configure 命令的 --package-db 标志,文档如下:

--package-db=DB                  Append the given package database to the
                                 list of package databases used (to satisfy
                                 dependencies and register into). May be a
                                 specific file, 'global' or 'user'. The
                                 initial list is ['global'], ['global',
                                 'user'], or ['global', $sandbox],
                                 depending on context. Use 'clear' to reset
                                 the list to empty. See the user guide for
                                 details.

因此,特别是您可以传递 clear,然后仅传递沙盒数据库。

所有这些都在 Cabal 包的存储和解释文章中详细讨论过。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接