commit:     574a0a4d399e420753cbf4a291051cb7e4c15d13
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 24 17:54:33 2025 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Thu Dec 25 14:57:51 2025 +0000
URL:        https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=574a0a4d

Update the eclass copy

Copy the updated eclass from gentoo repo.

Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 eclass/webapp.eclass | 130 ++++++++++++++++++++++++++-------------------------
 1 file changed, 66 insertions(+), 64 deletions(-)

diff --git a/eclass/webapp.eclass b/eclass/webapp.eclass
index 3d4ca28..ded66fa 100644
--- a/eclass/webapp.eclass
+++ b/eclass/webapp.eclass
@@ -1,28 +1,38 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2024 Gentoo Authors
 # 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 $
 
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
 # [email protected]
+# @SUPPORTED_EAPIS: 7 8
 # @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
 
-# @ECLASS-VARIABLE: WEBAPP_DEPEND
+if [[ -z ${_WEBAPP_ECLASS} ]]; then
+_WEBAPP_ECLASS=1
+
+case ${EAPI} in
+       7|8) ;;
+       *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+# @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-1.50.15"
+WEBAPP_DEPEND="app-admin/webapp-config"
 
-# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL
+# @ECLASS_VARIABLE: WEBAPP_NO_AUTO_INSTALL
+# @PRE_INHERIT
 # @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().
 
-# @ECLASS-VARIABLE: WEBAPP_OPTIONAL
+# @ECLASS_VARIABLE: WEBAPP_OPTIONAL
+# @PRE_INHERIT
 # @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.
@@ -34,8 +44,6 @@ if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
        RDEPEND="${DEPEND}"
 fi
 
-EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
-
 INSTALL_DIR="/${PN}"
 IS_UPGRADE=0
 IS_REPLACE=0
@@ -43,9 +51,9 @@ 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"
-WEBAPP_CLEANER="${ROOT}usr/sbin/webapp-cleaner"
+ETC_CONFIG="${EROOT}/etc/vhosts/webapp-config"
+WEBAPP_CONFIG="${EROOT}/usr/sbin/webapp-config"
+WEBAPP_CLEANER="${EROOT}/usr/sbin/webapp-cleaner"
 
 # 
==============================================================================
 # INTERNAL FUNCTIONS
@@ -54,7 +62,7 @@ WEBAPP_CLEANER="${ROOT}usr/sbin/webapp-cleaner"
 # 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 $*
+       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!"
@@ -71,40 +79,25 @@ webapp_read_config() {
 
 # Check whether a specified file exists in the given directory (`.' by default)
 webapp_checkfileexists() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        local my_prefix=${2:+${2}/}
 
        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/";
+               eerror "Please report this as a bug at https://bugs.gentoo.org/";
                die "$msg"
        fi
 }
 
 webapp_check_installedat() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
        ${WEBAPP_CONFIG} --show-installed -h localhost -d "${INSTALL_DIR}" 2> 
/dev/null
 }
 
-webapp_strip_appdir() {
-       debug-print-function $FUNCNAME $*
-       echo "${1#${MY_APPDIR}/}"
-}
-
-webapp_strip_d() {
-       debug-print-function $FUNCNAME $*
-       echo "${1#${D}}"
-}
-
-webapp_strip_cwd() {
-       debug-print-function $FUNCNAME $*
-       echo "${1/#.\///}"
-}
-
 webapp_getinstalltype() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        if ! has vhosts ${IUSE} || use vhosts; then
                return
@@ -181,17 +174,20 @@ need_httpd_fastcgi() {
 # @DESCRIPTION:
 # Mark a file config-protected for a web-based application.
 webapp_configfile() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        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
+               # Strip appdir
+               my_file="${m#${MY_APPDIR}/}"
+               # Strip cwd
+               my_file="${my_file/#.\///}"
 
                elog "(config) ${my_file}"
-               echo "${my_file}" >> ${D}/${WA_CONFIGLIST}
+               echo "${my_file}" >> "${D}/${WA_CONFIGLIST}"
        done
 }
 
@@ -201,7 +197,7 @@ webapp_configfile() {
 # 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 $*
+       debug-print-function ${FUNCNAME} "$@"
 
        webapp_checkfileexists "${1}"
 
@@ -215,7 +211,7 @@ webapp_hook_script() {
 # @DESCRIPTION:
 # Install a text file containing post-installation instructions.
 webapp_postinst_txt() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        webapp_checkfileexists "${2}"
 
@@ -228,7 +224,7 @@ webapp_postinst_txt() {
 # @DESCRIPTION:
 # Install a text file containing post-upgrade instructions.
 webapp_postupgrade_txt() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        webapp_checkfileexists "${2}"
 
@@ -238,13 +234,15 @@ webapp_postupgrade_txt() {
 
 # helper for webapp_serverowned()
 _webapp_serverowned() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        webapp_checkfileexists "${1}" "${D}"
-       local my_file="$(webapp_strip_appdir "${1}")"
-       my_file="$(webapp_strip_cwd "${my_file}")"
+       local my_file
+       # Strip appdir
+       my_file="${1#${MY_APPDIR}/}"
+       # Strip cwd
+       my_file="${my_file/#.\///}"
 
-       elog "(server owned) ${my_file}"
        echo "${my_file}" >> "${D}/${WA_SOLIST}"
 }
 
@@ -255,16 +253,17 @@ _webapp_serverowned() {
 # 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 $*
+       debug-print-function ${FUNCNAME} "$@"
 
-       local a m
+       local m
        if [[ "${1}" == "-R" ]]; then
                shift
                for m in "$@"; do
-                       find "${D}${m}" | while read a; do
-                               a=$(webapp_strip_d "${a}")
-                               _webapp_serverowned "${a}"
-                       done
+                       pushd "${D}${MY_APPDIR}" > /dev/null || die
+                       # Strip appdir
+                       m="${m#${MY_APPDIR}/}"
+                       find "${m}" >> "${D}/${WA_SOLIST}" || die
+                       popd > /dev/null || die
                done
        else
                for m in "$@"; do
@@ -281,7 +280,7 @@ webapp_serverowned() {
 # 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 $*
+       debug-print-function ${FUNCNAME} "$@"
 
        webapp_checkfileexists "${2}"
 
@@ -304,7 +303,7 @@ webapp_server_configfile() {
 # If a version is given the script should upgrade the database schema from
 # the given version to $PVR.
 webapp_sqlscript() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        webapp_checkfileexists "${2}"
 
@@ -331,7 +330,7 @@ webapp_sqlscript() {
 # 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 $*
+       debug-print-function ${FUNCNAME} "$@"
 
        # sanity checks, to catch bugs in the ebuild
        if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
@@ -339,12 +338,12 @@ webapp_src_preinst() {
                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 "Please log a bug on https://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";
+               die "Ebuild did not call webapp_pkg_setup() - report to 
https://bugs.gentoo.org";
        fi
 
        # Hint, see the webapp_read_config() function to find where these are
@@ -372,7 +371,7 @@ webapp_src_preinst() {
 # You need to call this function BEFORE anything else has run in your custom
 # pkg_setup().
 webapp_pkg_setup() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        # to test whether or not the ebuild has correctly called this function
        # we add an empty file to the filesystem
@@ -382,7 +381,7 @@ webapp_pkg_setup() {
        # webapp_src_install() within the same shell process
        touch "${T}/${SETUP_CHECK_FILE}"
 
-       # special case - some ebuilds *do* need to overwride the SLOT
+       # special case - some ebuilds *do* need to override the SLOT
        if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; 
then
                die "Set WEBAPP_MANUAL_SLOT=\"yes\" if you need to SLOT 
manually"
        fi
@@ -391,7 +390,7 @@ webapp_pkg_setup() {
        G_HOSTNAME="localhost"
        webapp_read_config
 
-       local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
+       local my_dir="${ROOT}/${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
 
        # if USE=vhosts is enabled OR no application is installed we're done 
here
        if ! has vhosts ${IUSE} || use vhosts || [[ ! -d "${my_dir}" ]]; then
@@ -413,7 +412,6 @@ webapp_pkg_setup() {
                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}"
@@ -434,7 +432,7 @@ webapp_pkg_setup() {
 # You need to call this function AFTER everything else has run in your custom
 # src_install().
 webapp_src_install() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        # to test whether or not the ebuild has correctly called this function
        # we add an empty file to the filesystem
@@ -449,7 +447,7 @@ webapp_src_install() {
        chmod -R g-s "${D}/"
 
        keepdir "${MY_PERSISTDIR}"
-       fowners "root:0" "${MY_PERSISTDIR}"
+       fowners "0:0" "${MY_PERSISTDIR}"
        fperms 755 "${MY_PERSISTDIR}"
 }
 
@@ -462,22 +460,22 @@ webapp_src_install() {
 # You need to call this function AFTER everything else has run in your custom
 # pkg_postinst().
 webapp_pkg_postinst() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        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"
                eerror
-               eerror "Please log a bug on http://bugs.gentoo.org";
+               eerror "Please log a bug on https://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_src_install() - report to 
http://bugs.gentoo.org";
+               die "Ebuild did not call webapp_src_install() - report to 
https://bugs.gentoo.org";
        fi
 
        if has vhosts ${IUSE}; then
@@ -541,7 +539,7 @@ webapp_pkg_postinst() {
 # remove all installed copies of this web application. Otherwise instruct the
 # user to manually remove those copies. See bug #136959.
 webapp_pkg_prerm() {
-       debug-print-function $FUNCNAME $*
+       debug-print-function ${FUNCNAME} "$@"
 
        local my_output=
        my_output="$(${WEBAPP_CONFIG} --list-installs ${PN} ${PVR})"
@@ -578,3 +576,7 @@ webapp_pkg_prerm() {
                echo
        fi
 }
+
+fi
+
+EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm

Reply via email to