megacoffee.net Gentoo overlay - legacy mirror
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-0.3.1.ebuild @ 136:4f080a258623
dev-vcs/kallithea: more config changes
author | Daniel Neugebauer <dneuge@energiequant.de> |
---|---|
date | Mon, 28 Mar 2016 15:56:07 +0200 |
parents | 702382d06f80 |
children | e08c1ff80cad |
comparison
equal
deleted
inserted
replaced
135:f77525122775 | 136:4f080a258623 |
---|---|
20 HOMEPAGE="https://kallithea-scm.org/" | 20 HOMEPAGE="https://kallithea-scm.org/" |
21 SRC_URI="https://pypi.python.org/packages/source/K/Kallithea/Kallithea-${PV}.tar.bz2" | 21 SRC_URI="https://pypi.python.org/packages/source/K/Kallithea/Kallithea-${PV}.tar.bz2" |
22 | 22 |
23 RDEPEND="dev-python/virtualenv" | 23 RDEPEND="dev-python/virtualenv" |
24 | 24 |
25 DEPEND="${RDEPEND}" | 25 DEPEND="${RDEPEND} \ |
26 app-arch/unzip \ | |
27 sys-apps/sed" | |
26 | 28 |
27 LICENSE="GPL-3" | 29 LICENSE="GPL-3" |
28 SLOT="0" | 30 SLOT="0" |
29 KEYWORDS="~amd64 ~x86" | 31 KEYWORDS="~amd64 ~x86" |
30 IUSE="" | 32 IUSE="" |
36 installConfigPath="/etc/kallithea" | 38 installConfigPath="/etc/kallithea" |
37 virtualenvActivationPath="bin/activate" | 39 virtualenvActivationPath="bin/activate" |
38 | 40 |
39 urlDocumentationSetup="http://kallithea.readthedocs.org/en/${PV}/setup.html" | 41 urlDocumentationSetup="http://kallithea.readthedocs.org/en/${PV}/setup.html" |
40 urlDocumentationRhodeCode="http://kallithea.readthedocs.org/en/${PV}/readme.html#converting-from-rhodecode" | 42 urlDocumentationRhodeCode="http://kallithea.readthedocs.org/en/${PV}/readme.html#converting-from-rhodecode" |
43 urlDocumentationMegacoffee="http://gentoo-overlay.megacoffee.net/s/docs-kallithea-apache-mod_wsgi" | |
41 | 44 |
42 pkg_setup() { | 45 pkg_setup() { |
43 # create user and group | 46 # create user and group |
44 enewgroup kallithea | 47 enewgroup kallithea |
45 enewuser kallithea -1 -1 "${installDataPath}" kallithea | 48 enewuser kallithea -1 -1 "${installDataPath}" kallithea |
96 unzip -d "${eggname}" tmp.extract.zip | 99 unzip -d "${eggname}" tmp.extract.zip |
97 rm tmp.extract.zip | 100 rm tmp.extract.zip |
98 fi | 101 fi |
99 done | 102 done |
100 | 103 |
101 # TODO: remove dummy config & directory | |
102 | |
103 # create config | 104 # create config |
104 mkdir "${realWorkDir}/etc" | 105 mkdir "${realWorkDir}/etc" |
105 cd "${realWorkDir}/etc" | 106 cd "${realWorkDir}/etc" |
106 paster make-config Kallithea production.ini || die "unable to create configuration file" | 107 paster make-config Kallithea production.ini || die "unable to create configuration file" |
107 | 108 |
108 # rewrite config to refer to correct default paths | 109 # rewrite config to refer to correct default paths |
109 sed -i -e "s/%(here)s\(\/\(tarballcache\|data\)\)/${installDataPath//\//\\/}\1/" production.ini | 110 sed -i -e "s/%(here)s\(\/\(tarballcache\|data\)\)/${installDataPath//\//\\/}\1/" production.ini |
110 sed -i -e "s/%(here)s\(\/kallithea.db\)/${installDataPath//\//\\/}\1/" production.ini | 111 sed -i -e "s/%(here)s\(\/kallithea.db\)/${installDataPath//\//\\/}\1/" production.ini |
111 | 112 |
112 # TODO: only log WARN by default? | 113 # rewrite config to only log from WARN level to "console" |
114 # By Kallithea defaults, handler_console logs everything from INFO level to "console". | |
115 # As mod_wsgi logs everything from "console" to error_log this results in a huge amount | |
116 # of unnecessary log entries which we would like to prevent. | |
117 # NOTE: As sed syntax is hard to read... this replacement rule is prefixed with an "address" which | |
118 # is being defined by two regexps, effectively restricting replacements just to the | |
119 # handler_console section of our ini file. | |
120 sed -i -e '/^\[handler_console\]/,/^\[/ s/level\s*=\s*INFO/level = WARN/' production.ini | |
121 | |
122 # rewrite config to disable debug mode | |
123 # By default, Kallithea uses debug = true which should *NOT* be used except during development. | |
124 # See: http://kallithea.readthedocs.org/en/0.3.1/usage/debugging.html | |
125 sed -i -e '/^\[DEFAULT\]/,/^\[/ s/\(debug\s*=\s*\)true/\1false/' production.ini | |
126 | |
127 ## (disabled, does not work from sandbox) | |
128 ## maintain system-unique variables from previous production.ini if available | |
129 #previousProductionConfig="${installConfigPath}/production.ini" | |
130 #if [ -e "${previousProductionConfig}" ]; then | |
131 # previousAppInstanceUUID="$(grep -oE '^\s*app_instance_uuid\s*=\s*[0-9a-f\-]+' /etc/kallithea/production.ini | cut -d'=' -f2 | tr -d ' ')" | |
132 # previousBeakerSessionSecret="$(grep -oE '^\s*beaker\.session\.secret\s*=\s*[0-9a-f\-]+' "${previousProductionConfig}" | cut -d'=' -f2 | tr -d ' ')" | |
133 # | |
134 # if [ ! -z "${previousAppInstanceUUID}" ]; then | |
135 # echo 'Transferring previous app instance UUID to new production.ini' | |
136 # sed -i -e "s/^\(\s*app_instance_uuid\s*=\s*\).*/\1${previousAppInstanceUUID}/" production.ini | |
137 # fi | |
138 # | |
139 # if [ ! -z "${previousBeakerSessionSecret}" ]; then | |
140 # echo 'Transferring previous Beaker session secret to new production.ini' | |
141 # sed -i -e "s/^\(\s*beaker\.session\.secret\s*=\s*\).*/\1${previousBeakerSessionSecret}/" production.ini | |
142 # fi | |
143 #fi | |
144 | |
145 # remove newly generated UUID and Beaker session secret from config | |
146 # as user should configure that instead and config diffs don't show | |
147 # unnecessary stuff | |
148 sed -i -e "s/^\(\s*app_instance_uuid\s*=\).*/#\1 (run uuidgen and insert the returned UUID here)/" production.ini | |
149 sed -i -e "s/^\(\s*beaker\.session\.secret\s*=\).*/#\1 (run uuidgen and insert the returned UUID here)/" production.ini | |
150 | |
151 # rename production.ini as it requires more configuration and is hard to read | |
152 mv production.ini production.ini.example | |
113 | 153 |
114 # rewrite virtualenv directory to later installation directory | 154 # rewrite virtualenv directory to later installation directory |
115 oldIFS="${IFS}" | 155 oldIFS="${IFS}" |
116 IFS=" | 156 IFS=" |
117 " | 157 " |
141 | 181 |
142 # install configuration files to /etc/kallithea | 182 # install configuration files to /etc/kallithea |
143 diropts -m750 -oroot -gkallithea | 183 diropts -m750 -oroot -gkallithea |
144 insopts -m640 -oroot -gkallithea | 184 insopts -m640 -oroot -gkallithea |
145 insinto "${installConfigPath}" | 185 insinto "${installConfigPath}" |
146 doins "${S}/etc/production.ini" | 186 doins "${S}/etc/production.ini.example" |
147 insopts -m644 -oroot -gkallithea | 187 insopts -m644 -oroot -gkallithea |
148 doins "${S}/etc/production.wsgi" | 188 doins "${S}/etc/production.wsgi" |
149 | 189 |
150 # create data directory | 190 # create data directory |
151 diropts -m2770 -okallithea -gkallithea | 191 diropts -m2770 -okallithea -gkallithea |
154 | 194 |
155 pkg_postinst() { | 195 pkg_postinst() { |
156 # 1 2 3 4 5 6 7 8 | 196 # 1 2 3 4 5 6 7 8 |
157 # 12345678901234567890123456789012345678901234567890123456789012345678901234567890 | 197 # 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
158 einfo "An example configuration file has already been created so you don't need to run" | 198 einfo "An example configuration file has already been created so you don't need to run" |
159 einfo "make-config again, see:" | 199 einfo "make-config again; please copy and edit carefully on first setup:" |
160 einfo " ${installConfigPath}/production.ini" | 200 einfo " cp -a ${installConfigPath}/production.ini.example ${installConfigPath}/production.ini" |
201 einfo " \$EDITOR ${installConfigPath}/production.ini" | |
202 einfo "" | |
203 einfo "After updates, please compare what has changed and copy any necessary changes:" | |
204 einfo " diff -u ${installConfigPath}/production.ini ${installConfigPath}/production.ini.example" | |
161 einfo "" | 205 einfo "" |
162 einfo "You still need to follow Kallithea's other setup steps according to the" | 206 einfo "You still need to follow Kallithea's other setup steps according to the" |
163 einfo "instructions at:" | 207 einfo "instructions at:" |
164 einfo " ${urlDocumentationSetup}" | 208 einfo " ${urlDocumentationSetup}" |
165 einfo "" | 209 einfo "" |
166 einfo "When doing so, please mind that Kallithea was installed into a Python virtual" | 210 einfo "When doing so, please mind that Kallithea was installed into a Python virtual" |
167 einfo "environment that has to be \"activated\" before it can be used. To do so," | 211 einfo "environment that has to be \"activated\" before it can be used. To do so," |
168 einfo "you will have to run a dedicated shell and initialize the environment by running" | 212 einfo "you will have to run a dedicated shell and initialize the environment by running" |
169 einfo "" | 213 einfo "" |
170 einfo " source ${installBasePath}/${virtualenvActivationPath}" | 214 einfo " source ${installBasePath}/${virtualenvActivationPath}" |
215 einfo "" | |
216 einfo "We altered the default config slightly. It may be best to have a look at our" | |
217 einfo "short example on how to setup hosting with Apache and mod_wsgi, even if you" | |
218 einfo "prefer another method of hosting Kallithea:" | |
219 einfo " ${urlDocumentationMegacoffee}" | |
171 einfo "" | 220 einfo "" |
172 #einfo "We can wrap those commands for you if you run (no prior activation needed):" | 221 #einfo "We can wrap those commands for you if you run (no prior activation needed):" |
173 #einfo " emerge --config =${CATEGORY}/${PF}" | 222 #einfo " emerge --config =${CATEGORY}/${PF}" |
174 #einfo "" | 223 #einfo "" |
175 einfo "Kallithea also provides a way to migrate your database if you are coming from" | 224 einfo "Kallithea also provides a way to migrate your database if you are coming from" |