logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

mercurial-5.0.2.ebuild (3855B)


  1. # Copyright 1999-2019 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
  5. PYTHON_REQ_USE="threads(+)"
  6. inherit bash-completion-r1 elisp-common eutils distutils-r1 flag-o-matic
  7. DESCRIPTION="Scalable distributed SCM"
  8. HOMEPAGE="https://www.mercurial-scm.org/"
  9. SRC_URI="https://www.mercurial-scm.org/release/${P}.tar.gz"
  10. LICENSE="GPL-2+"
  11. SLOT="0"
  12. KEYWORDS="~amd64 ~x86"
  13. IUSE="+chg bugzilla emacs gpg test tk"
  14. RDEPEND="app-misc/ca-certificates
  15. dev-python/zstandard[${PYTHON_USEDEP}]
  16. bugzilla? ( dev-python/mysqlclient[${PYTHON_USEDEP}] )
  17. gpg? ( app-crypt/gnupg )
  18. tk? ( dev-lang/tk )"
  19. DEPEND="emacs? ( virtual/emacs )
  20. test? ( app-arch/unzip
  21. dev-python/pygments[${PYTHON_USEDEP}] )"
  22. SITEFILE="70${PN}-gentoo.el"
  23. # Too many tests fail #608720
  24. RESTRICT="test"
  25. PATCHES=(
  26. "${FILESDIR}/${PN}-3.0.1-po_fixes.patch"
  27. "${FILESDIR}/${PN}-4.8.1-unbundle_zstd.patch"
  28. )
  29. python_prepare_all() {
  30. # fix up logic that won't work in Gentoo Prefix (also won't outside in
  31. # certain cases), bug #362891
  32. sed -i -e 's:xcodebuild:nocodebuild:' setup.py || die
  33. # Don't use bundled zstandard (#666972)
  34. rm -r contrib/python-zstandard || die
  35. distutils-r1_python_prepare_all
  36. export HGPYTHON3=1 # https://www.mercurial-scm.org/wiki/Python3
  37. }
  38. python_configure_all() {
  39. strip-flags -ftracer -ftree-vectorize
  40. # Note: make it impl-conditional if py3 is supported
  41. append-flags -fno-strict-aliasing
  42. "${PYTHON}" setup.py build_mo || die
  43. }
  44. python_compile_all() {
  45. rm -r contrib/win32 || die
  46. if use chg; then
  47. emake -C contrib/chg
  48. fi
  49. if use emacs; then
  50. cd contrib || die
  51. elisp-compile mercurial.el || die "elisp-compile failed!"
  52. fi
  53. }
  54. python_install_all() {
  55. distutils-r1_python_install_all
  56. newbashcomp contrib/bash_completion hg
  57. insinto /usr/share/zsh/site-functions
  58. newins contrib/zsh_completion _hg
  59. rm -f doc/*.?.txt
  60. dodoc CONTRIBUTORS
  61. cp hgweb*.cgi "${ED}"/usr/share/doc/${PF}/ || die
  62. dobin hgeditor
  63. dobin contrib/hgk
  64. python_foreach_impl python_doscript contrib/hg-ssh
  65. if use emacs; then
  66. elisp-install ${PN} contrib/mercurial.el* || die "elisp-install failed!"
  67. elisp-site-file-install "${FILESDIR}"/${SITEFILE}
  68. fi
  69. local RM_CONTRIB=( hgk hg-ssh bash_completion zsh_completion plan9 *.el )
  70. if use chg; then
  71. dobin contrib/chg/chg
  72. doman contrib/chg/chg.1
  73. RM_CONTRIB+=( chg )
  74. fi
  75. for f in ${RM_CONTRIB[@]}; do
  76. rm -r contrib/${f} || die
  77. done
  78. dodoc -r contrib
  79. docompress -x /usr/share/doc/${PF}/contrib
  80. doman doc/*.?
  81. insinto /etc/mercurial/hgrc.d
  82. doins "${FILESDIR}/cacerts.rc"
  83. # symlink to system zstd
  84. local sitedir=$(python_get_sitedir)
  85. dosym ../zstd.so "${sitedir#${EPREFIX}}"/${PN}/zstd.so
  86. }
  87. src_test() {
  88. pushd tests &>/dev/null || die
  89. rm -rf *svn* # Subversion tests fail with 1.5
  90. rm -f test-archive* # Fails due to verbose tar output changes
  91. rm -f test-convert-baz* # GNU Arch baz
  92. rm -f test-convert-cvs* # CVS
  93. rm -f test-convert-darcs* # Darcs
  94. rm -f test-convert-git* # git
  95. rm -f test-convert-mtn* # monotone
  96. rm -f test-convert-tla* # GNU Arch tla
  97. #rm -f test-doctest* # doctest always fails with python 2.5.x
  98. rm -f test-largefiles* # tends to time out
  99. popd &>/dev/null || die
  100. distutils-r1_src_test
  101. }
  102. python_test() {
  103. local TEST_DIR
  104. rm -rf "${TMPDIR}"/test
  105. distutils_install_for_testing
  106. cd tests || die
  107. "${PYTHON}" run-tests.py --verbose \
  108. --tmpdir="${TMPDIR}"/test \
  109. --with-hg="${TEST_DIR}"/scripts/hg \
  110. || die "Tests fail with ${EPYTHON}"
  111. }
  112. pkg_postinst() {
  113. use emacs && elisp-site-regen
  114. elog "If you want to convert repositories from other tools using convert"
  115. elog "extension please install correct tool:"
  116. elog " dev-vcs/cvs"
  117. elog " dev-vcs/darcs"
  118. elog " dev-vcs/git"
  119. elog " dev-vcs/monotone"
  120. elog " dev-vcs/subversion"
  121. }
  122. pkg_postrm() {
  123. use emacs && elisp-site-regen
  124. }