如何将我的 Haskell 包的文档放到 Hackage 上?
How do I get documentation for my Haskell package onto Hackage?
UPDATE: This question is now out of date. Hackage now uses Haskell
version 7.10.2 to build, so the following failure does not
occur. The change also appears to have broken some of the scripts
mentioned in the answers.
如何将我的 Haskell 包的文档放到 Hackage 上?
我知道 Hackage 会构建它们的内容,但我收到一个错误
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: MyPackage-0.1.0.2 (user goal)
next goal: base (dependency of MyPackage-0.1.0.2)
rejecting: base-4.7.0.1/installed-e4b... (conflict: MyPackage => base>=4.8 &&
<4.9)
rejecting: base-4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0,
4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1,
4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires
installed instance)
Dependency tree exhaustively searched.
我无法降低我的包的要求(这似乎是自动构建的障碍)并且我看到一些包说 "Docs uploaded by user"。然而,任何构建尝试都失败了(见下文。)
如何将我的 Haskell 包的文档上传到 Hackage?特别是,我需要做什么才能自己上传?
$ cp -R ./dist/doc/html/MyPackage/ MyPackage-0.1.0.2-docs
$ tar cvzf --format=ustar -f MyPackage-0.1.0.2-docs.tar.gz MyPackage-0.1.0.2-docs
$ curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary '@MyPackage-0.1.0.2-docs.tar.gz' 'https://hackage.haskell.org/package/MyPackage-0.1.0.2/docs' -u 'Rax'
但得到
Invalid documentation tarball: File in tar archive is not in the
expected directory 'MyPackage-0.1.0.2-docs'
name: MyPackage
version: 0.1.0.2
license: BSD3
license-file: LICENSE
-- copyright:
category: Development
build-type: Simple
-- extra-source-files:
cabal-version: >= 1.22.1.1
library
-- default-extensions: Trustworthy
exposed-modules: MyMod.A,
MyMod.A.B
other-modules: MyMod.C
-- other-extensions:
build-depends: base >= 4.8.1.0 && <4.9,
containers >= 0.5.5.1,
split >= 0.2.2,
MissingH >= 1.3.0.1
-- hs-source-dirs:
default-language: Haskell2010
我也尝试了下面链接的几个脚本的我自己的版本,但得到了同样的错误:
#!/bin/bash
cabal haddock --hyperlink-source --html-location='/package/$pkg-$version/docs' --contents-location='/package/$pkg'
S=$?
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
DDIR="--docs"
cp -r "" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
if [ "${CS}" -eq "0" ]; then
echo "Uploading to Hackage…"
curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" --digest --netrc "https://hackage.haskell.org/package/-/docs"
exit $?
else
echo "Error when packaging the documentation"
exit $CS
fi
else
echo "Error when trying to build the package."
exit $S
fi
我用
调用
myscript MyPackage 0.1.0.2
但得到同样的错误。
您的图书馆需要 base >= 4.8.1.0
吗?
这就是问题所在 - Hackage 正在尝试使用与您的 cabal 文件冲突的 base == 4.7.0.1
。
我会看看你是否可以用 Hackage 正在使用的基础构建你的库。
将文档上传到自己 Hackage 的一些链接:
即使这些文档建立在黑客攻击的基础上,它们也需要一些时间才能出现,并且在某些时候它们会被破坏很长一段时间。我习惯于使用此处描述的 neil
工具来完成此操作:
http://neilmitchell.blogspot.si/2014/10/fixing-haddock-docs-on-hackage.html
我首先安装 neil(在我磁盘上的另一个沙盒中),然后在您的库的文件夹中:
neil docs --username=YourHackageUsername
它会为您处理所有细节!
UPDATE: This question is now out of date. Hackage now uses Haskell version 7.10.2 to build, so the following failure does not occur. The change also appears to have broken some of the scripts mentioned in the answers.
如何将我的 Haskell 包的文档放到 Hackage 上?
我知道 Hackage 会构建它们的内容,但我收到一个错误
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: MyPackage-0.1.0.2 (user goal)
next goal: base (dependency of MyPackage-0.1.0.2)
rejecting: base-4.7.0.1/installed-e4b... (conflict: MyPackage => base>=4.8 &&
<4.9)
rejecting: base-4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0,
4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1,
4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires
installed instance)
Dependency tree exhaustively searched.
我无法降低我的包的要求(这似乎是自动构建的障碍)并且我看到一些包说 "Docs uploaded by user"。然而,任何构建尝试都失败了(见下文。)
如何将我的 Haskell 包的文档上传到 Hackage?特别是,我需要做什么才能自己上传?
$ cp -R ./dist/doc/html/MyPackage/ MyPackage-0.1.0.2-docs
$ tar cvzf --format=ustar -f MyPackage-0.1.0.2-docs.tar.gz MyPackage-0.1.0.2-docs
$ curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary '@MyPackage-0.1.0.2-docs.tar.gz' 'https://hackage.haskell.org/package/MyPackage-0.1.0.2/docs' -u 'Rax'
但得到
Invalid documentation tarball: File in tar archive is not in the expected directory 'MyPackage-0.1.0.2-docs'
name: MyPackage
version: 0.1.0.2
license: BSD3
license-file: LICENSE
-- copyright:
category: Development
build-type: Simple
-- extra-source-files:
cabal-version: >= 1.22.1.1
library
-- default-extensions: Trustworthy
exposed-modules: MyMod.A,
MyMod.A.B
other-modules: MyMod.C
-- other-extensions:
build-depends: base >= 4.8.1.0 && <4.9,
containers >= 0.5.5.1,
split >= 0.2.2,
MissingH >= 1.3.0.1
-- hs-source-dirs:
default-language: Haskell2010
我也尝试了下面链接的几个脚本的我自己的版本,但得到了同样的错误:
#!/bin/bash
cabal haddock --hyperlink-source --html-location='/package/$pkg-$version/docs' --contents-location='/package/$pkg'
S=$?
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
DDIR="--docs"
cp -r "" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
if [ "${CS}" -eq "0" ]; then
echo "Uploading to Hackage…"
curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" --digest --netrc "https://hackage.haskell.org/package/-/docs"
exit $?
else
echo "Error when packaging the documentation"
exit $CS
fi
else
echo "Error when trying to build the package."
exit $S
fi
我用
调用myscript MyPackage 0.1.0.2
但得到同样的错误。
您的图书馆需要 base >= 4.8.1.0
吗?
这就是问题所在 - Hackage 正在尝试使用与您的 cabal 文件冲突的 base == 4.7.0.1
。
我会看看你是否可以用 Hackage 正在使用的基础构建你的库。
将文档上传到自己 Hackage 的一些链接:
即使这些文档建立在黑客攻击的基础上,它们也需要一些时间才能出现,并且在某些时候它们会被破坏很长一段时间。我习惯于使用此处描述的 neil
工具来完成此操作:
http://neilmitchell.blogspot.si/2014/10/fixing-haddock-docs-on-hackage.html
我首先安装 neil(在我磁盘上的另一个沙盒中),然后在您的库的文件夹中:
neil docs --username=YourHackageUsername
它会为您处理所有细节!