cabal sandbox v. global package db

蓝咒 提交于 2019-12-01 22:00:35

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/30685248/cabal-sandbox-v-global-package-db

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!