/[gentoo-x86]/eclass/gnome2-utils.eclass
Gentoo

Diff of /eclass/gnome2-utils.eclass

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

Revision 1.16 Revision 1.18
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.16 2010/12/07 06:23:34 eva Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.18 2010/12/07 06:26:37 eva Exp $
4 4
5# 5#
6# gnome2-utils.eclass 6# gnome2-utils.eclass
7# 7#
8# Set of auxiliary functions used to perform actions commonly needed by packages 8# Set of auxiliary functions used to perform actions commonly needed by packages
9# using the GNOME framework. 9# using the GNOME framework.
10# 10#
11# Maintained by Gentoo's GNOME herd <gnome@gentoo.org> 11# Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
12# 12#
13 13
14 14case "${EAPI:-0}" in
15 0|1|2|3) ;;
16 *) die "EAPI=${EAPI} is not supported" ;;
17esac
15 18
16# Path to gconftool-2 19# Path to gconftool-2
17: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"} 20: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
18 21
19# Directory where scrollkeeper-update should do its work 22# Directory where scrollkeeper-update should do its work
35 38
36 39
37# Find the GConf schemas that are about to be installed and save their location 40# Find the GConf schemas that are about to be installed and save their location
38# in the GNOME2_ECLASS_SCHEMAS environment variable 41# in the GNOME2_ECLASS_SCHEMAS environment variable
39gnome2_gconf_savelist() { 42gnome2_gconf_savelist() {
43 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
40 pushd "${D}" &> /dev/null 44 pushd "${ED}" &> /dev/null
41 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null) 45 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
42 popd &> /dev/null 46 popd &> /dev/null
43} 47}
44 48
45 49
46# Applies any schema files installed by the current ebuild to Gconf's database 50# Applies any schema files installed by the current ebuild to Gconf's database
47# using gconftool-2 51# using gconftool-2
48gnome2_gconf_install() { 52gnome2_gconf_install() {
53 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
49 local updater="${ROOT}${GCONFTOOL_BIN}" 54 local updater="${EROOT}${GCONFTOOL_BIN}"
50 local F
51 55
52 if [[ ! -x "${updater}" ]]; then 56 if [[ ! -x "${updater}" ]]; then
57 debug-print "${updater} is not executable"
53 return 58 return
54 fi 59 fi
55 60
56 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then 61 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
57 einfo "No GNOME 2 GConf schemas found" 62 debug-print "No GNOME 2 GConf schemas found"
58 return 63 return
59 fi 64 fi
60 65
61 # We are ready to install the GCONF Scheme now 66 # We are ready to install the GCONF Scheme now
62 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 67 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
63 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")" 68 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${EROOT};")"
64 69
65 einfo "Installing GNOME 2 GConf schemas" 70 einfo "Installing GNOME 2 GConf schemas"
66 71
72 local F
67 for F in ${GNOME2_ECLASS_SCHEMAS}; do 73 for F in ${GNOME2_ECLASS_SCHEMAS}; do
68 if [[ -e "${ROOT}${F}" ]]; then 74 if [[ -e "${EROOT}${F}" ]]; then
69 # echo "DEBUG::gconf install ${F}" 75 debug-print "Installing schema: ${F}"
70 "${updater}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null 76 "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
71 fi 77 fi
72 done 78 done
73 79
74 # have gconf reload the new schemas 80 # have gconf reload the new schemas
75 pids=$(pgrep -x gconfd-2) 81 pids=$(pgrep -x gconfd-2)
82 88
83 89
84# Removes schema files previously installed by the current ebuild from Gconf's 90# Removes schema files previously installed by the current ebuild from Gconf's
85# database. 91# database.
86gnome2_gconf_uninstall() { 92gnome2_gconf_uninstall() {
93 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
87 local updater="${ROOT}${GCONFTOOL_BIN}" 94 local updater="${EROOT}${GCONFTOOL_BIN}"
95
96 if [[ ! -x "${updater}" ]]; then
97 debug-print "${updater} is not executable"
98 return
99 fi
100
101 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
102 debug-print "No GNOME 2 GConf schemas found"
103 return
104 fi
105
106 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
107 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${EROOT};")"
108
109 einfo "Uninstalling GNOME 2 GConf schemas"
110
88 local F 111 local F
89
90 if [[ ! -x "${updater}" ]]; then
91 return
92 fi
93
94 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
95 einfo "No GNOME 2 GConf schemas found"
96 return
97 fi
98
99 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
100 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")"
101
102 einfo "Uninstalling GNOME 2 GConf schemas"
103
104 for F in ${GNOME2_ECLASS_SCHEMAS}; do 112 for F in ${GNOME2_ECLASS_SCHEMAS}; do
105 if [[ -e "${ROOT}${F}" ]]; then 113 if [[ -e "${EROOT}${F}" ]]; then
106 # echo "DEBUG::gconf uninstall ${F}" 114 debug-print "Uninstalling gconf schema: ${F}"
107 "${updater}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null 115 "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
108 fi 116 fi
109 done 117 done
110 118
111 # have gconf reload the new schemas 119 # have gconf reload the new schemas
112 pids=$(pgrep -x gconfd-2) 120 pids=$(pgrep -x gconfd-2)
120 128
121# Find the icons that are about to be installed and save their location 129# Find the icons that are about to be installed and save their location
122# in the GNOME2_ECLASS_ICONS environment variable 130# in the GNOME2_ECLASS_ICONS environment variable
123# That function should be called from pkg_preinst 131# That function should be called from pkg_preinst
124gnome2_icon_savelist() { 132gnome2_icon_savelist() {
133 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
125 pushd "${D}" &> /dev/null 134 pushd "${ED}" &> /dev/null
126 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) 135 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
127 popd &> /dev/null 136 popd &> /dev/null
128} 137}
129 138
130 139
131# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild 140# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
132# have installed anything under that location. 141# have installed anything under that location.
133gnome2_icon_cache_update() { 142gnome2_icon_cache_update() {
143 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
134 local updater="${ROOT}${GTK_UPDATE_ICON_CACHE}" 144 local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
135 145
136 if [[ ! -x "${updater}" ]] ; then 146 if [[ ! -x "${updater}" ]] ; then
137 debug-print "${updater} is not executable" 147 debug-print "${updater} is not executable"
138 return 148 return
139 fi 149 fi
140 150
141 if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then 151 if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
152 debug-print "No icon cache to update"
142 return 153 return
143 fi 154 fi
144
145 155
146 ebegin "Updating icons cache" 156 ebegin "Updating icons cache"
147 157
148 local retval=0 158 local retval=0
149 local fails=( ) 159 local fails=( )
151 for dir in ${GNOME2_ECLASS_ICONS} 161 for dir in ${GNOME2_ECLASS_ICONS}
152 do 162 do
153 if [[ -f "${ROOT}${dir}/index.theme" ]] ; then 163 if [[ -f "${ROOT}${dir}/index.theme" ]] ; then
154 local rv=0 164 local rv=0
155 165
156 "${updater}" -qf "${ROOT}${dir}" 166 "${updater}" -qf "${EROOT}${dir}"
157 rv=$? 167 rv=$?
158 168
159 if [[ ! $rv -eq 0 ]] ; then 169 if [[ ! $rv -eq 0 ]] ; then
160 debug-print "Updating cache failed on ${ROOT}${dir}" 170 debug-print "Updating cache failed on ${EROOT}${dir}"
161 171
162 # Add to the list of failures 172 # Add to the list of failures
163 fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}" 173 fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}"
164 174
165 retval=2 175 retval=2
166 fi 176 fi
167 fi 177 fi
168 done 178 done
222} 232}
223 233
224 234
225# Updates the global scrollkeeper database. 235# Updates the global scrollkeeper database.
226gnome2_scrollkeeper_update() { 236gnome2_scrollkeeper_update() {
237 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
227 if [[ -x "${ROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then 238 if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then
228 einfo "Updating scrollkeeper database ..." 239 einfo "Updating scrollkeeper database ..."
229 "${ROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${ROOT}${SCROLLKEEPER_DIR}" 240 "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
230 fi 241 fi
231} 242}
232 243
233gnome2_schemas_savelist() { 244gnome2_schemas_savelist() {
245 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
234 pushd "${D}" &>/dev/null 246 pushd "${ED}" &>/dev/null
235 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null) 247 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
236 popd &>/dev/null 248 popd &>/dev/null
237} 249}
238 250
239gnome2_schemas_update() { 251gnome2_schemas_update() {
252 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
240 local updater="${ROOT}${GLIB_COMPILE_SCHEMAS}" 253 local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
241 254
242 if [[ ! -x ${updater} ]]; then 255 if [[ ! -x ${updater} ]]; then
243 debug-print "${updater} is not executable" 256 debug-print "${updater} is not executable"
244 return 257 return
245 fi 258 fi
246 259
247 if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then 260 if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
248 debug-print "no schemas to update" 261 debug-print "No GSettings schemas to update"
249 return 262 return
250 fi 263 fi
251 264
252 ebegin "Updating GSettings schemas" 265 ebegin "Updating GSettings schemas"
253 ${updater} --allow-any-name "$@" "${ROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null 266 ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
254 eend $? 267 eend $?
255} 268}

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20