public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Benedikt Boehm (hollow)" <hollow@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
Date: Fri, 22 Feb 2008 09:33:45 +0000	[thread overview]
Message-ID: <E1JSUHp-0002bp-Kv@stork.gentoo.org> (raw)

hollow      08/02/22 09:33:45

  Modified:             webapp.eclass
  Log:
  convert to standard documentation syntax

Revision  Changes    Path
1.49                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.49&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.49&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?r1=1.48&r2=1.49

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- webapp.eclass	3 Jan 2007 20:16:39 -0000	1.48
+++ webapp.eclass	22 Feb 2008 09:33:45 -0000	1.49
@@ -1,26 +1,14 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.48 2007/01/03 20:16:39 rl03 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.49 2008/02/22 09:33:45 hollow Exp $
 #
-# eclass/webapp.eclass
-#				Eclass for installing applications to run under a web server
-#
-#				Part of the implementation of GLEP #11
-#
-# Author(s)		Stuart Herbert
-#				Renat Lumpau <rl03@gentoo.org>
-#				Gunnar Wrobel <wrobel@gentoo.org>
-#
-# ------------------------------------------------------------------------
-#
-# The master copy of this eclass is held in our subversion repository.
-# http://svn.gnqs.org/projects/vhost-tools/browser/
-#
-# If you make changes to this file and don't tell us, chances are that
-# your changes will be overwritten the next time we release a new version
-# of webapp-config.
-#
-# ------------------------------------------------------------------------
+# @ECLASS: webapp.eclass
+# @MAINTAINER:
+# web-apps@gentoo.org
+# @BLURB: functions for installing applications to run under a web server
+# @DESCRIPTION:
+# The webapp eclass contains functions to handle web applications with
+# webapp-config. Part of the implementation of GLEP #11
 
 SLOT="${PVR}"
 IUSE="vhosts"
@@ -39,17 +27,13 @@
 WEBAPP_CONFIG="${ROOT}/usr/sbin/webapp-config"
 WEBAPP_CLEANER="${ROOT}/usr/sbin/webapp-cleaner"
 
-# ------------------------------------------------------------------------
-# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY
-#
+# ==============================================================================
+# INTERNAL FUNCTIONS
+# ==============================================================================
+
 # Load the config file /etc/vhosts/webapp-config
-#
 # Supports both the old bash version, and the new python version
