We have moved to Git. This repository is only provided for compatibility with old installations. Learn how to migrate your installation here.

changeset 129:4a630613e8cd

Kallithea: installation fixed when using a proxy, moving config creation to default install and creating user and directories
author Daniel Neugebauer <dneuge@energiequant.de>
date Sun, 03 Aug 2014 23:23:03 +0200
parents 507516b40917
children 2ce94546a682
files dev-vcs/kallithea/Manifest dev-vcs/kallithea/kallithea-9999.ebuild
diffstat 2 files changed, 66 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dev-vcs/kallithea/Manifest	Sun Aug 03 19:24:42 2014 +0200
+++ b/dev-vcs/kallithea/Manifest	Sun Aug 03 23:23:03 2014 +0200
@@ -1,2 +1,2 @@
-EBUILD kallithea-9999.ebuild 5830 SHA256 324756e05fbea408589fbcd8c9f71bdfa0573567ec7bd16aeddae8001c05a938 SHA512 0df6ff4566ed81b93a71879638df8a8070ba6c13bc55e83a25449dc9337aaed508c3e759db8b773f405d0667ee364fb92c5024a20df70a62ecc3675e8a3f2305 WHIRLPOOL d092f9b1363cfcd2f8eefd4daacb5bb10b1736aac7f9ede8a9baf3128468a2763a720aa5bdbb0b1b44333b6ee4d281c3b40952d536c8336f84b3fea00aabe9df
+EBUILD kallithea-9999.ebuild 7987 SHA256 9a4e391799515e322be44b25a24d5a693d006ebfb28450631c3c2bb92d00ec8e SHA512 60c40bb6486ce15e5d18780dbfe5f70783d5002894b323ca6bab66bd75f1eab1fbcd581e76100b78f81c60fdb58fbe5a40ab804026fa383021a96ec149cf5583 WHIRLPOOL e99fda169f0dfd30aa9928eb96b3230f6af17798cc3bc392b65d23c17ade3c696dbd9407f2237da79baa57063953dc5d7c22d1cd6803f34f0b53f2cc3ffda45b
 MISC kallithea-test.sh 603 SHA256 4d0ab7e309ea72d79691c903ed66de0c68845244a04728d93d466ce3e243ce61 SHA512 350b5eee94f0ee5cafac0b7254c8e0b61620686694bb068d6072c85edf4f6724057294e9f95e2f00df0b0a96a1cfc1553cf0790f4a1e64342dcb574ced57783c WHIRLPOOL fa671b48d21f25367f8653a825c9bcb1b196369d0d8d1b6ba6d1d926b835e289be2554ef365954dfe2af04d4400db0a8c7bff6f5a5551c803c38fdf09357a4dc
--- a/dev-vcs/kallithea/kallithea-9999.ebuild	Sun Aug 03 19:24:42 2014 +0200
+++ b/dev-vcs/kallithea/kallithea-9999.ebuild	Sun Aug 03 23:23:03 2014 +0200
@@ -6,6 +6,7 @@
 SUPPORT_PYTHON_ABIS="1"
 
 inherit mercurial
+inherit user
 
 DESCRIPTION="a web-based frontend and middleware to Mercurial and Git repositories"
 HOMEPAGE="https://kallithea-scm.org/"
@@ -24,9 +25,16 @@
 
 RESTRICT_PYTHON_ABIS="3.*"
 
+installDataPath="/var/lib/kallithea"
 installBasePath="/opt/kallithea"
 virtualenvActivationPath="bin/activate"
 
+pkg_setup() {
+	# create user and group
+	enewgroup kallithea
+	enewuser kallithea -1 -1 "${installDataPath}" kallithea 
+}
+
 src_compile() {
 	# not really compiling anything
 	
@@ -42,13 +50,53 @@
 	# pylonshq.com is dead, remove from config
 	sed -e 's/\(find_links\s*=\s*http:\/\/www.pylonshq.com\/\)/;\1/' -i setup.cfg
 	
+	# WORKAROUND:
+	# if we don't install anyjson via PIP we will get a sandbox violation on second run
+	# (after fixing pylonshq.com for Pylons EGG-INFO)
+	# see: https://groups.google.com/forum/#!msg/rhodecode/agjXi2JeDZQ/LzFJ6EAsk9AJ
+	pip install 'anyjson>=0.3.1'
+	
 	# perform automatic installation, includes dependencies
 	echo
 	echo "===> output by Kallithea's setup.py"
-	python setup.py install || die "Automatic installation failed, please check above output."
+	python setup.py install
+	retval=$?
 	echo "<=== Kallithea's setup.py is done, resuming ebuild code"
 	echo
 	
+	# WORKAROUND:
+	# pylonshq.com may still have been tried to be accessed and failed
+	# check if that's the case and retry with a patched egg info file
+	if [ ${retval} -ne 0 ]; then
+		pylonsPath="${realWorkDir}/dist/v/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg"
+		#if [ ! -e "${pylonsPath}/pylons" ] && [ -e "${pylonsPath}/EGG-INFO" ]; then
+		if [ ! -e "${realWorkDir}/dist/v/lib/python2.7/site-packages/pylons" ] && [ -e "${realWorkDir}/dist/v/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/EGG-INFO" ]; then
+			# gnoar... it really smells like pylonshq.com...
+			sed -e 's#^http://www.pylonshq.com/.*##' -i "${pylonsPath}/EGG-INFO/dependency_links.txt"
+			
+			# prepare to try again (sandbox violation if not done)
+			# TODO: check if still required
+			source /etc/profile
+			cd "${realWorkDir}"
+			source "dist/v/${virtualenvActivationPath}"
+			
+			echo "Retrying installation with removed pylonshq.com URL..."
+			echo
+			echo "===> output by Kallithea's setup.py"
+			python setup.py install || die "Automatic installation failed, please check above output. (failed after fixing Pylons dependency URL)"
+			echo "<=== Kallithea's setup.py is done, resuming ebuild code"
+		else
+			# some other error on first run
+			die "Automatic installation failed, please check above output. (failed on first try)"
+		fi
+	fi
+	echo
+	
+	# create config
+	mkdir "${realWorkDir}/etc"
+	cd "${realWorkDir}/etc"
+	paster make-config Kallithea production.ini || die "unable to create configuration file"
+	
 	# rewrite virtualenv directory to later installation directory
 	oldIFS="${IFS}"
 	IFS="
@@ -66,9 +114,17 @@
 	# QA: no need to have anything world-writable...
 	chmod o-w -R dist/v/lib/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info
 	
-	# just copy the virtualenv directory to /opt/kallithea
+	# install production.ini in /etc/kallithea
+	into /etc/kallithea
+	doins "${S}/etc/production.ini"
+	
+	# just copy the remaining virtualenv directory to /opt/kallithea
 	dodir /opt
 	cp -aR "${S}/dist/v" "${D}${installBasePath}"
+
+	# create data directory
+	diropts -m2770 -okallithea -gkallithea
+	dodir "${installDataPath}"
 }
 
 pkg_postinst() {
@@ -108,6 +164,7 @@
 	
 	#              1         2         3         4         5         6         7         8
 	#     12345678901234567890123456789012345678901234567890123456789012345678901234567890
+	echo
 	echo "==============================================================================="
 	echo
 	echo "Your options:"
@@ -121,6 +178,8 @@
 	echo "     such as setting up a task queue or full text search if you need it."
 	echo
 	
+	echo "TERM is ${TERM}"
+	
 	while [[ ! "${choice}" =~ ^[0-3]$ ]]; do
 		echo -n "Your choice? "
 		choice=$(my_read_line)
@@ -170,17 +229,19 @@
 				# terminal and shell need a reset or editor will be screwed up
 				source /etc/profile
 				reset
+				stty sane
 				
 				# open editor
 				if [[ "${EDITOR}" != "" ]] && [ -e "${EDITOR}" ]; then
-					${EDITOR} "${iniPath}"
+					TERM="xterm" ${EDITOR} "${iniPath}"
 				else
-					nano -w "${iniPath}"
+					TERM="xterm" nano -w "${iniPath}"
 				fi
 
 				# we better reset again...
 				source /etc/profile
 				reset
+				stty sane
 				;;
 			
 			*)	echo "invalid choice ${choice}"