cabal沙箱诉全球包数据库 [英] cabal sandbox v. global package db

查看:69
本文介绍了cabal沙箱诉全球包数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在cabal沙盒中安装时,cabal仍将使用全局程序包db中的程序包(特别是来自Haskell平台的程序包)。这可能导致安装冲突。是否可以配置cabal忽略全局包db?



我看到相应的功能已在 ghc 本身,通过 -no-global-package-db 选项(请参阅 https://ghc.haskell.org/trac/ghc/ticket/5977 ), ghc-pkg 会忽略如果您不传递 - global 标志,则为全局程序包db。有没有一种方法可以类似地配置cabal?



另外,对于暗示相反行为的cabal有一个封闭的问题(重建所有内容而不是使用来自已安装的Haskell平台的包)所以我不确定这种行为是否随时间而改变;请参阅 https://github.com/haskell/cabal/issues/1695

解决方案

您应该可以通过 cabal configure --package-db 标志,记录如下:


   - -package-db = DB将给定的包数据库附加到所使用的包数据库的
列表中(以满足
的依赖关系并注册到该列表中)。可能是
特定文件,全局或用户。根据上下文,
初始列表是['global'],['global',
'user']或['global',$ sandbox],
。使用'清除'将
列表重置为空。有关
的详细信息,请参阅用户指南。


特别是,您可以将它传递给清除,然后传递它只是沙箱分贝。



这些都在 Cabalized Packages的存储和解释文章。

When installing inside a cabal sandbox, cabal will still use packages from the global package db (in particular, packages which came from the Haskell Platform). This can lead to install conflicts. Is it possible to configure cabal to ignore the global package db?

I see the corresponding feature has been implemented in ghc itself, via a -no-global-package-db option (see https://ghc.haskell.org/trac/ghc/ticket/5977), and ghc-pkg will ignore the global package db if you do not pass it the --global flag. Is there a way to configure cabal similarly?

Also, there's a closed issue against cabal implying the opposite behavior (rebuilding everything instead of using packages from the installed Haskell Platform), so I'm not sure if this behavior has changed over time; see https://github.com/haskell/cabal/issues/1695

解决方案

You should be able to pass cabal configure the --package-db flag, documented like so:

--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.

So in particular, you can pass it clear and then pass it just the sandbox db.

This is all discussed in wonderful detail in the Storage and Interpretation of Cabalized Packages article.

这篇关于cabal沙箱诉全球包数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