logo

overlay

My (experimental) gentoo overlay

mercurial-5.0.ebuild (4042B)


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