-#
-# ------------------------------------------------------------------------
-
-function webapp_read_config ()
-{
+webapp_read_config() {
 	if has_version '>=app-admin/webapp-config-1.50'; then
 		ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die "Could not read settings from webapp-config!"
 		eval ${ENVVAR}
@@ -58,19 +42,9 @@
 	fi
 }
 
-# ------------------------------------------------------------------------
-# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY
-#
-# Check whether a specified file exists within the image/ directory
+# Check whether a specified file exists in the given directory (`.' by default)
 # or not.
-#
-# @param 	$1 - file to look for
-# @param	$2 - prefix directory to use
-# @return	0 on success, never returns on an error
-# ------------------------------------------------------------------------
-
-function webapp_checkfileexists ()
-{
+webapp_checkfileexists() {
 	local my_prefix
 
 	[ -n "${2}" ] && my_prefix="${2}/" || my_prefix=
@@ -83,49 +57,33 @@
 	fi
 }
 
-# ------------------------------------------------------------------------
-# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY
-# ------------------------------------------------------------------------
-
-function webapp_check_installedat
-{
-	local my_output
-
+webapp_check_installedat() {
 	${WEBAPP_CONFIG} --show-installed -h localhost -d "${INSTALL_DIR}" 2> /dev/null
 }
 
-# ------------------------------------------------------------------------
-# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY
-#
-# ------------------------------------------------------------------------
-
-function webapp_strip_appdir ()
-{
+webapp_strip_appdir() {
 	local my_stripped="${1}"
 	echo "${1}" | sed -e "s|${MY_APPDIR}/||g;"
 }
 
-function webapp_strip_d ()
-{
+webapp_strip_d() {
 	echo "${1}" | sed -e "s|${D}||g;"
 }
 
-function webapp_strip_cwd ()
-{
+webapp_strip_cwd() {
 	local my_stripped="${1}"
 	echo "${1}" | sed -e 's|/./|/|g;'
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - FOR USE IN EBUILDS
-#
-# Identify a config file for a web-based application.
-#
-# @param	$1 - config file
-# ------------------------------------------------------------------------
-
-function webapp_configfile ()
-{
+# ==============================================================================
+# PUBLIC FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: webapp_configfile
+# @USAGE: <file> [more files ...]
+# @DESCRIPTION:
+# Mark a file config-protected for a web-based application.
+webapp_configfile() {
 	local m=""
 	for m in "$@" ; do
 		webapp_checkfileexists "${m}" "${D}"
@@ -138,17 +96,12 @@
 	done
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - FOR USE IN EBUILDS
-#
+# @FUNCTION: webapp_hook_script
+# @USAGE: <file>
+# @DESCRIPTION:
 # Install a script that will run after a virtual copy is created, and
-# before a virtual copy has been removed
-#
-# @param	$1 - the script to run
-# ------------------------------------------------------------------------
-
-function webapp_hook_script ()
-{
+# before a virtual copy has been removed.
+webapp_hook_script() {
 	webapp_checkfileexists "${1}"
 
 	elog "(hook) ${1}"
@@ -156,55 +109,35 @@
 	chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")"
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - FOR USE IN EBUILDS
-#
+# @FUNCTION: webapp_postinst_txt
+# @USAGE: <lang> <file>
+# @DESCRIPTION:
 # Install a text file containing post-installation instructions.
-#
-# @param	$1 - language code (use 'en' for now)
-# @param	$2 - the file to install
-# ------------------------------------------------------------------------
-
-function webapp_postinst_txt ()
-{
+webapp_postinst_txt() {
 	webapp_checkfileexists "${2}"
 
 	elog "(info) ${2} (lang: ${1})"
 	cp "${2}" "${D}/${MY_APPDIR}/postinst-${1}.txt"
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - FOR USE IN EBUILDS
-#
+# @FUNCTION: webapp_postupgrade_txt
+# @USAGE: <lang> <file>
+# @DESCRIPTION:
 # Install a text file containing post-upgrade instructions.
-#
-# @param	$1 - language code (use 'en' for now)
-# @param	$2 - the file to install
-# ------------------------------------------------------------------------
-
-function webapp_postupgrade_txt ()
-{
+webapp_postupgrade_txt() {
 	webapp_checkfileexists "${2}"
 
 	elog "(info) ${2} (lang: ${1})"
 	cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt"
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - FOR USE IN EBUILDS
-#
-# Identify a file which must be owned by the webserver's user:group
-# settings.
-#
-# The ownership of the file is NOT set until the application is installed
-# using the webapp-config tool.
-#
-# @param	$1 - file to be owned by the webserver user:group combo
-#
-# ------------------------------------------------------------------------
-
-function webapp_serverowned ()
-{
+# @FUNCTION: webapp_serverowned
+# @USAGE: [-R] <file> [more files ...]
+# @DESCRIPTION:
+# Identify a file which must be owned by the webserver's user:group settings.
+# The ownership of the file is NOT set until the application is installed using
+# the webapp-config tool. If -R is given directories are handled recursively.
+webapp_serverowned() {
 	local a=""
 	local m=""
 	if [ "${1}" = "-R" ]; then
@@ -232,22 +165,14 @@
 	fi
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - FOR USE IN EBUILDS
-#
-# @param	$1 - the webserver to install the config file for
-#			     (one of apache1, apache2, cherokee)
-# @param	$2 - the config file to install
-# @param	$3 - new name for the config file (default is `basename $2`)
-#				 this is an optional parameter
-#
-# NOTE:
-#	this function will automagically prepend $1 to the front of your
-#	config file's name
-# ------------------------------------------------------------------------
-
-function webapp_server_configfile ()
-{
+# @FUNCTION: webapp_server_configfile
+# @USAGE: <server> <file> [new name]
+# @DESCRIPTION:
+# Install a configuration file for the webserver.  You need to specify a
+# webapp-config supported <server>.  if no new name is given `basename $2' is
+# used by default. Note: this function will automagically prepend $1 to the
+# front of your config file's name.
+webapp_server_configfile() {
 	webapp_checkfileexists "${2}"
 
 	# sort out what the name will be of the config file
@@ -269,20 +194,14 @@
 	cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}"
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - FOR USE IN EBUILDS
-#
-# @param	$1 - the db engine that the script is for
-#				 (one of: mysql|postgres)
-# @param	$2 - the sql script to be installed
-# @param	$3 - the older version of the app that this db script
-#				 will upgrade from
-#				 (do not pass this option if your SQL script only creates
-#				  a new db from scratch)
-# ------------------------------------------------------------------------
-
-function webapp_sqlscript ()
-{
+# @FUNCTION: webapp_sqlscript
+# @USAGE: <db> <file> [version]
+# @DESCRIPTION:
+# Install a SQL script that creates/upgrades a database schema for the web
+# application. Currently supported database engines are mysql and postgres.
+# If a version is given the script should upgrade the database schema from
+# the given version to $PVR.
+webapp_sqlscript() {
 	webapp_checkfileexists "${2}"
 
 	# create the directory where this script will go
@@ -313,16 +232,16 @@
 	fi
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - call from inside your ebuild's src_install AFTER
-# everything else has run
-#
-# For now, we just make sure that root owns everything, and that there
-# are no setuid files.
-# ------------------------------------------------------------------------
-
-function webapp_src_install ()
-{
+# ==============================================================================
+# EXPORTED FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: webapp_src_install
+# @DESCRIPTION:
+# You need to call this function in src_install() AFTER everything else has run.
+# For now, we just make sure that root owns everything, and that there are no
+# setuid files.
+webapp_src_install() {
 	chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
 	chmod -R u-s "${D}/"
 	chmod -R g-s "${D}/"
@@ -341,16 +260,11 @@
 	touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
 }
 
-# ------------------------------------------------------------------------
-# EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER
-# everything else has run
-#
-# If 'vhosts' USE flag is not set, auto-install this app
-#
-# ------------------------------------------------------------------------
-
-function webapp_pkg_setup ()
-{
+# @FUNCTION: webapp_pkg_setup
+# @DESCRIPTION:
+# You need to call this function in pkg_config() AFTER everything else has run.
+# If 'vhosts' USE flag is not set, auto-install this app.
+webapp_pkg_setup() {
 	# add sanity checks here
 
 	# special case - some ebuilds *do* need to overwride the SLOT
@@ -391,8 +305,7 @@
 	fi
 }
 
-function webapp_getinstalltype ()
-{
+webapp_getinstalltype() {
 	# or are we upgrading?
 
 	if ! use vhosts ; then
@@ -429,8 +342,7 @@
 	fi
 }
 
-function webapp_src_preinst ()
-{
+webapp_src_preinst() {
 	# create the directories that we need
 
 	dodir "${MY_HTDOCSDIR}"
@@ -443,8 +355,7 @@
 	dodir "${MY_SERVERCONFIGDIR}"
 }
 
-function webapp_pkg_postinst ()
-{
+webapp_pkg_postinst() {
 	webapp_read_config
 
 	# sanity checks, to catch bugs in the ebuild
@@ -514,8 +425,7 @@
 	return 0
 }
 
-function webapp_pkg_prerm ()
-{
+webapp_pkg_prerm() {
 	# remove any virtual installs that there are
 
 	local my_output



-- 
gentoo-commits@lists.gentoo.org mailing list



             reply	other threads:[~2008-02-22  9:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22  9:33 Benedikt Boehm (hollow) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-02-22 10:03 [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass Benedikt Boehm (hollow)
2008-02-22 13:44 Benedikt Boehm (hollow)
2008-02-22 13:53 Benedikt Boehm (hollow)
2008-02-22 14:06 Benedikt Boehm (hollow)
2008-02-22 14:27 Benedikt Boehm (hollow)
2008-02-22 14:33 Benedikt Boehm (hollow)
2008-02-22 14:44 Benedikt Boehm (hollow)
2008-02-22 14:59 Benedikt Boehm (hollow)
2008-02-22 15:33 Benedikt Boehm (hollow)
2008-02-23 23:54 Benedikt Boehm (hollow)
2008-03-04 18:41 Benedikt Boehm (hollow)
2008-03-04 18:44 Benedikt Boehm (hollow)
2008-03-04 18:54 Benedikt Boehm (hollow)
2008-03-23  0:11 Benedikt Boehm (hollow)
2010-05-09 22:32 Jeremy Olexa (darkside)
2011-05-19 12:05 Tomas Chvatal (scarabeus)
2011-07-12  7:48 Fabio Erculiani (lxnay)
2011-07-26 19:25 Fabio Erculiani (lxnay)
2011-07-27  7:50 Fabio Erculiani (lxnay)
2012-07-15 22:45 Doug Goldstein (cardoe)
2012-07-18 14:59 Anthony G. Basile (blueness)
2015-07-02 14:02 Devan Franchini (twitch153)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1JSUHp-0002bp-Kv@stork.gentoo.org \
    --to=hollow@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox