Gentoo Archives: gentoo-commits

From: "Benedikt Boehm (hollow)" <hollow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: webapp.eclass
Date: Sat, 23 Feb 2008 23:54:44
Message-Id: E1JT4CX-0002b9-6N@stork.gentoo.org
1 hollow 08/02/23 23:54:41
2
3 Modified: webapp.eclass
4 Log:
5 make IUSE=vhosts optional
6
7 Revision Changes Path
8 1.59 eclass/webapp.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.59&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.59&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?r1=1.58&r2=1.59
13
14 Index: webapp.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v
17 retrieving revision 1.58
18 retrieving revision 1.59
19 diff -u -r1.58 -r1.59
20 --- webapp.eclass 22 Feb 2008 15:33:32 -0000 1.58
21 +++ webapp.eclass 23 Feb 2008 23:54:40 -0000 1.59
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2006 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.58 2008/02/22 15:33:32 hollow Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.59 2008/02/23 23:54:40 hollow Exp $
27 #
28 # @ECLASS: webapp.eclass
29 # @MAINTAINER:
30 @@ -10,8 +10,14 @@
31 # The webapp eclass contains functions to handle web applications with
32 # webapp-config. Part of the implementation of GLEP #11
33
34 +# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL
35 +# @DESCRIPTION:
36 +# An ebuild sets this to `yes' if an automatic installation and/or upgrade is
37 +# not possible. The ebuild should overwrite pkg_postinst() and explain the
38 +# reason for this BEFORE calling webapp_pkg_postinst().
39 +[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
40 +
41 SLOT="${PVR}"
42 -IUSE="vhosts"
43 DEPEND=">=app-admin/webapp-config-1.50.15"
44 RDEPEND="${DEPEND}"
45
46 @@ -81,7 +87,10 @@
47
48 webapp_getinstalltype() {
49 debug-print-function $FUNCNAME $*
50 - use vhosts && return
51 +
52 + if ! has vhosts ${IUSE} || use vhosts; then
53 + return
54 + fi
55
56 local my_output
57 my_output="$(webapp_check_installedat)"
58 @@ -344,7 +353,9 @@
59 local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
60
61 # if USE=vhosts is enabled OR no application is installed we're done here
62 - use vhosts || [[ ! -d "${my_dir}" ]] && return
63 + if ! has vhosts ${IUSE} || use vhosts || [[ ! -d "${my_dir}" ]]; then
64 + return
65 + fi
66
67 local my_output
68 my_output="$(webapp_check_installedat)"
69 @@ -442,37 +453,50 @@
70 die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org"
71 fi
72
73 - if ! use vhosts; then
74 - echo
75 - elog "vhosts USE flag not set - auto-installing using webapp-config"
76 -
77 - G_HOSTNAME="localhost"
78 - webapp_read_config
79 -
80 - local my_mode=-I
81 - webapp_getinstalltype
82 + if has vhosts ${IUSE}; then
83 + if ! use vhosts; then
84 + echo
85 + elog "vhosts USE flag not set - auto-installing using webapp-config"
86 +
87 + G_HOSTNAME="localhost"
88 + webapp_read_config
89 +
90 + local my_mode=-I
91 + webapp_getinstalltype
92 +
93 + if [[ "${IS_REPLACE}" == "1" ]]; then
94 + elog "${PN}-${PVR} is already installed - replacing"
95 + my_mode=-I
96 + elif [[ "${IS_UPGRADE}" == "1" ]]; then
97 + elog "${REMOVE_PKG} is already installed - upgrading"
98 + my_mode=-U
99 + else
100 + elog "${PN}-${PVR} is not installed - using install mode"
101 + fi
102
103 - if [[ "${IS_REPLACE}" == "1" ]]; then
104 - elog "${PN}-${PVR} is already installed - replacing"
105 - my_mode=-I
106 - elif [[ "${IS_UPGRADE}" == "1" ]]; then
107 - elog "${REMOVE_PKG} is already installed - upgrading"
108 - my_mode=-U
109 + my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
110 + elog "Running ${my_cmd}"
111 + ${my_cmd}
112 +
113 + echo
114 + local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
115 + einfo "Running ${cleaner}"
116 + ${cleaner}
117 else
118 - elog "${PN}-${PVR} is not installed - using install mode"
119 + elog
120 + elog "The 'vhosts' USE flag is switched ON"
121 + elog "This means that Portage will not automatically run webapp-config to"
122 + elog "complete the installation."
123 + elog
124 + elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
125 + elog
126 + elog " webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}"
127 + elog
128 + elog "For more details, see the webapp-config(8) man page"
129 fi
130 -
131 - my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
132 - elog "Running ${my_cmd}"
133 - ${my_cmd}
134 -
135 - echo
136 - local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
137 - einfo "Running ${cleaner}"
138 - ${cleaner}
139 else
140 elog
141 - elog "The 'vhosts' USE flag is switched ON"
142 + elog "This ebuild does not support the 'vhosts' USE flag."
143 elog "This means that Portage will not automatically run webapp-config to"
144 elog "complete the installation."
145 elog
146 @@ -497,7 +521,7 @@
147 [[ $? -ne 0 ]] && return
148
149 local x
150 - if ! use vhosts; then
151 + if has vhosts ${IUSE} && ! use vhosts; then
152 echo "${my_output}" | while read x; do
153 if [[ -f "${x}"/.webapp ]]; then
154 . "${x}"/.webapp
155
156
157
158 --
159 gentoo-commits@l.g.o mailing list