/[gentoo-x86]/eclass/webapp.eclass
Gentoo

Diff of /eclass/webapp.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.60 Revision 1.66
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.60 2008/03/04 18:41:43 hollow Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.66 2011/05/19 12:05:13 scarabeus Exp $
4# 4
5# @ECLASS: webapp.eclass 5# @ECLASS: webapp.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# web-apps@gentoo.org 7# web-apps@gentoo.org
8# @BLURB: functions for installing applications to run under a web server 8# @BLURB: functions for installing applications to run under a web server
9# @DESCRIPTION: 9# @DESCRIPTION:
10# The webapp eclass contains functions to handle web applications with 10# The webapp eclass contains functions to handle web applications with
11# webapp-config. Part of the implementation of GLEP #11 11# webapp-config. Part of the implementation of GLEP #11
12 12
13# @ECLASS-VARIABLE: WEBAPP_DEPEND
14# @DESCRIPTION:
15# An ebuild should use WEBAPP_DEPEND if a custom DEPEND needs to be built, most
16# notably in combination with WEBAPP_OPTIONAL.
17WEBAPP_DEPEND=">=app-admin/webapp-config-1.50.15"
18
13# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL 19# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL
14# @DESCRIPTION: 20# @DESCRIPTION:
15# An ebuild sets this to `yes' if an automatic installation and/or upgrade is 21# An ebuild sets this to `yes' if an automatic installation and/or upgrade is
16# not possible. The ebuild should overwrite pkg_postinst() and explain the 22# not possible. The ebuild should overwrite pkg_postinst() and explain the
17# reason for this BEFORE calling webapp_pkg_postinst(). 23# reason for this BEFORE calling webapp_pkg_postinst().
18[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
19 24
20# @ECLASS-VARIABLE: WEBAPP_OPTIONAL 25# @ECLASS-VARIABLE: WEBAPP_OPTIONAL
21# @DESCRIPTION: 26# @DESCRIPTION:
22# An ebuild sets this to `yes' to make webapp support optional, in which case 27# An ebuild sets this to `yes' to make webapp support optional, in which case
23# you also need to take care of USE-flags and dependencies. 28# you also need to take care of USE-flags and dependencies.
29
24if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then 30if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
31 [[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
25 SLOT="${PVR}" 32 SLOT="${PVR}"
26 DEPEND=">=app-admin/webapp-config-1.50.15" 33 DEPEND="${WEBAPP_DEPEND}"
27 RDEPEND="${DEPEND}" 34 RDEPEND="${DEPEND}"
28fi 35fi
29 36
30EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm 37EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
31 38
130# PUBLIC FUNCTIONS 137# PUBLIC FUNCTIONS
131# ============================================================================== 138# ==============================================================================
132 139
133# @FUNCTION: need_httpd 140# @FUNCTION: need_httpd
134# @DESCRIPTION: 141# @DESCRIPTION:
135# Call this function AFTER your ebuild's DEPEND line if any of the available 142# Call this function AFTER your ebuilds DEPEND line if any of the available
136# webservers are able to run this application. 143# webservers are able to run this application.
137need_httpd() { 144need_httpd() {
138 DEPEND="${DEPEND} 145 DEPEND="${DEPEND}
139 || ( virtual/httpd-basic virtual/httpd-cgi virtual/httpd-fastcgi )" 146 || ( virtual/httpd-basic virtual/httpd-cgi virtual/httpd-fastcgi )"
140} 147}
141 148
142# @FUNCTION: need_httpd_cgi 149# @FUNCTION: need_httpd_cgi
143# @DESCRIPTION: 150# @DESCRIPTION:
144# Call this function AFTER your ebuild's DEPEND line if any of the available 151# Call this function AFTER your ebuilds DEPEND line if any of the available
145# CGI-capable webservers are able to run this application. 152# CGI-capable webservers are able to run this application.
146need_httpd_cgi() { 153need_httpd_cgi() {
147 DEPEND="${DEPEND} 154 DEPEND="${DEPEND}
148 || ( virtual/httpd-cgi virtual/httpd-fastcgi )" 155 || ( virtual/httpd-cgi virtual/httpd-fastcgi )"
149} 156}
150 157
151# @FUNCTION: need_httpd_fastcgi 158# @FUNCTION: need_httpd_fastcgi
152# @DESCRIPTION: 159# @DESCRIPTION:
153# Call this function AFTER your ebuild's DEPEND line if any of the available 160# Call this function AFTER your ebuilds DEPEND line if any of the available
154# FastCGI-capabale webservers are able to run this application. 161# FastCGI-capabale webservers are able to run this application.
155need_httpd_fastcgi() { 162need_httpd_fastcgi() {
156 DEPEND="${DEPEND} 163 DEPEND="${DEPEND}
157 virtual/httpd-fastcgi" 164 virtual/httpd-fastcgi"
158} 165}
312# You need to call this function in src_install() BEFORE anything else has run. 319# You need to call this function in src_install() BEFORE anything else has run.
313# For now we just create required webapp-config directories. 320# For now we just create required webapp-config directories.
314webapp_src_preinst() { 321webapp_src_preinst() {
315 debug-print-function $FUNCNAME $* 322 debug-print-function $FUNCNAME $*
316 323
324 # sanity checks, to catch bugs in the ebuild
325 if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
326 eerror
327 eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
328 eerror "of the pkg_setup() function"
329 eerror
330 eerror "Please log a bug on http://bugs.gentoo.org"
331 eerror
332 eerror "You should use emerge -C to remove this package, as the"
333 eerror "installation is incomplete"
334 eerror
335 die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
336 fi
337
338 # Hint, see the webapp_read_config() function to find where these are
339 # defined.
317 dodir "${MY_HTDOCSDIR}" 340 dodir "${MY_HTDOCSDIR}"
318 dodir "${MY_HOSTROOTDIR}" 341 dodir "${MY_HOSTROOTDIR}"
319 dodir "${MY_CGIBINDIR}" 342 dodir "${MY_CGIBINDIR}"
320 dodir "${MY_ICONSDIR}" 343 dodir "${MY_ICONSDIR}"
321 dodir "${MY_ERRORSDIR}" 344 dodir "${MY_ERRORSDIR}"
406 # 429 #
407 # we used to just set a variable in the shell script, but we can 430 # we used to just set a variable in the shell script, but we can
408 # no longer rely on Portage calling both webapp_src_install() and 431 # no longer rely on Portage calling both webapp_src_install() and
409 # webapp_pkg_postinst() within the same shell process 432 # webapp_pkg_postinst() within the same shell process
410 touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}" 433 touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
411
412 # sanity checks, to catch bugs in the ebuild
413 if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
414 eerror
415 eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
416 eerror "of the pkg_setup() function"
417 eerror
418 eerror "Please log a bug on http://bugs.gentoo.org"
419 eerror
420 eerror "You should use emerge -C to remove this package, as the"
421 eerror "installation is incomplete"
422 eerror
423 die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
424 fi
425 434
426 chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" 435 chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
427 chmod -R u-s "${D}/" 436 chmod -R u-s "${D}/"
428 chmod -R g-s "${D}/" 437 chmod -R g-s "${D}/"
429 438

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.66

  ViewVC Help
Powered by ViewVC 1.1.20