如何创建合适的 .tar.gz 文件以与“cabal upload”一起使用?
与其他程序员共享 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自wiki:
由于代码是cabalized,我们可以直接使用 cabal-install 创建 tar 包(您也可以使用 runhaskell Setup.hs sdist,但您的系统上需要 tar 1):
这样做的优点是 Cabal 会进行更多检查,并确保 tarball 具有 HackageDB 期望的结构。请注意,它确实需要 LICENSE 文件存在。它打包构建项目所需的文件;要包含其他文件(例如上面示例中的 Test.hs 和我们的自述文件),我们需要将:
添加到 .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):
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:
to the .cabal file to have everything included.
或者,如果您使用 darcs,
请注意
cabal sdist
只会选取.cabal
文件中列出的文件,因此您可能需要在下添加 README 等extra-source-files:
你可以检查你是否有一个有效的 tarball,用
它运行 Hackage 将运行的相同测试。
Or if you're using darcs,
Note that
cabal sdist
will only pick up files listed in the.cabal
file, so you might need to add READMEs etc underextra-source-files:
You can check you've a valid tarball with
which runs the same tests that Hackage will run.