如何使用Stack安装/使用本地版本的软件包? [英] How to install/use a local version of package using Stack?

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

问题描述

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



由于我不知道何时会解决问题,因此我下载了回购并自己做出了改变。但是,我不明白如何安装这种本地补丁版本。 堆栈安装不会将其安装到〜/ .stack 中。有没有人有想法?



更新



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

因此,您有一个项目需要使用本地打补丁的Netwire版本和在你的项目中你有一个 stack.yml ,作为例子:

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

您还有一个依赖于您的cabal文件中声明的 netwire

要使用您在此项目中修补Netwire,只需将修补后的Netwire软件包放入项目的子目录中,也许称为 netwire ,并更新您的 stack.yml ,例如:

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

现在 stack build 项目w ith修补Netwire版本。



您也可以将修改过的源代码联机(如果许可证允许)并使用 tarball URL

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

或git存储库和提交引用:

   -  location:
git:git@example.com/netwire
commit:6a86ee32e5b869a877151f74064572225e1a0398

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


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

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?

Update

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.

解决方案

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

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

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

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

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

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

or a git repository and commit reference:

- location:
    git: git@example.com/netwire
    commit: 6a86ee32e5b869a877151f74064572225e1a0398

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

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

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