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

Diff of /eclass/webapp.eclass

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

Revision 1.59 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.59 2008/02/23 23:54:40 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().
24
25# @ECLASS-VARIABLE: WEBAPP_OPTIONAL
26# @DESCRIPTION:
27# An ebuild sets this to `yes' to make webapp support optional, in which case
28# you also need to take care of USE-flags and dependencies.
29
30if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
18[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts" 31 [[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
19
20SLOT="${PVR}" 32 SLOT="${PVR}"
21DEPEND=">=app-admin/webapp-config-1.50.15" 33 DEPEND="${WEBAPP_DEPEND}"
22RDEPEND="${DEPEND}" 34 RDEPEND="${DEPEND}"
35fi
23 36
24EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm 37EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
25 38
26INSTALL_DIR="/${PN}" 39INSTALL_DIR="/${PN}"
27IS_UPGRADE=0 40IS_UPGRADE=0
124# PUBLIC FUNCTIONS 137# PUBLIC FUNCTIONS
125# ============================================================================== 138# ==============================================================================
126 139
127# @FUNCTION: need_httpd 140# @FUNCTION: need_httpd
128# @DESCRIPTION: 141# @DESCRIPTION:
129# 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
130# webservers are able to run this application. 143# webservers are able to run this application.
131need_httpd() { 144need_httpd() {
132 DEPEND="${DEPEND} 145 DEPEND="${DEPEND}
133 || ( virtual/httpd-basic virtual/httpd-cgi virtual/httpd-fastcgi )" 146 || ( virtual/httpd-basic virtual/httpd-cgi virtual/httpd-fastcgi )"
134} 147}
135 148
136# @FUNCTION: need_httpd_cgi 149# @FUNCTION: need_httpd_cgi
137# @DESCRIPTION: 150# @DESCRIPTION:
138# 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
139# CGI-capable webservers are able to run this application. 152# CGI-capable webservers are able to run this application.
140need_httpd_cgi() { 153need_httpd_cgi() {
141 DEPEND="${DEPEND} 154 DEPEND="${DEPEND}
142 || ( virtual/httpd-cgi virtual/httpd-fastcgi )" 155 || ( virtual/httpd-cgi virtual/httpd-fastcgi )"
143} 156}
144 157
145# @FUNCTION: need_httpd_fastcgi 158# @FUNCTION: need_httpd_fastcgi
146# @DESCRIPTION: 159# @DESCRIPTION:
147# 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
148# FastCGI-capabale webservers are able to run this application. 161# FastCGI-capabale webservers are able to run this application.
149need_httpd_fastcgi() { 162need_httpd_fastcgi() {
150 DEPEND="${DEPEND} 163 DEPEND="${DEPEND}
151 virtual/httpd-fastcgi" 164 virtual/httpd-fastcgi"
152} 165}
306# 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.
307# For now we just create required webapp-config directories. 320# For now we just create required webapp-config directories.
308webapp_src_preinst() { 321webapp_src_preinst() {
309 debug-print-function $FUNCNAME $* 322 debug-print-function $FUNCNAME $*
310 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.
311 dodir "${MY_HTDOCSDIR}" 340 dodir "${MY_HTDOCSDIR}"
312 dodir "${MY_HOSTROOTDIR}" 341 dodir "${MY_HOSTROOTDIR}"
313 dodir "${MY_CGIBINDIR}" 342 dodir "${MY_CGIBINDIR}"
314 dodir "${MY_ICONSDIR}" 343 dodir "${MY_ICONSDIR}"
315 dodir "${MY_ERRORSDIR}" 344 dodir "${MY_ERRORSDIR}"
400 # 429 #
401 # 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
402 # no longer rely on Portage calling both webapp_src_install() and 431 # no longer rely on Portage calling both webapp_src_install() and
403 # webapp_pkg_postinst() within the same shell process 432 # webapp_pkg_postinst() within the same shell process
404 touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}" 433 touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
405
406 # sanity checks, to catch bugs in the ebuild
407 if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
408 eerror
409 eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
410 eerror "of the pkg_setup() function"
411 eerror
412 eerror "Please log a bug on http://bugs.gentoo.org"
413 eerror
414 eerror "You should use emerge -C to remove this package, as the"
415 eerror "installation is incomplete"
416 eerror
417 die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
418 fi
419 434
420 chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" 435 chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
421 chmod -R u-s "${D}/" 436 chmod -R u-s "${D}/"
422 chmod -R g-s "${D}/" 437 chmod -R g-s "${D}/"
423 438

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

  ViewVC Help
Powered by ViewVC 1.1.20