# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apps/trac-git/trac-git-8215.ebuild,v 1.2 2010/07/05 11:00:44 hollow Exp $

EAPI="2"
PYTHON_DEPEND="2"
SUPPORT_PYTHON_ABIS="1"
RESTRICT_PYTHON_ABIS="3.*"

inherit distutils git

EGIT_REPO_URI="git://github.com/dr4Ke/TracGitosisPlugin.git"
DESCRIPTION="partial gitosis administration for Trac"
HOMEPAGE="http://trac-hacks.org/wiki/TracGitosisPlugin"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE=""

DEPEND="dev-python/setuptools"
RDEPEND=">=www-apps/trac-0.12
	|| ( dev-vcs/gitosis dev-vcs/gitosis-gentoo )"

src_prepare() {
	git_src_prepare
	cp -Rv 0.11/* .
	distutils_src_prepare
}

pkg_postinst() {
	distutils_pkg_postinst
	elog "To enable the GitosisPlugin plugin in your Trac environments, you have to add:"
	elog "	[components]"
	elog "	# for plugin version 0.11.0.1+"
	elog "	tracgitosis.* = enabled"
	elog ""
	elog "to your trac.ini files."
	elog ""
	elog "You also have to create a new gitosis-admin user for trac"
	elog ""
	elog "	Create the key pair without passphrase"
	elog "	mkdir /var/www/.ssh"
	elog "	ssh-keygen -f /var/www/.ssh/id_rsa"
	elog ""
	elog "	Connect to the server hosting gitosis once to validate the server identity"
	elog "	ssh -i /var/www/.ssh/id_rsa -o UserKnownHostsFile=/var/www/.ssh/known_hosts <git_user>@<git_server>"
	elog ""
	elog "	Give this directory to the user running Trac (here: apache)"
	elog "	chown -Rh apache.apache /var/www/.ssh"
}