public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2012-07-18 14:59 Anthony G. Basile (blueness)
  0 siblings, 0 replies; 23+ messages in thread
From: Anthony G. Basile (blueness) @ 2012-07-18 14:59 UTC (permalink / raw
  To: gentoo-commits

blueness    12/07/18 14:59:29

  Modified:             webapp.eclass
  Log:
  Don't ebeep at even EAPI=3, bug #386555.

Revision  Changes    Path
1.72                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.72&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.72&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?r1=1.71&r2=1.72

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- webapp.eclass	15 Jul 2012 22:45:12 -0000	1.71
+++ webapp.eclass	18 Jul 2012 14:59:29 -0000	1.72
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.71 2012/07/15 22:45:12 cardoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.72 2012/07/18 14:59:29 blueness Exp $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -413,7 +413,7 @@
 		ewarn "This ebuild may be overwriting important files."
 		ewarn
 		echo
-		if has "${EAPI:-0}" 0 1 2 3; then
+		if has "${EAPI:-0}" 0 1 2; then
 			ebeep 10
 		fi
 	elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then






^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2015-07-02 14:02 Devan Franchini (twitch153)
  0 siblings, 0 replies; 23+ messages in thread
From: Devan Franchini (twitch153) @ 2015-07-02 14:02 UTC (permalink / raw
  To: gentoo-commits

twitch153    15/07/02 14:02:34

  Modified:             webapp.eclass
  Log:
  webapp.eclass: Updates eclass to reflect migration from optparse to argparse
  
  These changes move the command line args for -I/-C/-U to the ${PN} and the ${PV}
  vars. This ensures both forwards and backwards compatibility.

Revision  Changes    Path
1.74                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.74&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.74&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?r1=1.73&r2=1.74

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- webapp.eclass	12 May 2015 15:15:31 -0000	1.73
+++ webapp.eclass	2 Jul 2015 14:02:34 -0000	1.74
@@ -1,6 +1,6 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.73 2015/05/12 15:15:31 voyageur Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.74 2015/07/02 14:02:34 twitch153 Exp $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -244,6 +244,7 @@
 	local my_file="$(webapp_strip_appdir "${1}")"
 	my_file="$(webapp_strip_cwd "${my_file}")"
 
+	elog "(server owned) ${my_file}"
 	echo "${my_file}" >> "${D}/${WA_SOLIST}"
 }
 
@@ -412,9 +413,7 @@
 		ewarn "This ebuild may be overwriting important files."
 		ewarn
 		echo
-		if has "${EAPI:-0}" 0 1 2; then
-			ebeep 10
-		fi
+		ebeep 10
 	elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
 		echo
 		eerror "You already have ${my_output} installed in ${my_dir}"
@@ -502,12 +501,12 @@
 				elog "${PN}-${PVR} is not installed - using install mode"
 			fi
 
-			my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
+			my_cmd="${WEBAPP_CONFIG} -h localhost -u root -d ${INSTALL_DIR} ${my_mode} ${PN} ${PVR}"
 			elog "Running ${my_cmd}"
 			${my_cmd}
 
 			echo
-			local cleaner="${WEBAPP_CLEANER} -p -C /${PN}"
+			local cleaner="${WEBAPP_CLEANER} -p -C ${CATEGORY}/${PN}"
 			einfo "Running ${cleaner}"
 			${cleaner}
 		else
@@ -518,7 +517,7 @@
 			elog
 			elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
 			elog
-			elog "    webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}"
+			elog "    webapp-config -h <host> -d ${PN} -I ${PN} ${PVR}"
 			elog
 			elog "For more details, see the webapp-config(8) man page"
 		fi
@@ -530,7 +529,7 @@
 		elog
 		elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
 		elog
-		elog "    webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}"
+		elog "    webapp-config -h <host> -d ${PN} -I ${PN} ${PVR}"
 		elog
 		elog "For more details, see the webapp-config(8) man page"
 	fi
@@ -554,7 +553,7 @@
 			if [[ -f "${x}"/.webapp ]]; then
 				. "${x}"/.webapp
 				if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then
-					${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} ${PN} ${PVR}
+					${WEBAPP_CONFIG} -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} -C ${PN} ${PVR}
 				fi
 			else
 				ewarn "Cannot find file ${x}/.webapp"





^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2012-07-15 22:45 Doug Goldstein (cardoe)
  0 siblings, 0 replies; 23+ messages in thread
