1 |
hollow 08/02/22 13:44:42 |
2 |
|
3 |
Modified: webapp.eclass |
4 |
Log: |
5 |
add eclass debugging; remove redundant comments |
6 |
|
7 |
Revision Changes Path |
8 |
1.51 eclass/webapp.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.51&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.51&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?r1=1.50&r2=1.51 |
13 |
|
14 |
Index: webapp.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v |
17 |
retrieving revision 1.50 |
18 |
retrieving revision 1.51 |
19 |
diff -u -r1.50 -r1.51 |
20 |
--- webapp.eclass 22 Feb 2008 10:03:55 -0000 1.50 |
21 |
+++ webapp.eclass 22 Feb 2008 13:44:41 -0000 1.51 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2006 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.50 2008/02/22 10:03:55 hollow Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.51 2008/02/22 13:44:41 hollow Exp $ |
27 |
# |
28 |
# @ECLASS: webapp.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -23,9 +23,9 @@ |
31 |
|
32 |
INSTALL_CHECK_FILE="installed_by_webapp_eclass" |
33 |
|
34 |
-ETC_CONFIG="${ROOT}/etc/vhosts/webapp-config" |
35 |
-WEBAPP_CONFIG="${ROOT}/usr/sbin/webapp-config" |
36 |
-WEBAPP_CLEANER="${ROOT}/usr/sbin/webapp-cleaner" |
37 |
+ETC_CONFIG="${ROOT}etc/vhosts/webapp-config" |
38 |
+WEBAPP_CONFIG="${ROOT}usr/sbin/webapp-config" |
39 |
+WEBAPP_CLEANER="${ROOT}usr/sbin/webapp-cleaner" |
40 |
|
41 |
# ============================================================================== |
42 |
# INTERNAL FUNCTIONS |
43 |
@@ -34,6 +34,8 @@ |
44 |
# Load the config file /etc/vhosts/webapp-config |
45 |
# Supports both the old bash version, and the new python version |
46 |
webapp_read_config() { |
47 |
+ debug-print-function $FUNCNAME $* |
48 |
+ |
49 |
if has_version '>=app-admin/webapp-config-1.50'; then |
50 |
ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die "Could not read settings from webapp-config!" |
51 |
eval ${ENVVAR} |
52 |
@@ -44,6 +46,8 @@ |
53 |
|
54 |
# Check whether a specified file exists in the given directory (`.' by default) |
55 |
webapp_checkfileexists() { |
56 |
+ debug-print-function $FUNCNAME $* |
57 |
+ |
58 |
local my_prefix |
59 |
|
60 |
[ -n "${2}" ] && my_prefix="${2}/" || my_prefix= |
61 |
@@ -57,36 +61,35 @@ |
62 |
} |
63 |
|
64 |
webapp_check_installedat() { |
65 |
+ debug-print-function $FUNCNAME $* |
66 |
${WEBAPP_CONFIG} --show-installed -h localhost -d "${INSTALL_DIR}" 2> /dev/null |
67 |
} |
68 |
|
69 |
webapp_strip_appdir() { |
70 |
- local my_stripped="${1}" |
71 |
+ debug-print-function $FUNCNAME $* |
72 |
echo "${1}" | sed -e "s|${MY_APPDIR}/||g;" |
73 |
} |
74 |
|
75 |
webapp_strip_d() { |
76 |
+ debug-print-function $FUNCNAME $* |
77 |
echo "${1}" | sed -e "s|${D}||g;" |
78 |
} |
79 |
|
80 |
webapp_strip_cwd() { |
81 |
- local my_stripped="${1}" |
82 |
+ debug-print-function $FUNCNAME $* |
83 |
echo "${1}" | sed -e 's|/./|/|g;' |
84 |
} |
85 |
|
86 |
webapp_getinstalltype() { |
87 |
- # or are we upgrading? |
88 |
+ debug-print-function $FUNCNAME $* |
89 |
|
90 |
if ! use vhosts ; then |
91 |
- # we only run webapp-config if vhosts USE flag is not set |
92 |
- |
93 |
local my_output |
94 |
|
95 |
my_output="$(webapp_check_installedat)" |
96 |
|
97 |
if [ "${?}" = "0" ] ; then |
98 |
# something is already installed there |
99 |
- # |
100 |
# make sure it isn't the same version |
101 |
|
102 |
local my_pn="$(echo ${my_output} | awk '{ print $1 }')" |
103 |
@@ -120,6 +123,8 @@ |
104 |
# @DESCRIPTION: |
105 |
# Mark a file config-protected for a web-based application. |
106 |
webapp_configfile() { |
107 |
+ debug-print-function $FUNCNAME $* |
108 |
+ |
109 |
local m="" |
110 |
for m in "$@" ; do |
111 |
webapp_checkfileexists "${m}" "${D}" |
112 |
@@ -138,6 +143,8 @@ |
113 |
# Install a script that will run after a virtual copy is created, and |
114 |
# before a virtual copy has been removed. |
115 |
webapp_hook_script() { |
116 |
+ debug-print-function $FUNCNAME $* |
117 |
+ |
118 |
webapp_checkfileexists "${1}" |
119 |
|
120 |
elog "(hook) ${1}" |
121 |
@@ -150,6 +157,8 @@ |
122 |
# @DESCRIPTION: |
123 |
# Install a text file containing post-installation instructions. |
124 |
webapp_postinst_txt() { |
125 |
+ debug-print-function $FUNCNAME $* |
126 |
+ |
127 |
webapp_checkfileexists "${2}" |
128 |
|
129 |
elog "(info) ${2} (lang: ${1})" |
130 |
@@ -161,6 +170,8 @@ |
131 |
# @DESCRIPTION: |
132 |
# Install a text file containing post-upgrade instructions. |
133 |
webapp_postupgrade_txt() { |
134 |
+ debug-print-function $FUNCNAME $* |
135 |
+ |
136 |
webapp_checkfileexists "${2}" |
137 |
|
138 |
elog "(info) ${2} (lang: ${1})" |
139 |
@@ -174,6 +185,8 @@ |
140 |
# The ownership of the file is NOT set until the application is installed using |
141 |
# the webapp-config tool. If -R is given directories are handled recursively. |
142 |
webapp_serverowned() { |
143 |
+ debug-print-function $FUNCNAME $* |
144 |
+ |
145 |
local a="" |
146 |
local m="" |
147 |
if [ "${1}" = "-R" ]; then |
148 |
@@ -209,23 +222,22 @@ |
149 |
# used by default. Note: this function will automagically prepend $1 to the |
150 |
# front of your config file's name. |
151 |
webapp_server_configfile() { |
152 |
+ debug-print-function $FUNCNAME $* |
153 |
+ |
154 |
webapp_checkfileexists "${2}" |
155 |
|
156 |
- # sort out what the name will be of the config file |
157 |
+ # WARNING: |
158 |
+ # |
159 |
+ # do NOT change the naming convention used here without changing all |
160 |
+ # the other scripts that also rely upon these names |
161 |
|
162 |
local my_file |
163 |
- |
164 |
if [ -z "${3}" ]; then |
165 |
my_file="${1}-$(basename "${2}")" |
166 |
else |
167 |
my_file="${1}-${3}" |
168 |
fi |
169 |
|
170 |
- # warning: |
171 |
- # |
172 |
- # do NOT change the naming convention used here without changing all |
173 |
- # the other scripts that also rely upon these names |
174 |
- |
175 |
elog "(${1}) config file '${my_file}'" |
176 |
cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}" |
177 |
} |
178 |
@@ -238,30 +250,24 @@ |
179 |
# If a version is given the script should upgrade the database schema from |
180 |
# the given version to $PVR. |
181 |
webapp_sqlscript() { |
182 |
- webapp_checkfileexists "${2}" |
183 |
+ debug-print-function $FUNCNAME $* |
184 |
|
185 |
- # create the directory where this script will go |
186 |
- # |
187 |
- # scripts for specific database engines go into their own subdirectory |
188 |
- # just to keep things readable on the filesystem |
189 |
+ webapp_checkfileexists "${2}" |
190 |
|
191 |
if [ ! -d "${D}/${MY_SQLSCRIPTSDIR}/${1}" ]; then |
192 |
mkdir -p "${D}/${MY_SQLSCRIPTSDIR}/${1}" || die "unable to create directory ${D}/${MY_SQLSCRIPTSDIR}/${1}" |
193 |
fi |
194 |
|
195 |
- # warning: |
196 |
+ # WARNING: |
197 |
# |
198 |
# do NOT change the naming convention used here without changing all |
199 |
# the other scripts that also rely upon these names |
200 |
|
201 |
- # are we dealing with an 'upgrade'-type script? |
202 |
if [ -n "${3}" ]; then |
203 |
- # yes we are |
204 |
elog "(${1}) upgrade script from ${PN}-${PVR} to ${3}" |
205 |
cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" |
206 |
chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" |
207 |
else |
208 |
- # no, we are not |
209 |
elog "(${1}) create script for ${PN}-${PVR}" |
210 |
cp "${2}" "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql" |
211 |
chmod 600 "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql" |
212 |
@@ -273,6 +279,8 @@ |
213 |
# You need to call this function in src_install() BEFORE anything else has run. |
214 |
# For now we just create required webapp-config directories. |
215 |
webapp_src_preinst() { |
216 |
+ debug-print-function $FUNCNAME $* |
217 |
+ |
218 |
dodir "${MY_HTDOCSDIR}" |
219 |
dodir "${MY_HOSTROOTDIR}" |
220 |
dodir "${MY_CGIBINDIR}" |
221 |
@@ -295,6 +303,8 @@ |
222 |
# You need to call this function AFTER everything else has run in your custom |
223 |
# src_install(). |
224 |
webapp_src_install() { |
225 |
+ debug-print-function $FUNCNAME $* |
226 |
+ |
227 |
chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" |
228 |
chmod -R u-s "${D}/" |
229 |
chmod -R g-s "${D}/" |
230 |
@@ -322,7 +332,7 @@ |
231 |
# You need to call this function BEFORE anything else has run in your custom |
232 |
# pkg_setup(). |
233 |
webapp_pkg_setup() { |
234 |
- # add sanity checks here |
235 |
+ debug-print-function $FUNCNAME $* |
236 |
|
237 |
# special case - some ebuilds *do* need to overwride the SLOT |
238 |
if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then |
239 |
@@ -330,13 +340,11 @@ |
240 |
fi |
241 |
|
242 |
# pull in the shared configuration file |
243 |
- |
244 |
G_HOSTNAME="localhost" |
245 |
webapp_read_config |
246 |
|
247 |
# are we installing a webapp-config solution over the top of a |
248 |
# non-webapp-config solution? |
249 |
- |
250 |
if ! use vhosts ; then |
251 |
local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}" |
252 |
local my_output |
253 |
@@ -371,10 +379,11 @@ |
254 |
# You need to call this function AFTER everything else has run in your custom |
255 |
# pkg_postinst(). |
256 |
webapp_pkg_postinst() { |
257 |
+ debug-print-function $FUNCNAME $* |
258 |
+ |
259 |
webapp_read_config |
260 |
|
261 |
# sanity checks, to catch bugs in the ebuild |
262 |
- |
263 |
if [ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]; then |
264 |
eerror |
265 |
eerror "This ebuild did not call webapp_src_install() at the end" |
266 |
@@ -388,9 +397,6 @@ |
267 |
die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org" |
268 |
fi |
269 |
|
270 |
- # if 'vhosts' is not set in your USE flags, we install a copy of |
271 |
- # this application in ${ROOT}/var/www/localhost/htdocs/${PN}/ for you |
272 |
- |
273 |
if ! use vhosts ; then |
274 |
echo |
275 |
elog "vhosts USE flag not set - auto-installing using webapp-config" |
276 |
@@ -415,16 +421,11 @@ |
277 |
elog "Running ${my_cmd}" |
278 |
${my_cmd} |
279 |
|
280 |
- # run webapp-cleaner instead of emerge |
281 |
echo |
282 |
local cleaner="${WEBAPP_CLEANER} -p -C ${PN}" |
283 |
einfo "Running ${cleaner}" |
284 |
${cleaner} |
285 |
else |
286 |
- # vhosts flag is on |
287 |
- # |
288 |
- # let's tell the administrator what to do next |
289 |
- |
290 |
elog |
291 |
elog "The 'vhosts' USE flag is switched ON" |
292 |
elog "This means that Portage will not automatically run webapp-config to" |
293 |
@@ -444,9 +445,9 @@ |
294 |
# @DESCRIPTION: |
295 |
# This is the default pkg_prerm() for this eclass. If USE=vhosts is not set |
296 |
# remove all installed copies of this web application. Otherwise instruct the |
297 |
-# user to manually remove those copies. |
298 |
+# user to manually remove those copies. See bug #136959. |
299 |
webapp_pkg_prerm() { |
300 |
- # remove any virtual installs that there are |
301 |
+ debug-print-function $FUNCNAME $* |
302 |
|
303 |
local my_output |
304 |
local x |
305 |
@@ -457,7 +458,7 @@ |
306 |
return |
307 |
fi |
308 |
|
309 |
- if ! use vhosts ; then # remove any installed copies |
310 |
+ if ! use vhosts ; then |
311 |
|
312 |
for x in ${my_output} ; do |
313 |
[ -f ${x}/.webapp ] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp" |
314 |
@@ -465,7 +466,7 @@ |
315 |
${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} |
316 |
fi |
317 |
done |
318 |
- else # don't remove anything, but warn user. bug #136959 |
319 |
+ else |
320 |
|
321 |
ewarn "Don't forget to use webapp-config to remove any copies of" |
322 |
ewarn "${PN}-${PVR} installed in" |
323 |
|
324 |
|
325 |
|
326 |
-- |
327 |
gentoo-commits@l.g.o mailing list |