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

comparison dev-vcs/kallithea/kallithea-9999.ebuild @ 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
comparison
equal deleted inserted replaced
128:507516b40917 129:4a630613e8cd
4 EAPI="2" 4 EAPI="2"
5 PYTHON_DEPEND="2" 5 PYTHON_DEPEND="2"
6 SUPPORT_PYTHON_ABIS="1" 6 SUPPORT_PYTHON_ABIS="1"
7 7
8 inherit mercurial 8 inherit mercurial
9 inherit user
9 10
10 DESCRIPTION="a web-based frontend and middleware to Mercurial and Git repositories" 11 DESCRIPTION="a web-based frontend and middleware to Mercurial and Git repositories"
11 HOMEPAGE="https://kallithea-scm.org/" 12 HOMEPAGE="https://kallithea-scm.org/"
12 13
13 #EHG_REPO_URI="https://kallithea-scm.org/repos/kallithea" 14 #EHG_REPO_URI="https://kallithea-scm.org/repos/kallithea"
22 KEYWORDS="~amd64 ~x86" 23 KEYWORDS="~amd64 ~x86"
23 IUSE="" 24 IUSE=""
24 25
25 RESTRICT_PYTHON_ABIS="3.*" 26 RESTRICT_PYTHON_ABIS="3.*"
26 27
28 installDataPath="/var/lib/kallithea"
27 installBasePath="/opt/kallithea" 29 installBasePath="/opt/kallithea"
28 virtualenvActivationPath="bin/activate" 30 virtualenvActivationPath="bin/activate"
31
32 pkg_setup() {
33 # create user and group
34 enewgroup kallithea
35 enewuser kallithea -1 -1 "${installDataPath}" kallithea
36 }
29 37
30 src_compile() { 38 src_compile() {
31 # not really compiling anything 39 # not really compiling anything
32 40
33 realWorkDir=$(pwd) 41 realWorkDir=$(pwd)
40 48
41 # WORKAROUND: 49 # WORKAROUND:
42 # pylonshq.com is dead, remove from config 50 # pylonshq.com is dead, remove from config
43 sed -e 's/\(find_links\s*=\s*http:\/\/www.pylonshq.com\/\)/;\1/' -i setup.cfg 51 sed -e 's/\(find_links\s*=\s*http:\/\/www.pylonshq.com\/\)/;\1/' -i setup.cfg
44 52
53 # WORKAROUND:
54 # if we don't install anyjson via PIP we will get a sandbox violation on second run
55 # (after fixing pylonshq.com for Pylons EGG-INFO)
56 # see: https://groups.google.com/forum/#!msg/rhodecode/agjXi2JeDZQ/LzFJ6EAsk9AJ
57 pip install 'anyjson>=0.3.1'
58
45 # perform automatic installation, includes dependencies 59 # perform automatic installation, includes dependencies
46 echo 60 echo
47 echo "===> output by Kallithea's setup.py" 61 echo "===> output by Kallithea's setup.py"
48 python setup.py install || die "Automatic installation failed, please check above output." 62 python setup.py install
63 retval=$?
49 echo "<=== Kallithea's setup.py is done, resuming ebuild code" 64 echo "<=== Kallithea's setup.py is done, resuming ebuild code"
50 echo 65 echo
66
67 # WORKAROUND:
68 # pylonshq.com may still have been tried to be accessed and failed
69 # check if that's the case and retry with a patched egg info file
70 if [ ${retval} -ne 0 ]; then
71 pylonsPath="${realWorkDir}/dist/v/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg"
72 #if [ ! -e "${pylonsPath}/pylons" ] && [ -e "${pylonsPath}/EGG-INFO" ]; then
73 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
74 # gnoar... it really smells like pylonshq.com...
75 sed -e 's#^http://www.pylonshq.com/.*##' -i "${pylonsPath}/EGG-INFO/dependency_links.txt"
76
77 # prepare to try again (sandbox violation if not done)
78 # TODO: check if still required
79 source /etc/profile
80 cd "${realWorkDir}"
81 source "dist/v/${virtualenvActivationPath}"
82
83 echo "Retrying installation with removed pylonshq.com URL..."
84 echo
85 echo "===> output by Kallithea's setup.py"
86 python setup.py install || die "Automatic installation failed, please check above output. (failed after fixing Pylons dependency URL)"
87 echo "<=== Kallithea's setup.py is done, resuming ebuild code"
88 else
89 # some other error on first run
90 die "Automatic installation failed, please check above output. (failed on first try)"
91 fi
92 fi
93 echo
94
95 # create config
96 mkdir "${realWorkDir}/etc"
97 cd "${realWorkDir}/etc"
98 paster make-config Kallithea production.ini || die "unable to create configuration file"
51 99
52 # rewrite virtualenv directory to later installation directory 100 # rewrite virtualenv directory to later installation directory
53 oldIFS="${IFS}" 101 oldIFS="${IFS}"
54 IFS=" 102 IFS="
55 " 103 "
64 112
65 src_install() { 113 src_install() {
66 # QA: no need to have anything world-writable... 114 # QA: no need to have anything world-writable...
67 chmod o-w -R dist/v/lib/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info 115 chmod o-w -R dist/v/lib/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info
68 116
69 # just copy the virtualenv directory to /opt/kallithea 117 # install production.ini in /etc/kallithea
118 into /etc/kallithea
119 doins "${S}/etc/production.ini"
120
121 # just copy the remaining virtualenv directory to /opt/kallithea
70 dodir /opt 122 dodir /opt
71 cp -aR "${S}/dist/v" "${D}${installBasePath}" 123 cp -aR "${S}/dist/v" "${D}${installBasePath}"
124
125 # create data directory
126 diropts -m2770 -okallithea -gkallithea
127 dodir "${installDataPath}"
72 } 128 }
73 129
74 pkg_postinst() { 130 pkg_postinst() {
75 # 1 2 3 4 5 6 7 8 131 # 1 2 3 4 5 6 7 8
76 # 12345678901234567890123456789012345678901234567890123456789012345678901234567890 132 # 12345678901234567890123456789012345678901234567890123456789012345678901234567890
106 IFS=" 162 IFS="
107 " 163 "
108 164
109 # 1 2 3 4 5 6 7 8 165 # 1 2 3 4 5 6 7 8
110 # 12345678901234567890123456789012345678901234567890123456789012345678901234567890 166 # 12345678901234567890123456789012345678901234567890123456789012345678901234567890
167 echo
111 echo "===============================================================================" 168 echo "==============================================================================="
112 echo 169 echo
113 echo "Your options:" 170 echo "Your options:"
114 echo 171 echo
115 echo " 1) create production config from template (paster make-config ...)" 172 echo " 1) create production config from template (paster make-config ...)"
118 echo " This will also ask for repository location and create an admin account." 175 echo " This will also ask for repository location and create an admin account."
119 echo " 0) quit" 176 echo " 0) quit"
120 echo " Kallithea should be able to run now, check documentation for more options" 177 echo " Kallithea should be able to run now, check documentation for more options"
121 echo " such as setting up a task queue or full text search if you need it." 178 echo " such as setting up a task queue or full text search if you need it."
122 echo 179 echo
180
181 echo "TERM is ${TERM}"
123 182
124 while [[ ! "${choice}" =~ ^[0-3]$ ]]; do 183 while [[ ! "${choice}" =~ ^[0-3]$ ]]; do
125 echo -n "Your choice? " 184 echo -n "Your choice? "
126 choice=$(my_read_line) 185 choice=$(my_read_line)
127 done 186 done
168 fi 227 fi
169 228
170 # terminal and shell need a reset or editor will be screwed up 229 # terminal and shell need a reset or editor will be screwed up
171 source /etc/profile 230 source /etc/profile
172 reset 231 reset
232 stty sane
173 233
174 # open editor 234 # open editor
175 if [[ "${EDITOR}" != "" ]] && [ -e "${EDITOR}" ]; then 235 if [[ "${EDITOR}" != "" ]] && [ -e "${EDITOR}" ]; then
176 ${EDITOR} "${iniPath}" 236 TERM="xterm" ${EDITOR} "${iniPath}"
177 else 237 else
178 nano -w "${iniPath}" 238 TERM="xterm" nano -w "${iniPath}"
179 fi 239 fi
180 240
181 # we better reset again... 241 # we better reset again...
182 source /etc/profile 242 source /etc/profile
183 reset 243 reset
244 stty sane
184 ;; 245 ;;
185 246
186 *) echo "invalid choice ${choice}" 247 *) echo "invalid choice ${choice}"
187 ;; 248 ;;
188 esac 249 esac