From: Doug Goldstein (cardoe) @ 2012-07-15 22:45 UTC (permalink / raw
  To: gentoo-commits

cardoe      12/07/15 22:45:12

  Modified:             webapp.eclass
  Log:
  Don't use ebeep in EAPI 4 and newer since it was deprecated and removed in EAPI 4. bug #386555

Revision  Changes    Path
1.71                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.71&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.71&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?r1=1.70&r2=1.71

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- webapp.eclass	27 Dec 2011 17:55:12 -0000	1.70
+++ webapp.eclass	15 Jul 2012 22:45:12 -0000	1.71
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.70 2011/12/27 17:55:12 fauli Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.71 2012/07/15 22:45:12 cardoe Exp $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -413,7 +413,9 @@
 		ewarn "This ebuild may be overwriting important files."
 		ewarn
 		echo
-		ebeep 10
+		if has "${EAPI:-0}" 0 1 2 3; then
+			ebeep 10
+		fi
 	elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
 		echo
 		eerror "You already have ${my_output} installed in ${my_dir}"






^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2011-07-27  7:50 Fabio Erculiani (lxnay)
  0 siblings, 0 replies; 23+ messages in thread
From: Fabio Erculiani (lxnay) @ 2011-07-27  7:50 UTC (permalink / raw
  To: gentoo-commits

lxnay       11/07/27 07:50:39

  Modified:             webapp.eclass
  Log:
  fix webapp-cleaner usage by eclass

Revision  Changes    Path
1.69                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.69&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.69&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?r1=1.68&r2=1.69

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- webapp.eclass	26 Jul 2011 19:25:19 -0000	1.68
+++ webapp.eclass	27 Jul 2011 07:50:39 -0000	1.69
@@ -1,6 +1,6 @@
 # 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.68 2011/07/26 19:25:19 lxnay Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.69 2011/07/27 07:50:39 lxnay Exp $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -506,7 +506,7 @@
 			${my_cmd}
 
 			echo
-			local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
+			local cleaner="${WEBAPP_CLEANER} -p -C /${PN}"
 			einfo "Running ${cleaner}"
 			${cleaner}
 		else






^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2011-07-26 19:25 Fabio Erculiani (lxnay)
  0 siblings, 0 replies; 23+ messages in thread
From: Fabio Erculiani (lxnay) @ 2011-07-26 19:25 UTC (permalink / raw
  To: gentoo-commits

lxnay       11/07/26 19:25:19

  Modified:             webapp.eclass
  Log:
  if WEBAPP_OPTIONAL, do not source ETC_CONFIG if it doesn't exist

Revision  Changes    Path
1.68                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.68&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.68&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?r1=1.67&r2=1.68

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- webapp.eclass	12 Jul 2011 07:48:01 -0000	1.67
+++ webapp.eclass	26 Jul 2011 19:25:19 -0000	1.68
@@ -1,6 +1,6 @@
 # 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.67 2011/07/12 07:48:01 lxnay Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.68 2011/07/26 19:25:19 lxnay Exp $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -59,7 +59,12 @@
 	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}
-	else
+	elif [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
+		# ETC_CONFIG might not be available
+		. ${ETC_CONFIG} || die "Unable to read ${ETC_CONFIG}"
+	elif [[ -f "${ETC_CONFIG}" ]]; then
+		# WEBAPP_OPTIONAL is set to yes
+		# and this must run only if ETC_CONFIG actually exists
 		. ${ETC_CONFIG} || die "Unable to read ${ETC_CONFIG}"
 	fi
 }






^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2011-07-12  7:48 Fabio Erculiani (lxnay)
  0 siblings, 0 replies; 23+ messages in thread
From: Fabio Erculiani (lxnay) @ 2011-07-12  7:48 UTC (permalink / raw
  To: gentoo-commits

lxnay       11/07/12 07:48:01

  Modified:             webapp.eclass
  Log:
  Close bug #374697

Revision  Changes    Path
1.67                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.67&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.67&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?r1=1.66&r2=1.67

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- webapp.eclass	19 May 2011 12:05:13 -0000	1.66
+++ webapp.eclass	12 Jul 2011 07:48:01 -0000	1.67
@@ -1,6 +1,6 @@
 # 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.66 2011/05/19 12:05:13 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.67 2011/07/12 07:48:01 lxnay Exp $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -121,14 +121,21 @@
 			if [[ "${my_pvr}" != "${PVR}" ]]; then
 				elog "This is an upgrade"
 				IS_UPGRADE=1
+				# for binpkgs, reset status, var declared in global scope
+				IS_REPLACE=0
 			else
 				elog "This is a re-installation"
 				IS_REPLACE=1
+				# for binpkgs, reset status, var declared in global scope
+				IS_UPGRADE=0
 			fi
 		else
 			elog "${my_output} is installed there"
 		fi
 	else
+		# for binpkgs, reset status, var declared in global scope
+		IS_REPLACE=0
+		IS_UPGRADE=0
 		elog "This is an installation"
 	fi
 }
@@ -541,7 +548,7 @@
 			if [[ -f "${x}"/.webapp ]]; then
 				. "${x}"/.webapp
 				if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then
-					${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR}
+					${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} ${PN} ${PVR}
 				fi
 			else
 				ewarn "Cannot find file ${x}/.webapp"






^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2011-05-19 12:05 Tomas Chvatal (scarabeus)
  0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-05-19 12:05 UTC (permalink / raw
  To: gentoo-commits

scarabeus    11/05/19 12:05:14

  Modified:             webapp.eclass
  Log:
  Revert the change that was commited by accident :/

Revision  Changes    Path
1.66                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.66&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.66&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?r1=1.65&r2=1.66

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- webapp.eclass	19 May 2011 12:03:41 -0000	1.65
+++ webapp.eclass	19 May 2011 12:05:13 -0000	1.66
@@ -1,6 +1,6 @@
-# Copyright 1999-2011 Gentoo Foundation
+# 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.65 2011/05/19 12:03:41 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.66 2011/05/19 12:05:13 scarabeus Exp $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -10,37 +10,26 @@
 # The webapp eclass contains functions to handle web applications with
 # webapp-config. Part of the implementation of GLEP #11
 
-# @ECLASS-VARIABLE: WABAPP_MINIMAL
-# @DESCRIPTION:
-# Minimal version of webapp-config the package requires for sucessfull install.
-: ${WEBAPP_MINIMAL:=1.50.15}
-
 # @ECLASS-VARIABLE: WEBAPP_DEPEND
 # @DESCRIPTION:
 # An ebuild should use WEBAPP_DEPEND if a custom DEPEND needs to be built, most
 # notably in combination with WEBAPP_OPTIONAL.
-: ${WEBAPP_DEPEND:=">=app-admin/webapp-config-${WEBAPP_MINIMAL}"}
+WEBAPP_DEPEND=">=app-admin/webapp-config-1.50.15"
 
-# @ECLASS-VARIABLE: WEBAPP_AUTO_INSTALL
+# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL
 # @DESCRIPTION:
-# An ebuild sets this to `no' if an automatic installation and/or upgrade is
+# An ebuild sets this to `yes' if an automatic installation and/or upgrade is
 # not possible. The ebuild should overwrite pkg_postinst() and explain the
 # reason for this BEFORE calling webapp_pkg_postinst().
-: ${WEBAPP_AUTO_INSTALL:=yes}
-if [[ -n ${WEBAPP_NO_AUTO_INSTALL} ]]; then
-	WEBAPP_AUTO_INSTALL=no
-	ewarn "QA: using deprecated variable \"WEBAPP_NO_AUTO_INSTALL\"."
-	ewarn "QA: please migrate to WEBAPP_AUTO_INSTALL with inverse logic"
-	ewarn "QA: that defaults to yes."
-fi
 
 # @ECLASS-VARIABLE: WEBAPP_OPTIONAL
 # @DESCRIPTION:
 # An ebuild sets this to `yes' to make webapp support optional, in which case
 # you also need to take care of USE-flags and dependencies.
-if [[ ${WEBAPP_OPTIONAL} != yes ]]; then
-	[[ ${WEBAPP_AUTO_INSTALL} == yes ]] && IUSE="vhosts"
-	: ${SLOT:=${PVR}}
+
+if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
+	[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
+	SLOT="${PVR}"
 	DEPEND="${WEBAPP_DEPEND}"
 	RDEPEND="${DEPEND}"
 fi
@@ -67,18 +56,22 @@
 webapp_read_config() {
 	debug-print-function $FUNCNAME $*
 
-	ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die "Could not read settings from webapp-config!"
-	eval ${ENVVAR} || die
+	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}
+	else
+		. ${ETC_CONFIG} || die "Unable to read ${ETC_CONFIG}"
+	fi
 }
 
 # Check whether a specified file exists in the given directory (`.' by default)
 webapp_checkfileexists() {
 	debug-print-function $FUNCNAME $*
 
-	local msg my_prefix=${2:+${2}/}
+	local my_prefix=${2:+${2}/}
 
 	if [[ ! -e "${my_prefix}${1}" ]]; then
-		msg="ebuild error: file '${1}' not found"
+		msg="ebuild fault: file '${1}' not found"
 		eerror "$msg"
 		eerror "Please report this as a bug at http://bugs.gentoo.org/"
 		die "$msg"
@@ -108,20 +101,19 @@
 webapp_getinstalltype() {
 	debug-print-function $FUNCNAME $*
 
-	local my_output my_pn my_pvr
-
 	if ! has vhosts ${IUSE} || use vhosts; then
 		return
 	fi
 
+	local my_output
 	my_output="$(webapp_check_installedat)"
 
 	if [[ $? -eq 0 ]]; then
 		# something is already installed there
 		# make sure it isn't the same version
 
-		my_pn="$(echo ${my_output} | awk '{ print $1 }')"
-		my_pvr="$(echo ${my_output} | awk '{ print $2 }')"
+		local my_pn="$(echo ${my_output} | awk '{ print $1 }')"
+		local my_pvr="$(echo ${my_output} | awk '{ print $2 }')"
 
 		REMOVE_PKG="${my_pn}-${my_pvr}"
 
@@ -141,18 +133,6 @@
 	fi
 }
 
-# helper for webapp_serverowned()
-_webapp_serverowned() {
-	debug-print-function $FUNCNAME $*
-
-	webapp_checkfileexists "${1}" "${D}"
-	local my_file="$(webapp_strip_appdir "${1}")"
-	my_file="$(webapp_strip_cwd "${my_file}")"
-
-	elog "(server owned) ${my_file}"
-	echo "${my_file}" >> "${D}/${WA_SOLIST}"
-}
-
 # ==============================================================================
 # PUBLIC FUNCTIONS
 # ==============================================================================
@@ -191,8 +171,6 @@
 webapp_configfile() {
 	debug-print-function $FUNCNAME $*
 
-	[[ $# -lt 1 ]] && die "${FUNCNAME}: I require at least 1 argument. Please read eclass documentation."
-
 	local m
 	for m in "$@"; do
 		webapp_checkfileexists "${m}" "${D}"
@@ -200,75 +178,62 @@
 		local my_file="$(webapp_strip_appdir "${m}")"
 		my_file="$(webapp_strip_cwd "${my_file}")"
 
-		elog "[webapp-config] ${my_file}"
+		elog "(config) ${my_file}"
 		echo "${my_file}" >> ${D}/${WA_CONFIGLIST}
 	done
 }
 
 # @FUNCTION: webapp_hook_script
-# @USAGE: <file> [more files ...]
+# @USAGE: <file>
 # @DESCRIPTION:
 # Install a script that will run after a virtual copy is created, and
 # before a virtual copy has been removed.
 webapp_hook_script() {
 	debug-print-function $FUNCNAME $*
 
-	[[ $# -lt 1 ]] && die "${FUNCNAME}: I require at least 1 argument. Please read eclass documentation."
-
-	local m
-	for m in "$@"; do
-		webapp_checkfileexists "${m}"
+	webapp_checkfileexists "${1}"
 
-		elog "[webapp-hook] ${m}"
-		cp "${1}" "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" || die "Unable to install ${1} into \"${D}/${MY_HOOKSCRIPTSDIR}/\""
-		chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")"
-	done
+	elog "(hook) ${1}"
+	cp "${1}" "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" || die "Unable to install ${1} into ${D}/${MY_HOOKSCRIPTSDIR}/"
+	chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")"
 }
 
 # @FUNCTION: webapp_postinst_txt
-# @USAGE: <lang> <file> [more files ...]
+# @USAGE: <lang> <file>
 # @DESCRIPTION:
 # Install a text file containing post-installation instructions.
 webapp_postinst_txt() {
 	debug-print-function $FUNCNAME $*
 
-	local lang m
-
-	[[ $# -lt 2 ]] && die "${FUNCNAME}: I require at least 2 arguments. Please read eclass documentation."
-
-	lang=${1}
-	shift
-
-	local m
-	for m in "$@"; do
-		webapp_checkfileexists "${m}"
+	webapp_checkfileexists "${2}"
 
-		elog "[webapp-info] \"${m}\" (lang: ${lang})"
-		cp "${m}" "${D}/${MY_APPDIR}/${m}-postinst-${lang}.txt" || die
-	done
+	elog "(info) ${2} (lang: ${1})"
+	cp "${2}" "${D}/${MY_APPDIR}/postinst-${1}.txt"
 }
 
 # @FUNCTION: webapp_postupgrade_txt
-# @USAGE: <lang> <file> [more files ...]
+# @USAGE: <lang> <file>
 # @DESCRIPTION:
 # Install a text file containing post-upgrade instructions.
 webapp_postupgrade_txt() {
 	debug-print-function $FUNCNAME $*
 
-	local lang m
+	webapp_checkfileexists "${2}"
 
-	[[ $# -lt 2 ]] && die "${FUNCNAME}: I require at least 2 arguments. Please read eclass documentation."
+	elog "(info) ${2} (lang: ${1})"
+	cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt"
+}
 
-	lang=${1}
-	shift
+# helper for webapp_serverowned()
+_webapp_serverowned() {
+	debug-print-function $FUNCNAME $*
 
-	local m
-	for m in "$@"; do
-		webapp_checkfileexists "${m}"
+	webapp_checkfileexists "${1}" "${D}"
+	local my_file="$(webapp_strip_appdir "${1}")"
+	my_file="$(webapp_strip_cwd "${my_file}")"
 
-		elog "[webapp-info] \"${m}\" (lang: ${lang})"
-		cp "${m}" "${D}/${MY_APPDIR}/${m}-postupgrade-${lang}.txt" || die
-	done
+	elog "(server owned) ${my_file}"
+	echo "${my_file}" >> "${D}/${WA_SOLIST}"
 }
 
 # @FUNCTION: webapp_serverowned
@@ -306,8 +271,6 @@
 webapp_server_configfile() {
 	debug-print-function $FUNCNAME $*
 
-	[[ $# -lt 2 ]] && die "${FUNCNAME}: I require at least 2 arguments. Please read eclass documentation."
-
 	webapp_checkfileexists "${2}"
 
 	# WARNING:
@@ -317,7 +280,7 @@
 
 	local my_file="${1}-${3:-$(basename "${2}")}"
 
-	elog "[webapp] Server \"${1}\" config file \"${my_file}\""
+	elog "(${1}) config file '${my_file}'"
 	cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}"
 }
 
@@ -331,23 +294,23 @@
 webapp_sqlscript() {
 	debug-print-function $FUNCNAME $*
 
-	[[ $# -lt 2 ]] && die "${FUNCNAME}: I require at least 2 arguments. Please read eclass documentation."
-
 	webapp_checkfileexists "${2}"
 
+	dodir "${MY_SQLSCRIPTSDIR}/${1}"
+
 	# WARNING:
 	#
 	# do NOT change the naming convention used here without changing all
 	# the other scripts that also rely upon these names
 
-	insinto "${MY_SQLSCRIPTSDIR}/${1}"
-	insopts -m0600
-	if [[ -n ${3} ]]; then
-		elog "[webapp] DB: \"${1}\" upgrade script for ${PN}-${3} to ${PVR}"
-		newins "${2}" "${3}_to_${PVR}.sql" || die
+	if [[ -n "${3}" ]]; then
+		elog "(${1}) upgrade script for ${PN}-${3} to ${PVR}"
+		cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
+		chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
 	else
-		elog "[webapp] DB: \"${1}\" create script for ${PN}-${PVR}"
-		newins "${2}" "${PVR}_create.sql"
+		elog "(${1}) create script for ${PN}-${PVR}"
+		cp "${2}" "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql"
+		chmod 600 "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql"
 	fi
 }
 
@@ -359,7 +322,7 @@
 	debug-print-function $FUNCNAME $*
 
 	# sanity checks, to catch bugs in the ebuild
-	if [[ ! -f ${T}/${SETUP_CHECK_FILE} ]]; then
+	if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
 		eerror
 		eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
 		eerror "of the pkg_setup() function"
@@ -408,8 +371,9 @@
 	touch "${T}/${SETUP_CHECK_FILE}"
 
 	# special case - some ebuilds *do* need to overwride the SLOT
-	[[ ${SLOT} != ${PVR} && ${WEBAPP_MANUAL_SLOT} != yes ]] && \
+	if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then
 		die "Set WEBAPP_MANUAL_SLOT=\"yes\" if you need to SLOT manually"
+	fi
 
 	# pull in the shared configuration file
 	G_HOSTNAME="localhost"
@@ -427,14 +391,17 @@
 
 	if [[ $? -ne 0 ]]; then
 		# okay, whatever is there, it isn't webapp-config-compatible
+		echo
 		ewarn
 		ewarn "You already have something installed in ${my_dir}"
 		ewarn
-		ewarn "Whatever is in \"${my_dir}\", it's not"
+		ewarn "Whatever is in ${my_dir}, it's not"
 		ewarn "compatible with webapp-config."
 		ewarn
 		ewarn "This ebuild may be overwriting important files."
 		ewarn
+		echo
+		ebeep 10
 	elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
 		echo
 		eerror "You already have ${my_output} installed in ${my_dir}"
@@ -444,6 +411,7 @@
 		echo
 		die "Cannot upgrade contents of ${my_dir}"
 	fi
+
 }
 
 # @FUNCTION: webapp_src_install
@@ -511,22 +479,23 @@
 			local my_mode=-I
 			webapp_getinstalltype
 
-			if [[ ${IS_REPLACE} == 1 ]]; then
-				elog "[webapp] ${PN}-${PVR} is already installed - replacing"
-			elif [[ ${IS_UPGRADE} == 1 ]]; then
-				elog "[webapp] ${REMOVE_PKG} is already installed - upgrading"
+			if [[ "${IS_REPLACE}" == "1" ]]; then
+				elog "${PN}-${PVR} is already installed - replacing"
+				my_mode=-I
+			elif [[ "${IS_UPGRADE}" == "1" ]]; then
+				elog "${REMOVE_PKG} is already installed - upgrading"
 				my_mode=-U
 			else
-				elog "[webapp] ${PN}-${PVR} is not installed - using install mode"
+				elog "${PN}-${PVR} is not installed - using install mode"
 			fi
 
 			my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
-			elog "[webapp] Running ${my_cmd}"
+			elog "Running ${my_cmd}"
 			${my_cmd}
 
 			echo
 			local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
-			einfo "[webapp] Running ${cleaner}"
+			einfo "Running ${cleaner}"
 			${cleaner}
 		else
 			elog
@@ -575,10 +544,10 @@
 					${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR}
 				fi
 			else
-				ewarn "[webapp] Cannot find file ${x}/.webapp"
+				ewarn "Cannot find file ${x}/.webapp"
 			fi
 		done
-	elif [[ -n ${my_output} ]]; then
+	elif [[ "${my_output}" != "" ]]; then
 		echo
 		ewarn
 		ewarn "Don't forget to use webapp-config to remove any copies of"
@@ -587,9 +556,9 @@
 
 		echo "${my_output}" | while read x; do
 			if [[ -f "${x}"/.webapp ]]; then
-				ewarn "[webapp]    ${x}"
+				ewarn "    ${x}"
 			else
-				ewarn "[webapp] Cannot find file ${x}/.webapp"
+				ewarn "Cannot find file ${x}/.webapp"
 			fi
 		done
 






^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2010-05-09 22:32 Jeremy Olexa (darkside)
  0 siblings, 0 replies; 23+ messages in thread
From: Jeremy Olexa (darkside) @ 2010-05-09 22:32 UTC (permalink / raw
  To: gentoo-commits

darkside    10/05/09 22:32:16

  Modified:             webapp.eclass
  Log:
  Add helpful comment about where the MY_* vars are defined.

Revision  Changes    Path
1.64                 eclass/webapp.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.64&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?rev=1.64&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/webapp.eclass?r1=1.63&r2=1.64

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- webapp.eclass	23 Mar 2008 00:11:20 -0000	1.63
+++ webapp.eclass	9 May 2010 22:32:16 -0000	1.64
@@ -1,6 +1,6 @@
 # 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.63 2008/03/23 00:11:20 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.64 2010/05/09 22:32:16 darkside Exp $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -335,6 +335,8 @@
 		die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
 	fi
 
+	# Hint, see the webapp_read_config() function to find where these are
+	# defined.
 	dodir "${MY_HTDOCSDIR}"
 	dodir "${MY_HOSTROOTDIR}"
 	dodir "${MY_CGIBINDIR}"






^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-03-23  0:11 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-03-23  0:11 UTC (permalink / raw
  To: gentoo-commits

hollow      08/03/23 00:11:21

  Modified:             webapp.eclass
  Log:
  fix documentation; move sanity check

Revision  Changes    Path
1.63                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- webapp.eclass	4 Mar 2008 18:54:41 -0000	1.62
+++ webapp.eclass	23 Mar 2008 00:11:20 -0000	1.63
@@ -1,7 +1,7 @@
 # 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.62 2008/03/04 18:54:41 hollow Exp $
-#
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.63 2008/03/23 00:11:20 hollow Exp $
+
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
 # web-apps@gentoo.org
@@ -12,7 +12,7 @@
 
 # @ECLASS-VARIABLE: WEBAPP_DEPEND
 # @DESCRIPTION:
-# An ebuild should use WEBAPP_DEPEND if a custom DEPEND needs to be build, most
+# An ebuild should use WEBAPP_DEPEND if a custom DEPEND needs to be built, most
 # notably in combination with WEBAPP_OPTIONAL.
 WEBAPP_DEPEND=">=app-admin/webapp-config-1.50.15"
 
@@ -139,7 +139,7 @@
 
 # @FUNCTION: need_httpd
 # @DESCRIPTION:
-# Call this function AFTER your ebuild's DEPEND line if any of the available
+# Call this function AFTER your ebuilds DEPEND line if any of the available
 # webservers are able to run this application.
 need_httpd() {
 	DEPEND="${DEPEND}
@@ -148,7 +148,7 @@
 
 # @FUNCTION: need_httpd_cgi
 # @DESCRIPTION:
-# Call this function AFTER your ebuild's DEPEND line if any of the available
+# Call this function AFTER your ebuilds DEPEND line if any of the available
 # CGI-capable webservers are able to run this application.
 need_httpd_cgi() {
 	DEPEND="${DEPEND}
@@ -157,7 +157,7 @@
 
 # @FUNCTION: need_httpd_fastcgi
 # @DESCRIPTION:
-# Call this function AFTER your ebuild's DEPEND line if any of the available
+# Call this function AFTER your ebuilds DEPEND line if any of the available
 # FastCGI-capabale webservers are able to run this application.
 need_httpd_fastcgi() {
 	DEPEND="${DEPEND}
@@ -321,6 +321,20 @@
 webapp_src_preinst() {
 	debug-print-function $FUNCNAME $*
 
+	# sanity checks, to catch bugs in the ebuild
+	if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
+		eerror
+		eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
+		eerror "of the pkg_setup() function"
+		eerror
+		eerror "Please log a bug on http://bugs.gentoo.org"
+		eerror
+		eerror "You should use emerge -C to remove this package, as the"
+		eerror "installation is incomplete"
+		eerror
+		die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
+	fi
+
 	dodir "${MY_HTDOCSDIR}"
 	dodir "${MY_HOSTROOTDIR}"
 	dodir "${MY_CGIBINDIR}"
@@ -416,20 +430,6 @@
 	# webapp_pkg_postinst() within the same shell process
 	touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
 
-	# sanity checks, to catch bugs in the ebuild
-	if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
-		eerror
-		eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
-		eerror "of the pkg_setup() function"
-		eerror
-		eerror "Please log a bug on http://bugs.gentoo.org"
-		eerror
-		eerror "You should use emerge -C to remove this package, as the"
-		eerror "installation is incomplete"
-		eerror
-		die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
-	fi
-
 	chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
 	chmod -R u-s "${D}/"
 	chmod -R g-s "${D}/"



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-03-04 18:54 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-03-04 18:54 UTC (permalink / raw
  To: gentoo-commits

hollow      08/03/04 18:54:41

  Modified:             webapp.eclass
  Log:
  provide WEBAPP_DEPEND for ebuilds with WEBAPP_OPTIONAL

Revision  Changes    Path
1.62                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- webapp.eclass	4 Mar 2008 18:44:01 -0000	1.61
+++ webapp.eclass	4 Mar 2008 18:54:41 -0000	1.62
@@ -1,6 +1,6 @@
 # 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.61 2008/03/04 18:44:01 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.62 2008/03/04 18:54:41 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -10,6 +10,12 @@
 # The webapp eclass contains functions to handle web applications with
 # webapp-config. Part of the implementation of GLEP #11
 
+# @ECLASS-VARIABLE: WEBAPP_DEPEND
+# @DESCRIPTION:
+# An ebuild should use WEBAPP_DEPEND if a custom DEPEND needs to be build, most
+# notably in combination with WEBAPP_OPTIONAL.
+WEBAPP_DEPEND=">=app-admin/webapp-config-1.50.15"
+
 # @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL
 # @DESCRIPTION:
 # An ebuild sets this to `yes' if an automatic installation and/or upgrade is
@@ -24,7 +30,7 @@
 if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
 	[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
 	SLOT="${PVR}"
-	DEPEND=">=app-admin/webapp-config-1.50.15"
+	DEPEND="${WEBAPP_DEPEND}"
 	RDEPEND="${DEPEND}"
 fi
 



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-03-04 18:44 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-03-04 18:44 UTC (permalink / raw
  To: gentoo-commits

hollow      08/03/04 18:44:01

  Modified:             webapp.eclass
  Log:
  make IUSE optional as well

Revision  Changes    Path
1.61                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- webapp.eclass	4 Mar 2008 18:41:43 -0000	1.60
+++ webapp.eclass	4 Mar 2008 18:44:01 -0000	1.61
@@ -1,6 +1,6 @@
 # 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.60 2008/03/04 18:41:43 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.61 2008/03/04 18:44:01 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -15,13 +15,14 @@
 # An ebuild sets this to `yes' if an automatic installation and/or upgrade is
 # not possible. The ebuild should overwrite pkg_postinst() and explain the
 # reason for this BEFORE calling webapp_pkg_postinst().
-[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
 
 # @ECLASS-VARIABLE: WEBAPP_OPTIONAL
 # @DESCRIPTION:
 # An ebuild sets this to `yes' to make webapp support optional, in which case
 # you also need to take care of USE-flags and dependencies.
+
 if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
+	[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
 	SLOT="${PVR}"
 	DEPEND=">=app-admin/webapp-config-1.50.15"
 	RDEPEND="${DEPEND}"



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-03-04 18:41 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-03-04 18:41 UTC (permalink / raw
  To: gentoo-commits

hollow      08/03/04 18:41:43

  Modified:             webapp.eclass
  Log:
  make optional use webapp.eclass possible

Revision  Changes    Path
1.60                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- webapp.eclass	23 Feb 2008 23:54:40 -0000	1.59
+++ webapp.eclass	4 Mar 2008 18:41:43 -0000	1.60
@@ -1,6 +1,6 @@
 # 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.59 2008/02/23 23:54:40 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.60 2008/03/04 18:41:43 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -17,9 +17,15 @@
 # reason for this BEFORE calling webapp_pkg_postinst().
 [[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
 
-SLOT="${PVR}"
-DEPEND=">=app-admin/webapp-config-1.50.15"
-RDEPEND="${DEPEND}"
+# @ECLASS-VARIABLE: WEBAPP_OPTIONAL
+# @DESCRIPTION:
+# An ebuild sets this to `yes' to make webapp support optional, in which case
+# you also need to take care of USE-flags and dependencies.
+if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
+	SLOT="${PVR}"
+	DEPEND=">=app-admin/webapp-config-1.50.15"
+	RDEPEND="${DEPEND}"
+fi
 
 EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
 



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-23 23:54 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-23 23:54 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/23 23:54:41

  Modified:             webapp.eclass
  Log:
  make IUSE=vhosts optional

Revision  Changes    Path
1.59                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- webapp.eclass	22 Feb 2008 15:33:32 -0000	1.58
+++ webapp.eclass	23 Feb 2008 23:54:40 -0000	1.59
@@ -1,6 +1,6 @@
 # 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.58 2008/02/22 15:33:32 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.59 2008/02/23 23:54:40 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -10,8 +10,14 @@
 # The webapp eclass contains functions to handle web applications with
 # webapp-config. Part of the implementation of GLEP #11
 
+# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL
+# @DESCRIPTION:
+# An ebuild sets this to `yes' if an automatic installation and/or upgrade is
+# not possible. The ebuild should overwrite pkg_postinst() and explain the
+# reason for this BEFORE calling webapp_pkg_postinst().
+[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
+
 SLOT="${PVR}"
-IUSE="vhosts"
 DEPEND=">=app-admin/webapp-config-1.50.15"
 RDEPEND="${DEPEND}"
 
@@ -81,7 +87,10 @@
 
 webapp_getinstalltype() {
 	debug-print-function $FUNCNAME $*
-	use vhosts && return
+
+	if ! has vhosts ${IUSE} || use vhosts; then
+		return
+	fi
 
 	local my_output
 	my_output="$(webapp_check_installedat)"
@@ -344,7 +353,9 @@
 	local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
 
 	# if USE=vhosts is enabled OR no application is installed we're done here
-	use vhosts || [[ ! -d "${my_dir}" ]] && return
+	if ! has vhosts ${IUSE} || use vhosts || [[ ! -d "${my_dir}" ]]; then
+		return
+	fi
 
 	local my_output
 	my_output="$(webapp_check_installedat)"
@@ -442,37 +453,50 @@
 		die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org"
 	fi
 
-	if ! use vhosts; then
-		echo
-		elog "vhosts USE flag not set - auto-installing using webapp-config"
-
-		G_HOSTNAME="localhost"
-		webapp_read_config
-
-		local my_mode=-I
-		webapp_getinstalltype
+	if has vhosts ${IUSE}; then
+		if ! use vhosts; then
+			echo
+			elog "vhosts USE flag not set - auto-installing using webapp-config"
+
+			G_HOSTNAME="localhost"
+			webapp_read_config
+
+			local my_mode=-I
+			webapp_getinstalltype
+
+			if [[ "${IS_REPLACE}" == "1" ]]; then
+				elog "${PN}-${PVR} is already installed - replacing"
+				my_mode=-I
+			elif [[ "${IS_UPGRADE}" == "1" ]]; then
+				elog "${REMOVE_PKG} is already installed - upgrading"
+				my_mode=-U
+			else
+				elog "${PN}-${PVR} is not installed - using install mode"
+			fi
 
-		if [[ "${IS_REPLACE}" == "1" ]]; then
-			elog "${PN}-${PVR} is already installed - replacing"
-			my_mode=-I
-		elif [[ "${IS_UPGRADE}" == "1" ]]; then
-			elog "${REMOVE_PKG} is already installed - upgrading"
-			my_mode=-U
+			my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
+			elog "Running ${my_cmd}"
+			${my_cmd}
+
+			echo
+			local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
+			einfo "Running ${cleaner}"
+			${cleaner}
 		else
-			elog "${PN}-${PVR} is not installed - using install mode"
+			elog
+			elog "The 'vhosts' USE flag is switched ON"
+			elog "This means that Portage will not automatically run webapp-config to"
+			elog "complete the installation."
+			elog
+			elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
+			elog
+			elog "    webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}"
+			elog
+			elog "For more details, see the webapp-config(8) man page"
 		fi
-
-		my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
-		elog "Running ${my_cmd}"
-		${my_cmd}
-
-		echo
-		local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
-		einfo "Running ${cleaner}"
-		${cleaner}
 	else
 		elog
-		elog "The 'vhosts' USE flag is switched ON"
+		elog "This ebuild does not support the 'vhosts' USE flag."
 		elog "This means that Portage will not automatically run webapp-config to"
 		elog "complete the installation."
 		elog
@@ -497,7 +521,7 @@
 	[[ $? -ne 0 ]] && return
 
 	local x
-	if ! use vhosts; then
+	if has vhosts ${IUSE} && ! use vhosts; then
 		echo "${my_output}" | while read x; do
 			if [[ -f "${x}"/.webapp ]]; then
 				. "${x}"/.webapp



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 15:33 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 15:33 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 15:33:33

  Modified:             webapp.eclass
  Log:
  add need_httpd_* functions wrt #208584

Revision  Changes    Path
1.58                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- webapp.eclass	22 Feb 2008 14:59:07 -0000	1.57
+++ webapp.eclass	22 Feb 2008 15:33:32 -0000	1.58
@@ -1,6 +1,6 @@
 # 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.57 2008/02/22 14:59:07 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.58 2008/02/22 15:33:32 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -115,6 +115,33 @@
 # PUBLIC FUNCTIONS
 # ==============================================================================
 
+# @FUNCTION: need_httpd
+# @DESCRIPTION:
+# Call this function AFTER your ebuild's DEPEND line if any of the available
+# webservers are able to run this application.
+need_httpd() {
+	DEPEND="${DEPEND}
+		|| ( virtual/httpd-basic virtual/httpd-cgi virtual/httpd-fastcgi )"
+}
+
+# @FUNCTION: need_httpd_cgi
+# @DESCRIPTION:
+# Call this function AFTER your ebuild's DEPEND line if any of the available
+# CGI-capable webservers are able to run this application.
+need_httpd_cgi() {
+	DEPEND="${DEPEND}
+		|| ( virtual/httpd-cgi virtual/httpd-fastcgi )"
+}
+
+# @FUNCTION: need_httpd_fastcgi
+# @DESCRIPTION:
+# Call this function AFTER your ebuild's DEPEND line if any of the available
+# FastCGI-capabale webservers are able to run this application.
+need_httpd_fastcgi() {
+	DEPEND="${DEPEND}
+		virtual/httpd-fastcgi"
+}
+
 # @FUNCTION: webapp_configfile
 # @USAGE: <file> [more files ...]
 # @DESCRIPTION:



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 14:59 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 14:59 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 14:59:08

  Modified:             webapp.eclass
  Log:
  fix #202895

Revision  Changes    Path
1.57                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- webapp.eclass	22 Feb 2008 14:44:16 -0000	1.56
+++ webapp.eclass	22 Feb 2008 14:59:07 -0000	1.57
@@ -1,6 +1,6 @@
 # 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.56 2008/02/22 14:44:16 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.57 2008/02/22 14:59:07 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -22,6 +22,7 @@
 IS_REPLACE=0
 
 INSTALL_CHECK_FILE="installed_by_webapp_eclass"
+SETUP_CHECK_FILE="setup_by_webapp_eclass"
 
 ETC_CONFIG="${ROOT}etc/vhosts/webapp-config"
 WEBAPP_CONFIG="${ROOT}usr/sbin/webapp-config"
@@ -285,34 +286,6 @@
 # EXPORTED FUNCTIONS
 # ==============================================================================
 
-# @FUNCTION: webapp_src_install
-# @DESCRIPTION:
-# This is the default src_install(). For now, we just make sure that root owns
-# everything, and that there are no setuid files.
-#
-# You need to call this function AFTER everything else has run in your custom
-# src_install().
-webapp_src_install() {
-	debug-print-function $FUNCNAME $*
-
-	chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
-	chmod -R u-s "${D}/"
-	chmod -R g-s "${D}/"
-
-	keepdir "${MY_PERSISTDIR}"
-	fowners "root:0" "${MY_PERSISTDIR}"
-	fperms 755 "${MY_PERSISTDIR}"
-
-	# to test whether or not the ebuild has correctly called this function
-	# we add an empty file to the filesystem
-	#
-	# we used to just set a variable in the shell script, but we can
-	# no longer rely on Portage calling both webapp_src_install() and
-	# webapp_pkg_postinst() within the same shell process
-
-	touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
-}
-
 # @FUNCTION: webapp_pkg_setup
 # @DESCRIPTION:
 # The default pkg_setup() for this eclass. This will gather required variables
@@ -324,6 +297,14 @@
 webapp_pkg_setup() {
 	debug-print-function $FUNCNAME $*
 
+	# to test whether or not the ebuild has correctly called this function
+	# we add an empty file to the filesystem
+	#
+	# we used to just set a variable in the shell script, but we can
+	# no longer rely on Portage calling both webapp_pkg_setup() and
+	# webapp_src_install() within the same shell process
+	touch "${T}/${SETUP_CHECK_FILE}"
+
 	# special case - some ebuilds *do* need to overwride the SLOT
 	if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then
 		die "Set WEBAPP_MANUAL_SLOT=\"yes\" if you need to SLOT manually"
@@ -363,6 +344,48 @@
 		echo
 		die "Cannot upgrade contents of ${my_dir}"
 	fi
+
+}
+
+# @FUNCTION: webapp_src_install
+# @DESCRIPTION:
+# This is the default src_install(). For now, we just make sure that root owns
+# everything, and that there are no setuid files.
+#
+# You need to call this function AFTER everything else has run in your custom
+# src_install().
+webapp_src_install() {
+	debug-print-function $FUNCNAME $*
+
+	# to test whether or not the ebuild has correctly called this function
+	# we add an empty file to the filesystem
+	#
+	# we used to just set a variable in the shell script, but we can
+	# no longer rely on Portage calling both webapp_src_install() and
+	# webapp_pkg_postinst() within the same shell process
+	touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
+
+	# sanity checks, to catch bugs in the ebuild
+	if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
+		eerror
+		eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
+		eerror "of the pkg_setup() function"
+		eerror
+		eerror "Please log a bug on http://bugs.gentoo.org"
+		eerror
+		eerror "You should use emerge -C to remove this package, as the"
+		eerror "installation is incomplete"
+		eerror
+		die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
+	fi
+
+	chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
+	chmod -R u-s "${D}/"
+	chmod -R g-s "${D}/"
+
+	keepdir "${MY_PERSISTDIR}"
+	fowners "root:0" "${MY_PERSISTDIR}"
+	fperms 755 "${MY_PERSISTDIR}"
 }
 
 # @FUNCTION: webapp_pkg_postinst



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 14:44 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 14:44 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 14:44:17

  Modified:             webapp.eclass
  Log:
  fix #203463

Revision  Changes    Path
1.56                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- webapp.eclass	22 Feb 2008 14:33:35 -0000	1.55
+++ webapp.eclass	22 Feb 2008 14:44:16 -0000	1.56
@@ -1,6 +1,6 @@
 # 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.55 2008/02/22 14:33:35 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.56 2008/02/22 14:44:16 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -448,22 +448,32 @@
 
 	local x
 	if ! use vhosts; then
-
-		for x in ${my_output}; do
-			[[ -f ${x}/.webapp ]] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp"
-			if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then
-				${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR}
+		echo "${my_output}" | while read x; do
+			if [[ -f "${x}"/.webapp ]]; then
+				. "${x}"/.webapp
+				if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then
+					${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR}
+				fi
+			else
+				ewarn "Cannot find file ${x}/.webapp"
 			fi
 		done
-	else
-
+	elif [[ "${my_output}" != "" ]]; then
+		echo
+		ewarn
 		ewarn "Don't forget to use webapp-config to remove any copies of"
 		ewarn "${PN}-${PVR} installed in"
 		ewarn
 
-		for x in ${my_output}; do
-			[[ -f ${x}/.webapp ]] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp"
-			ewarn "    ${x}"
+		echo "${my_output}" | while read x; do
+			if [[ -f "${x}"/.webapp ]]; then
+				ewarn "    ${x}"
+			else
+				ewarn "Cannot find file ${x}/.webapp"
+			fi
 		done
+
+		ewarn
+		echo
 	fi
 }



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 14:33 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 14:33 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 14:33:36

  Modified:             webapp.eclass
  Log:
  DRY up webapp_serverowned; extend warning messages

Revision  Changes    Path
1.55                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- webapp.eclass	22 Feb 2008 14:27:17 -0000	1.54
+++ webapp.eclass	22 Feb 2008 14:33:35 -0000	1.55
@@ -1,6 +1,6 @@
 # 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.54 2008/02/22 14:27:17 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.55 2008/02/22 14:33:35 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -174,6 +174,18 @@
 	cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt"
 }
 
+# helper for webapp_serverowned()
+_webapp_serverowned() {
+	debug-print-function $FUNCNAME $*
+
+	webapp_checkfileexists "${1}" "${D}"
+	local my_file="$(webapp_strip_appdir "${1}")"
+	my_file="$(webapp_strip_cwd "${my_file}")"
+
+	elog "(server owned) ${my_file}"
+	echo "${my_file}" >> "${D}/${WA_SOLIST}"
+}
+
 # @FUNCTION: webapp_serverowned
 # @USAGE: [-R] <file> [more files ...]
 # @DESCRIPTION:
@@ -187,24 +199,14 @@
 	if [[ "${1}" == "-R" ]]; then
 		shift
 		for m in "$@"; do
-			for a in $(find ${D}/${m}); do
-				a=${a/${D}\/\///}
-				webapp_checkfileexists "${a}" "$D"
-				local my_file="$(webapp_strip_appdir "${a}")"
-				my_file="$(webapp_strip_cwd "${my_file}")"
-
-				elog "(server owned) ${my_file}"
-				echo "${my_file}" >> "${D}/${WA_SOLIST}"
+			find "${D}${m}" | while read a; do
+				a=$(webapp_strip_d "${a}")
+				_webapp_serverowned "${a}"
 			done
 		done
 	else
 		for m in "$@"; do
-			webapp_checkfileexists "${m}" "$D"
-			local my_file="$(webapp_strip_appdir "${m}")"
-			my_file="$(webapp_strip_cwd "${my_file}")"
-
-			elog "(server owned) ${my_file}"
-			echo "${my_file}" >> "${D}/${WA_SOLIST}"
+			_webapp_serverowned "${m}"
 		done
 	fi
 }
@@ -341,6 +343,8 @@
 
 	if [[ $? -ne 0 ]]; then
 		# okay, whatever is there, it isn't webapp-config-compatible
+		echo
+		ewarn
 		ewarn "You already have something installed in ${my_dir}"
 		ewarn
 		ewarn "Whatever is in ${my_dir}, it's not"
@@ -348,9 +352,15 @@
 		ewarn
 		ewarn "This ebuild may be overwriting important files."
 		ewarn
+		echo
+		ebeep 10
 	elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
-		eerror "${my_dir} contains ${my_output}"
-		eerror "I cannot upgrade that"
+		echo
+		eerror "You already have ${my_output} installed in ${my_dir}"
+		eerror
+		eerror "I cannot upgrade a different application"
+		eerror
+		echo
 		die "Cannot upgrade contents of ${my_dir}"
 	fi
 }
@@ -386,12 +396,12 @@
 		echo
 		elog "vhosts USE flag not set - auto-installing using webapp-config"
 
-		webapp_getinstalltype
-
 		G_HOSTNAME="localhost"
-		local my_mode=-I
 		webapp_read_config
 
+		local my_mode=-I
+		webapp_getinstalltype
+
 		if [[ "${IS_REPLACE}" == "1" ]]; then
 			elog "${PN}-${PVR} is already installed - replacing"
 			my_mode=-I



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 14:27 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 14:27 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 14:27:18

  Modified:             webapp.eclass
  Log:
  get rid of too much indention; consistency cleanup

Revision  Changes    Path
1.54                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- webapp.eclass	22 Feb 2008 14:06:05 -0000	1.53
+++ webapp.eclass	22 Feb 2008 14:27:17 -0000	1.54
@@ -1,6 +1,6 @@
 # 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.53 2008/02/22 14:06:05 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.54 2008/02/22 14:27:17 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -80,35 +80,33 @@
 
 webapp_getinstalltype() {
 	debug-print-function $FUNCNAME $*
+	use vhosts && return
 
-	if ! use vhosts; then
-		local my_output
+	local my_output
+	my_output="$(webapp_check_installedat)"
+
+	if [[ $? -eq 0 ]]; then
+		# something is already installed there
+		# make sure it isn't the same version
+
+		local my_pn="$(echo ${my_output} | awk '{ print $1 }')"
+		local my_pvr="$(echo ${my_output} | awk '{ print $2 }')"
 
-		my_output="$(webapp_check_installedat)"
+		REMOVE_PKG="${my_pn}-${my_pvr}"
 
-		if [[ $? -eq 0 ]]; then
-			# something is already installed there
-			# make sure it isn't the same version
-
-			local my_pn="$(echo ${my_output} | awk '{ print $1 }')"
-			local my_pvr="$(echo ${my_output} | awk '{ print $2 }')"
-
-			REMOVE_PKG="${my_pn}-${my_pvr}"
-
-			if [[ "${my_pn}" == "${PN}" ]]; then
-				if [[ "${my_pvr}" != "${PVR}" ]]; then
-					elog "This is an upgrade"
-					IS_UPGRADE=1
-				else
-					elog "This is a re-installation"
-					IS_REPLACE=1
-				fi
+		if [[ "${my_pn}" == "${PN}" ]]; then
+			if [[ "${my_pvr}" != "${PVR}" ]]; then
+				elog "This is an upgrade"
+				IS_UPGRADE=1
 			else
-				elog "${my_output} is installed there"
+				elog "This is a re-installation"
+				IS_REPLACE=1
 			fi
 		else
-			elog "This is an installation"
+			elog "${my_output} is installed there"
 		fi
+	else
+		elog "This is an installation"
 	fi
 }
 
@@ -123,15 +121,15 @@
 webapp_configfile() {
 	debug-print-function $FUNCNAME $*
 
-	local m=""
+	local m
 	for m in "$@"; do
 		webapp_checkfileexists "${m}" "${D}"
 
-		local MY_FILE="$(webapp_strip_appdir "${m}")"
-		MY_FILE="$(webapp_strip_cwd "${MY_FILE}")"
+		local my_file="$(webapp_strip_appdir "${m}")"
+		my_file="$(webapp_strip_cwd "${my_file}")"
 
-		elog "(config) ${MY_FILE}"
-		echo "${MY_FILE}" >> ${D}/${WA_CONFIGLIST}
+		elog "(config) ${my_file}"
+		echo "${my_file}" >> ${D}/${WA_CONFIGLIST}
 	done
 }
 
@@ -185,29 +183,28 @@
 webapp_serverowned() {
 	debug-print-function $FUNCNAME $*
 
-	local a=""
-	local m=""
+	local a m
 	if [[ "${1}" == "-R" ]]; then
 		shift
 		for m in "$@"; do
 			for a in $(find ${D}/${m}); do
 				a=${a/${D}\/\///}
 				webapp_checkfileexists "${a}" "$D"
-				local MY_FILE="$(webapp_strip_appdir "${a}")"
-				MY_FILE="$(webapp_strip_cwd "${MY_FILE}")"
+				local my_file="$(webapp_strip_appdir "${a}")"
+				my_file="$(webapp_strip_cwd "${my_file}")"
 
-				elog "(server owned) ${MY_FILE}"
-				echo "${MY_FILE}" >> "${D}/${WA_SOLIST}"
+				elog "(server owned) ${my_file}"
+				echo "${my_file}" >> "${D}/${WA_SOLIST}"
 			done
 		done
 	else
 		for m in "$@"; do
 			webapp_checkfileexists "${m}" "$D"
-			local MY_FILE="$(webapp_strip_appdir "${m}")"
-			MY_FILE="$(webapp_strip_cwd "${MY_FILE}")"
+			local my_file="$(webapp_strip_appdir "${m}")"
+			my_file="$(webapp_strip_cwd "${my_file}")"
 
-			elog "(server owned) ${MY_FILE}"
-			echo "${MY_FILE}" >> "${D}/${WA_SOLIST}"
+			elog "(server owned) ${my_file}"
+			echo "${my_file}" >> "${D}/${WA_SOLIST}"
 		done
 	fi
 }
@@ -247,9 +244,7 @@
 
 	webapp_checkfileexists "${2}"
 
-	if [[ ! -d "${D}/${MY_SQLSCRIPTSDIR}/${1}" ]]; then
-		mkdir -p "${D}/${MY_SQLSCRIPTSDIR}/${1}" || die "unable to create directory ${D}/${MY_SQLSCRIPTSDIR}/${1}"
-	fi
+	dodir "${MY_SQLSCRIPTSDIR}/${1}"
 
 	# WARNING:
 	#
@@ -336,30 +331,27 @@
 	G_HOSTNAME="localhost"
 	webapp_read_config
 
-	# are we installing a webapp-config solution over the top of a
-	# non-webapp-config solution?
-	if ! use vhosts; then
-		local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
-		local my_output
+	local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
 
-		if [[ -d "${my_dir}" ]]; then
-			my_output="$(webapp_check_installedat)"
+	# if USE=vhosts is enabled OR no application is installed we're done here
+	use vhosts || [[ ! -d "${my_dir}" ]] && return
 
-			if [[ $? -ne 0 ]]; then
-				# okay, whatever is there, it isn't webapp-config-compatible
-				ewarn "You already have something installed in ${my_dir}"
-				ewarn
-				ewarn "Whatever is in ${my_dir}, it's not"
-				ewarn "compatible with webapp-config."
-				ewarn
-				ewarn "This ebuild may be overwriting important files."
-				ewarn
-			elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
-				eerror "${my_dir} contains ${my_output}"
-				eerror "I cannot upgrade that"
-				die "Cannot upgrade contents of ${my_dir}"
-			fi
-		fi
+	local my_output
+	my_output="$(webapp_check_installedat)"
+
+	if [[ $? -ne 0 ]]; then
+		# okay, whatever is there, it isn't webapp-config-compatible
+		ewarn "You already have something installed in ${my_dir}"
+		ewarn
+		ewarn "Whatever is in ${my_dir}, it's not"
+		ewarn "compatible with webapp-config."
+		ewarn
+		ewarn "This ebuild may be overwriting important files."
+		ewarn
+	elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
+		eerror "${my_dir} contains ${my_output}"
+		eerror "I cannot upgrade that"
+		die "Cannot upgrade contents of ${my_dir}"
 	fi
 }
 



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 14:06 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 14:06 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 14:06:05

  Modified:             webapp.eclass
  Log:
  use bash keyword for tests; minor cleanups

Revision  Changes    Path
1.53                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- webapp.eclass	22 Feb 2008 13:53:38 -0000	1.52
+++ webapp.eclass	22 Feb 2008 14:06:05 -0000	1.53
@@ -1,6 +1,6 @@
 # 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.52 2008/02/22 13:53:38 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.53 2008/02/22 14:06:05 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -50,7 +50,7 @@
 
 	local my_prefix=${2:+${2}/}
 
-	if [ ! -e "${my_prefix}${1}" ]; then
+	if [[ ! -e "${my_prefix}${1}" ]]; then
 		msg="ebuild fault: file '${1}' not found"
 		eerror "$msg"
 		eerror "Please report this as a bug at http://bugs.gentoo.org/"
@@ -81,12 +81,12 @@
 webapp_getinstalltype() {
 	debug-print-function $FUNCNAME $*
 
-	if ! use vhosts ; then
+	if ! use vhosts; then
 		local my_output
 
 		my_output="$(webapp_check_installedat)"
 
-		if [ "${?}" = "0" ] ; then
+		if [[ $? -eq 0 ]]; then
 			# something is already installed there
 			# make sure it isn't the same version
 
@@ -95,8 +95,8 @@
 
 			REMOVE_PKG="${my_pn}-${my_pvr}"
 
-			if [ "${my_pn}" == "${PN}" ]; then
-				if [ "${my_pvr}" != "${PVR}" ]; then
+			if [[ "${my_pn}" == "${PN}" ]]; then
+				if [[ "${my_pvr}" != "${PVR}" ]]; then
 					elog "This is an upgrade"
 					IS_UPGRADE=1
 				else
@@ -124,7 +124,7 @@
 	debug-print-function $FUNCNAME $*
 
 	local m=""
-	for m in "$@" ; do
+	for m in "$@"; do
 		webapp_checkfileexists "${m}" "${D}"
 
 		local MY_FILE="$(webapp_strip_appdir "${m}")"
@@ -187,9 +187,9 @@
 
 	local a=""
 	local m=""
-	if [ "${1}" = "-R" ]; then
+	if [[ "${1}" == "-R" ]]; then
 		shift
-		for m in "$@" ; do
+		for m in "$@"; do
 			for a in $(find ${D}/${m}); do
 				a=${a/${D}\/\///}
 				webapp_checkfileexists "${a}" "$D"
@@ -201,7 +201,7 @@
 			done
 		done
 	else
-		for m in "$@" ; do
+		for m in "$@"; do
 			webapp_checkfileexists "${m}" "$D"
 			local MY_FILE="$(webapp_strip_appdir "${m}")"
 			MY_FILE="$(webapp_strip_cwd "${MY_FILE}")"
@@ -247,7 +247,7 @@
 
 	webapp_checkfileexists "${2}"
 
-	if [ ! -d "${D}/${MY_SQLSCRIPTSDIR}/${1}" ]; then
+	if [[ ! -d "${D}/${MY_SQLSCRIPTSDIR}/${1}" ]]; then
 		mkdir -p "${D}/${MY_SQLSCRIPTSDIR}/${1}" || die "unable to create directory ${D}/${MY_SQLSCRIPTSDIR}/${1}"
 	fi
 
@@ -256,8 +256,8 @@
 	# do NOT change the naming convention used here without changing all
 	# the other scripts that also rely upon these names
 
-	if [ -n "${3}" ]; then
-		elog "(${1}) upgrade script from ${PN}-${PVR} to ${3}"
+	if [[ -n "${3}" ]]; then
+		elog "(${1}) upgrade script for ${PN}-${3} to ${PVR}"
 		cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
 		chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
 	else
@@ -338,14 +338,14 @@
 
 	# are we installing a webapp-config solution over the top of a
 	# non-webapp-config solution?
-	if ! use vhosts ; then
+	if ! use vhosts; then
 		local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
 		local my_output
 
-		if [ -d "${my_dir}" ] ; then
+		if [[ -d "${my_dir}" ]]; then
 			my_output="$(webapp_check_installedat)"
 
-			if [ "$?" != "0" ]; then
+			if [[ $? -ne 0 ]]; then
 				# okay, whatever is there, it isn't webapp-config-compatible
 				ewarn "You already have something installed in ${my_dir}"
 				ewarn
@@ -354,7 +354,7 @@
 				ewarn
 				ewarn "This ebuild may be overwriting important files."
 				ewarn
-			elif [ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]; then
+			elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
 				eerror "${my_dir} contains ${my_output}"
 				eerror "I cannot upgrade that"
 				die "Cannot upgrade contents of ${my_dir}"
@@ -377,7 +377,7 @@
 	webapp_read_config
 
 	# sanity checks, to catch bugs in the ebuild
-	if [ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]; then
+	if [[ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]]; then
 		eerror
 		eerror "This ebuild did not call webapp_src_install() at the end"
 		eerror "of the src_install() function"
@@ -390,7 +390,7 @@
 		die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org"
 	fi
 
-	if ! use vhosts ; then
+	if ! use vhosts; then
 		echo
 		elog "vhosts USE flag not set - auto-installing using webapp-config"
 
@@ -400,10 +400,10 @@
 		local my_mode=-I
 		webapp_read_config
 
-		if [ "${IS_REPLACE}" = "1" ]; then
+		if [[ "${IS_REPLACE}" == "1" ]]; then
 			elog "${PN}-${PVR} is already installed - replacing"
 			my_mode=-I
-		elif [ "${IS_UPGRADE}" = "1" ]; then
+		elif [[ "${IS_UPGRADE}" == "1" ]]; then
 			elog "${REMOVE_PKG} is already installed - upgrading"
 			my_mode=-U
 		else
@@ -430,8 +430,6 @@
 		elog
 		elog "For more details, see the webapp-config(8) man page"
 	fi
-
-	return 0
 }
 
 # @FUNCTION: webapp_pkg_prerm
@@ -442,20 +440,16 @@
 webapp_pkg_prerm() {
 	debug-print-function $FUNCNAME $*
 
-	local my_output
-	local x
-
+	local my_output=
 	my_output="$(${WEBAPP_CONFIG} --list-installs ${PN} ${PVR})"
+	[[ $? -ne 0 ]] && return
 
-	if [ "${?}" != "0" ]; then
-		return
-	fi
-
-	if ! use vhosts ; then
+	local x
+	if ! use vhosts; then
 
-		for x in ${my_output} ; do
-			[ -f ${x}/.webapp ] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp"
-			if [ "${WEB_HOSTNAME}" -a "${WEB_INSTALLDIR}" ]; then
+		for x in ${my_output}; do
+			[[ -f ${x}/.webapp ]] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp"
+			if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then
 				${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR}
 			fi
 		done
@@ -465,8 +459,8 @@
 		ewarn "${PN}-${PVR} installed in"
 		ewarn
 
-		for x in ${my_output} ; do
-			[ -f ${x}/.webapp ] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp"
+		for x in ${my_output}; do
+			[[ -f ${x}/.webapp ]] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp"
 			ewarn "    ${x}"
 		done
 	fi



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 13:53 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 13:53 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 13:53:38

  Modified:             webapp.eclass
  Log:
  replace sed and [] calls with bash expansion

Revision  Changes    Path
1.52                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- webapp.eclass	22 Feb 2008 13:44:41 -0000	1.51
+++ webapp.eclass	22 Feb 2008 13:53:38 -0000	1.52
@@ -1,6 +1,6 @@
 # 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.51 2008/02/22 13:44:41 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.52 2008/02/22 13:53:38 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -48,9 +48,7 @@
 webapp_checkfileexists() {
 	debug-print-function $FUNCNAME $*
 
-	local my_prefix
-
-	[ -n "${2}" ] && my_prefix="${2}/" || my_prefix=
+	local my_prefix=${2:+${2}/}
 
 	if [ ! -e "${my_prefix}${1}" ]; then
 		msg="ebuild fault: file '${1}' not found"
@@ -67,17 +65,17 @@
 
 webapp_strip_appdir() {
 	debug-print-function $FUNCNAME $*
-	echo "${1}" | sed -e "s|${MY_APPDIR}/||g;"
+	echo "${1#${MY_APPDIR}/}"
 }
 
 webapp_strip_d() {
 	debug-print-function $FUNCNAME $*
-	echo "${1}" | sed -e "s|${D}||g;"
+	echo "${1#${D}}"
 }
 
 webapp_strip_cwd() {
 	debug-print-function $FUNCNAME $*
-	echo "${1}" | sed -e 's|/./|/|g;'
+	echo "${1/#.\///}"
 }
 
 webapp_getinstalltype() {
@@ -231,12 +229,7 @@
 	# do NOT change the naming convention used here without changing all
 	# the other scripts that also rely upon these names
 
-	local my_file
-	if [ -z "${3}" ]; then
-		my_file="${1}-$(basename "${2}")"
-	else
-		my_file="${1}-${3}"
-	fi
+	local my_file="${1}-${3:-$(basename "${2}")}"
 
 	elog "(${1}) config file '${my_file}'"
 	cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}"



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 13:44 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 13:44 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 13:44:42

  Modified:             webapp.eclass
  Log:
  add eclass debugging; remove redundant comments

Revision  Changes    Path
1.51                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- webapp.eclass	22 Feb 2008 10:03:55 -0000	1.50
+++ webapp.eclass	22 Feb 2008 13:44:41 -0000	1.51
@@ -1,6 +1,6 @@
 # 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.50 2008/02/22 10:03:55 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.51 2008/02/22 13:44:41 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -23,9 +23,9 @@
 
 INSTALL_CHECK_FILE="installed_by_webapp_eclass"
 
-ETC_CONFIG="${ROOT}/etc/vhosts/webapp-config"
-WEBAPP_CONFIG="${ROOT}/usr/sbin/webapp-config"
-WEBAPP_CLEANER="${ROOT}/usr/sbin/webapp-cleaner"
+ETC_CONFIG="${ROOT}etc/vhosts/webapp-config"
+WEBAPP_CONFIG="${ROOT}usr/sbin/webapp-config"
+WEBAPP_CLEANER="${ROOT}usr/sbin/webapp-cleaner"
 
 # ==============================================================================
 # INTERNAL FUNCTIONS
@@ -34,6 +34,8 @@
 # Load the config file /etc/vhosts/webapp-config
 # Supports both the old bash version, and the new python version
 webapp_read_config() {
+	debug-print-function $FUNCNAME $*
+
 	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}
@@ -44,6 +46,8 @@
 
 # Check whether a specified file exists in the given directory (`.' by default)
 webapp_checkfileexists() {
+	debug-print-function $FUNCNAME $*
+
 	local my_prefix
 
 	[ -n "${2}" ] && my_prefix="${2}/" || my_prefix=
@@ -57,36 +61,35 @@
 }
 
 webapp_check_installedat() {
+	debug-print-function $FUNCNAME $*
 	${WEBAPP_CONFIG} --show-installed -h localhost -d "${INSTALL_DIR}" 2> /dev/null
 }
 
 webapp_strip_appdir() {
-	local my_stripped="${1}"
+	debug-print-function $FUNCNAME $*
 	echo "${1}" | sed -e "s|${MY_APPDIR}/||g;"
 }
 
 webapp_strip_d() {
+	debug-print-function $FUNCNAME $*
 	echo "${1}" | sed -e "s|${D}||g;"
 }
 
 webapp_strip_cwd() {
-	local my_stripped="${1}"
+	debug-print-function $FUNCNAME $*
 	echo "${1}" | sed -e 's|/./|/|g;'
 }
 
 webapp_getinstalltype() {
-	# or are we upgrading?
+	debug-print-function $FUNCNAME $*
 
 	if ! use vhosts ; then
-		# we only run webapp-config if vhosts USE flag is not set
-
 		local my_output
 
 		my_output="$(webapp_check_installedat)"
 
 		if [ "${?}" = "0" ] ; then
 			# something is already installed there
-			#
 			# make sure it isn't the same version
 
 			local my_pn="$(echo ${my_output} | awk '{ print $1 }')"
@@ -120,6 +123,8 @@
 # @DESCRIPTION:
 # Mark a file config-protected for a web-based application.
 webapp_configfile() {
+	debug-print-function $FUNCNAME $*
+
 	local m=""
 	for m in "$@" ; do
 		webapp_checkfileexists "${m}" "${D}"
@@ -138,6 +143,8 @@
 # Install a script that will run after a virtual copy is created, and
 # before a virtual copy has been removed.
 webapp_hook_script() {
+	debug-print-function $FUNCNAME $*
+
 	webapp_checkfileexists "${1}"
 
 	elog "(hook) ${1}"
@@ -150,6 +157,8 @@
 # @DESCRIPTION:
 # Install a text file containing post-installation instructions.
 webapp_postinst_txt() {
+	debug-print-function $FUNCNAME $*
+
 	webapp_checkfileexists "${2}"
 
 	elog "(info) ${2} (lang: ${1})"
@@ -161,6 +170,8 @@
 # @DESCRIPTION:
 # Install a text file containing post-upgrade instructions.
 webapp_postupgrade_txt() {
+	debug-print-function $FUNCNAME $*
+
 	webapp_checkfileexists "${2}"
 
 	elog "(info) ${2} (lang: ${1})"
@@ -174,6 +185,8 @@
 # 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() {
+	debug-print-function $FUNCNAME $*
+
 	local a=""
 	local m=""
 	if [ "${1}" = "-R" ]; then
@@ -209,23 +222,22 @@
 # used by default. Note: this function will automagically prepend $1 to the
 # front of your config file's name.
 webapp_server_configfile() {
+	debug-print-function $FUNCNAME $*
+
 	webapp_checkfileexists "${2}"
 
-	# sort out what the name will be of the config file
+	# WARNING:
+	#
+	# do NOT change the naming convention used here without changing all
+	# the other scripts that also rely upon these names
 
 	local my_file
-
 	if [ -z "${3}" ]; then
 		my_file="${1}-$(basename "${2}")"
 	else
 		my_file="${1}-${3}"
 	fi
 
-	# warning:
-	#
-	# do NOT change the naming convention used here without changing all
-	# the other scripts that also rely upon these names
-
 	elog "(${1}) config file '${my_file}'"
 	cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}"
 }
@@ -238,30 +250,24 @@
 # If a version is given the script should upgrade the database schema from
 # the given version to $PVR.
 webapp_sqlscript() {
-	webapp_checkfileexists "${2}"
+	debug-print-function $FUNCNAME $*
 
-	# create the directory where this script will go
-	#
-	# scripts for specific database engines go into their own subdirectory
-	# just to keep things readable on the filesystem
+	webapp_checkfileexists "${2}"
 
 	if [ ! -d "${D}/${MY_SQLSCRIPTSDIR}/${1}" ]; then
 		mkdir -p "${D}/${MY_SQLSCRIPTSDIR}/${1}" || die "unable to create directory ${D}/${MY_SQLSCRIPTSDIR}/${1}"
 	fi
 
-	# warning:
+	# WARNING:
 	#
 	# do NOT change the naming convention used here without changing all
 	# the other scripts that also rely upon these names
 
-	# are we dealing with an 'upgrade'-type script?
 	if [ -n "${3}" ]; then
-		# yes we are
 		elog "(${1}) upgrade script from ${PN}-${PVR} to ${3}"
 		cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
 		chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
 	else
-		# no, we are not
 		elog "(${1}) create script for ${PN}-${PVR}"
 		cp "${2}" "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql"
 		chmod 600 "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql"
@@ -273,6 +279,8 @@
 # You need to call this function in src_install() BEFORE anything else has run.
 # For now we just create required webapp-config directories.
 webapp_src_preinst() {
+	debug-print-function $FUNCNAME $*
+
 	dodir "${MY_HTDOCSDIR}"
 	dodir "${MY_HOSTROOTDIR}"
 	dodir "${MY_CGIBINDIR}"
@@ -295,6 +303,8 @@
 # You need to call this function AFTER everything else has run in your custom
 # src_install().
 webapp_src_install() {
+	debug-print-function $FUNCNAME $*
+
 	chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
 	chmod -R u-s "${D}/"
 	chmod -R g-s "${D}/"
@@ -322,7 +332,7 @@
 # You need to call this function BEFORE anything else has run in your custom
 # pkg_setup().
 webapp_pkg_setup() {
-	# add sanity checks here
+	debug-print-function $FUNCNAME $*
 
 	# special case - some ebuilds *do* need to overwride the SLOT
 	if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then
@@ -330,13 +340,11 @@
 	fi
 
 	# pull in the shared configuration file
-
 	G_HOSTNAME="localhost"
 	webapp_read_config
 
 	# are we installing a webapp-config solution over the top of a
 	# non-webapp-config solution?
-
 	if ! use vhosts ; then
 		local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
 		local my_output
@@ -371,10 +379,11 @@
 # You need to call this function AFTER everything else has run in your custom
 # pkg_postinst().
 webapp_pkg_postinst() {
+	debug-print-function $FUNCNAME $*
+
 	webapp_read_config
 
 	# sanity checks, to catch bugs in the ebuild
-
 	if [ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]; then
 		eerror
 		eerror "This ebuild did not call webapp_src_install() at the end"
@@ -388,9 +397,6 @@
 		die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org"
 	fi
 
-	# if 'vhosts' is not set in your USE flags, we install a copy of
-	# this application in ${ROOT}/var/www/localhost/htdocs/${PN}/ for you
-
 	if ! use vhosts ; then
 		echo
 		elog "vhosts USE flag not set - auto-installing using webapp-config"
@@ -415,16 +421,11 @@
 		elog "Running ${my_cmd}"
 		${my_cmd}
 
-		# run webapp-cleaner instead of emerge
 		echo
 		local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
 		einfo "Running ${cleaner}"
 		${cleaner}
 	else
-		# vhosts flag is on
-		#
-		# let's tell the administrator what to do next
-
 		elog
 		elog "The 'vhosts' USE flag is switched ON"
 		elog "This means that Portage will not automatically run webapp-config to"
@@ -444,9 +445,9 @@
 # @DESCRIPTION:
 # This is the default pkg_prerm() for this eclass. If USE=vhosts is not set
 # remove all installed copies of this web application. Otherwise instruct the
-# user to manually remove those copies.
+# user to manually remove those copies. See bug #136959.
 webapp_pkg_prerm() {
-	# remove any virtual installs that there are
+	debug-print-function $FUNCNAME $*
 
 	local my_output
 	local x
@@ -457,7 +458,7 @@
 		return
 	fi
 
-	if ! use vhosts ; then # remove any installed copies
+	if ! use vhosts ; then
 
 		for x in ${my_output} ; do
 			[ -f ${x}/.webapp ] && . ${x}/.webapp || ewarn "Cannot find file ${x}/.webapp"
@@ -465,7 +466,7 @@
 				${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR}
 			fi
 		done
-	else # don't remove anything, but warn user. bug #136959
+	else
 
 		ewarn "Don't forget to use webapp-config to remove any copies of"
 		ewarn "${PN}-${PVR} installed in"



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22 10:03 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22 10:03 UTC (permalink / raw
  To: gentoo-commits

hollow      08/02/22 10:03:55

  Modified:             webapp.eclass
  Log:
  document missing parts

Revision  Changes    Path
1.50                 eclass/webapp.eclass

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

Index: webapp.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- webapp.eclass	22 Feb 2008 09:33:45 -0000	1.49
+++ webapp.eclass	22 Feb 2008 10:03:55 -0000	1.50
@@ -1,6 +1,6 @@
 # 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.49 2008/02/22 09:33:45 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.50 2008/02/22 10:03:55 hollow Exp $
 #
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
@@ -43,7 +43,6 @@
 }
 
 # Check whether a specified file exists in the given directory (`.' by default)
-# or not.
 webapp_checkfileexists() {
 	local my_prefix
 
@@ -75,6 +74,43 @@
 	echo "${1}" | sed -e 's|/./|/|g;'
 }
 
+webapp_getinstalltype() {
+	# or are we upgrading?
+
+	if ! use vhosts ; then
+		# we only run webapp-config if vhosts USE flag is not set
+
+		local my_output
+
+		my_output="$(webapp_check_installedat)"
+
+		if [ "${?}" = "0" ] ; then
+			# something is already installed there
+			#
+			# make sure it isn't the same version
+
+			local my_pn="$(echo ${my_output} | awk '{ print $1 }')"
+			local my_pvr="$(echo ${my_output} | awk '{ print $2 }')"
+
+			REMOVE_PKG="${my_pn}-${my_pvr}"
+
+			if [ "${my_pn}" == "${PN}" ]; then
+				if [ "${my_pvr}" != "${PVR}" ]; then
+					elog "This is an upgrade"
+					IS_UPGRADE=1
+				else
+					elog "This is a re-installation"
+					IS_REPLACE=1
+				fi
+			else
+				elog "${my_output} is installed there"
+			fi
+		else
+			elog "This is an installation"
+		fi
+	fi
+}
+
 # ==============================================================================
 # PUBLIC FUNCTIONS
 # ==============================================================================
@@ -232,15 +268,32 @@
 	fi
 }
 
+# @FUNCTION: webapp_src_preinst
+# @DESCRIPTION:
+# You need to call this function in src_install() BEFORE anything else has run.
+# For now we just create required webapp-config directories.
+webapp_src_preinst() {
+	dodir "${MY_HTDOCSDIR}"
+	dodir "${MY_HOSTROOTDIR}"
+	dodir "${MY_CGIBINDIR}"
+	dodir "${MY_ICONSDIR}"
+	dodir "${MY_ERRORSDIR}"
+	dodir "${MY_SQLSCRIPTSDIR}"
+	dodir "${MY_HOOKSCRIPTSDIR}"
+	dodir "${MY_SERVERCONFIGDIR}"
+}
+
 # ==============================================================================
 # 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.
+# This is the default src_install(). For now, we just make sure that root owns
+# everything, and that there are no setuid files.
+#
+# You need to call this function AFTER everything else has run in your custom
+# src_install().
 webapp_src_install() {
 	chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
 	chmod -R u-s "${D}/"
@@ -262,8 +315,12 @@
 
 # @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.
+# The default pkg_setup() for this eclass. This will gather required variables
+# from webapp-config and check if there is an application installed to
+# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set.
+#
+# You need to call this function BEFORE anything else has run in your custom
+# pkg_setup().
 webapp_pkg_setup() {
 	# add sanity checks here
 
@@ -305,56 +362,14 @@
 	fi
 }
 
-webapp_getinstalltype() {
-	# or are we upgrading?
-
-	if ! use vhosts ; then
-		# we only run webapp-config if vhosts USE flag is not set
-
-		local my_output
-
-		my_output="$(webapp_check_installedat)"
-
-		if [ "${?}" = "0" ] ; then
-			# something is already installed there
-			#
-			# make sure it isn't the same version
-
-			local my_pn="$(echo ${my_output} | awk '{ print $1 }')"
-			local my_pvr="$(echo ${my_output} | awk '{ print $2 }')"
-
-			REMOVE_PKG="${my_pn}-${my_pvr}"
-
-			if [ "${my_pn}" == "${PN}" ]; then
-				if [ "${my_pvr}" != "${PVR}" ]; then
-					elog "This is an upgrade"
-					IS_UPGRADE=1
-				else
-					elog "This is a re-installation"
-					IS_REPLACE=1
-				fi
-			else
-				elog "${my_output} is installed there"
-			fi
-		else
-			elog "This is an installation"
-		fi
-	fi
-}
-
-webapp_src_preinst() {
-	# create the directories that we need
-
-	dodir "${MY_HTDOCSDIR}"
-	dodir "${MY_HOSTROOTDIR}"
-	dodir "${MY_CGIBINDIR}"
-	dodir "${MY_ICONSDIR}"
-	dodir "${MY_ERRORSDIR}"
-	dodir "${MY_SQLSCRIPTSDIR}"
-	dodir "${MY_HOOKSCRIPTSDIR}"
-	dodir "${MY_SERVERCONFIGDIR}"
-}
-
+# @FUNCTION: webapp_pkg_postinst
+# @DESCRIPTION:
+# The default pkg_postinst() for this eclass. This installs the web application to
+# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set. Otherwise
+# display a short notice how to install this application with webapp-config.
+#
+# You need to call this function AFTER everything else has run in your custom
+# pkg_postinst().
 webapp_pkg_postinst() {
 	webapp_read_config
 
@@ -425,6 +440,11 @@
 	return 0
 }
 
+# @FUNCTION: webapp_pkg_prerm
+# @DESCRIPTION:
+# This is the default pkg_prerm() for this eclass. If USE=vhosts is not set
+# remove all installed copies of this web application. Otherwise instruct the
+# user to manually remove those copies.
 webapp_pkg_prerm() {
 	# remove any virtual installs that there are
 



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



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
@ 2008-02-22  9:33 Benedikt Boehm (hollow)
  0 siblings, 0 replies; 23+ messages in thread
From: Benedikt Boehm (hollow) @ 2008-02-22  9:33 UTC (permalink / raw
  To: gentoo-commits

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



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-07-02 14:02 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox