使用本地版本的包

使用本地版本的包

本文介绍了如何使用 Stack 安装/使用本地版本的包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况是,我正在尝试使用 Stack 安装 Netwire.但是,最新的 netwire 5.0.1 中存在一个问题,正如 dhobbs 报告的那样:http://hub.darcs.net/ertes/netwire/issue/13

The situation is, I am trying to install Netwire using Stack. However, there is a problem in the latest netwire 5.0.1, as reported by dhobbs: http://hub.darcs.net/ertes/netwire/issue/13

由于我不知道问题何时能得到解决,所以我下载了 repo 并自己进行了更改.但是,我不明白如何安装这样的本地补丁版本.stack install 不会将其安装到 ~/.stack 中.有人有想法吗?

Since I don't know when the problem will ever be fixed, I downloaded the repo and made the change myself. However, I don't understand how to install such a locally patched version. stack install does not install that into ~/.stack. Does anyone have an idea?

更新

现在我正在使用 Stack 开发其他一些库.如何让另一个项目使用该库?硬编码相对路径看起来非常难看.

Now I am developing some other libraries using Stack. How do I make another project use that libraries? Hard coding a relative path looks incredibly ugly.

推荐答案

所以你有一个项目,你想使用本地修补的 Netwire 版本,并且在你的项目中有一个 stack.yml,例如:

So you have a project where you want to use your locally patched Netwire version and in your project you have a stack.yml, as an example:

flags: {}
packages:
- '.'
extra-deps: {}
resolver: lts-3.7

您还依赖于 cabal 文件中声明的 netwire.

You also have an dependency on netwire declared in your cabal file.

要在你的这个项目中使用你修补过的 Netwire,你只需将修补过的 Netwire 包放在你的项目的子目录中,可能称为 netwire,然后更新你的 stack.yml 像这样:

To use you patched Netwire in this project of yours you simply put the patched Netwire package in a subdirectory of your project, perhaps called netwire, and update your stack.yml as such:

flags: {}
packages:
- '.'
- netwire
extra-deps: {}
resolver: lts-3.7

现在 stack build 将使用修补过的 Netwire 版本构建您的项目.

Now stack build will build your project with the patched Netwire version.

您也可以将修改后的源放到网上(如果许可证允许)并使用 tarball URL 引用

You can also put the modified source online (if the license permits) and refer to the source using either a tarball URL

- https://example.com/netwire.tar.gz

或 git 存储库和提交参考:

or a git repository and commit reference:

- location:
    git: [email protected]/netwire
    commit: 6a86ee32e5b869a877151f74064572225e1a0398

(查看文档了解更多信息:https://docs.haskellstack.org/en/stable/yaml_configuration/#packages-and-extra-deps)

(Check out the documentation for more info: https://docs.haskellstack.org/en/stable/yaml_configuration/#packages-and-extra-deps)

这篇关于如何使用 Stack 安装/使用本地版本的包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 20:32