如何创建合适的 .tar.gz 文件以与“cabal upload”一起使用?

发布于 2024-08-27 20:58:13 字数 400 浏览 5 评论 0原文

与其他程序员共享 Haskell 库的标准方法是创建 Cabal 包并将其上传到 http://hackage.haskell。组织。我写了一个我想分享的库,并且 我已经使用在线创建 cabal 文件的指南成功创建了 Cabal 包。我已经构建了该软件包并在本地安装了它,工作正常。现在我想将它上传到Hackage。但是cabal upload需要一个.tar.gz文件。有大量的 Cabal 文档,但我找不到这个 .tar.gz 中应该包含什么内容,也找不到我应该如何创建它。

谁知道,或者知道我在哪里可以找到如何创建一个可以与cabal upload一起正常工作的.tar.gz?

The standard way to share a Haskell library with other programmers is to create a Cabal package and upload it to http://hackage.haskell.org. I've written a library I wish to share, and
I've successfully created a Cabal package using the guidelines online for creating cabal files. I've built the package and installed it locally—works fine. Now I want to upload it to Hackage. But cabal upload wants a .tar.gz file. There are reams of Cabal documentation, and I can't find what is supposed to go into this .tar.gz or how I'm supposed to create it.

Who knows, or knows where I can find out, how to create a .tar.gz that will work properly with cabal upload?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若沐 2024-09-03 20:58:13

来自wiki

由于代码是cabalized,我们可以直接使用 cabal-install 创建 tar 包(您也可以使用 runhaskell Setup.hs sdist,但您的系统上需要 tar 1):

$ cabal sdist
Building source dist for haq-0.0...
Source tarball created: dist/haq-0.0.tar.gz

这样做的优点是 Cabal 会进行更多检查,并确保 tarball 具有 HackageDB 期望的结构。请注意,它确实需要 LICENSE 文件存在。它打包构建项目所需的文件;要包含其他文件(例如上面示例中的 Test.hs 和我们的自述文件),我们需要将:

extra-source-files: Tests.hs README

添加到 .cabal 文件以包含所有内容。

From the wiki:

Since the code is cabalised, we can create a tarball with cabal-install directly (you can also use runhaskell Setup.hs sdist, but you need tar on your system 1):

$ cabal sdist
Building source dist for haq-0.0...
Source tarball created: dist/haq-0.0.tar.gz

This has the advantage that Cabal will do a bit more checking, and ensure that the tarball has the structure that HackageDB expects. Note that it does require the LICENSE file to exist. It packages up the files needed to build the project; to include other files (such as Test.hs in the above example, and our README), we need to add:

extra-source-files: Tests.hs README

to the .cabal file to have everything included.

得不到的就毁灭 2024-09-03 20:58:13

或者,如果您使用 darcs,

darcs dist

请注意 cabal sdist 只会选取 .cabal 文件中列出的文件,因此您可能需要在 下添加 README 等extra-source-files:

你可以检查你是否有一个有效的 tarball,用

cabal check

它运行 Hackage 将运行的相同测试。

Or if you're using darcs,

darcs dist

Note that cabal sdist will only pick up files listed in the .cabal file, so you might need to add READMEs etc under extra-source-files:

You can check you've a valid tarball with

cabal check

which runs the same tests that Hackage will run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文