/[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.15 Revision 1.21
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.15 2010/12/07 06:21:59 eva Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.21 2011/01/31 17:03:45 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|4) ;;
16 *) die "EAPI=${EAPI} is not supported" ;;
17esac
15 18
16# Path to gconftool-2 19# Path to gconftool-2
17: ${GCONFTOOL_BIN:="${ROOT}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
20: ${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"} 23: ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}
21 24
22# Path to scrollkeeper-update 25# Path to scrollkeeper-update
23: ${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"} 26: ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
24 27
25# Path to gtk-update-icon-cache 28# Path to gtk-update-icon-cache
26: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} 29: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
27 30
28# Path to glib-compile-schemas 31# Path to glib-compile-schemas
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() {
49 local F 53 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
54 local updater="${EROOT}${GCONFTOOL_BIN}"
50 55
51 if [[ ! -x "${GCONFTOOL_BIN}" ]]; then 56 if [[ ! -x "${updater}" ]]; then
57 debug-print "${updater} is not executable"
52 return 58 return
53 fi 59 fi
54 60
55 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then 61 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
56 einfo "No GNOME 2 GConf schemas found" 62 debug-print "No GNOME 2 GConf schemas found"
57 return 63 return
58 fi 64 fi
59 65
60 # We are ready to install the GCONF Scheme now 66 # We are ready to install the GCONF Scheme now
61 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 67 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
62 export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")" 68 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")"
63 69
64 einfo "Installing GNOME 2 GConf schemas" 70 einfo "Installing GNOME 2 GConf schemas"
65 71
72 local F
66 for F in ${GNOME2_ECLASS_SCHEMAS}; do 73 for F in ${GNOME2_ECLASS_SCHEMAS}; do
67 if [[ -e "${ROOT}${F}" ]]; then 74 if [[ -e "${EROOT}${F}" ]]; then
68 # echo "DEBUG::gconf install ${F}" 75 debug-print "Installing schema: ${F}"
69 "${GCONFTOOL_BIN}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null 76 "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
70 fi 77 fi
71 done 78 done
72 79
73 # have gconf reload the new schemas 80 # have gconf reload the new schemas
74 pids=$(pgrep -x gconfd-2) 81 pids=$(pgrep -x gconfd-2)
81 88
82 89
83# 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
84# database. 91# database.
85gnome2_gconf_uninstall() { 92gnome2_gconf_uninstall() {
93 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
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;:/;:${ROOT};")"
108
109 einfo "Uninstalling GNOME 2 GConf schemas"
110
86 local F 111 local F
87
88 if [[ ! -x "${GCONFTOOL_BIN}" ]]; then
89 return
90 fi
91
92 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
93 einfo "No GNOME 2 GConf schemas found"
94 return
95 fi
96
97 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
98 export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
99
100 einfo "Uninstalling GNOME 2 GConf schemas"
101
102 for F in ${GNOME2_ECLASS_SCHEMAS}; do 112 for F in ${GNOME2_ECLASS_SCHEMAS}; do
103 if [[ -e "${ROOT}${F}" ]]; then 113 if [[ -e "${EROOT}${F}" ]]; then
104 # echo "DEBUG::gconf uninstall ${F}" 114 debug-print "Uninstalling gconf schema: ${F}"
105 "${GCONFTOOL_BIN}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null 115 "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
106 fi 116 fi
107 done 117 done
108 118
109 # have gconf reload the new schemas 119 # have gconf reload the new schemas
110 pids=$(pgrep -x gconfd-2) 120 pids=$(pgrep -x gconfd-2)
118 128
119# 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
120# in the GNOME2_ECLASS_ICONS environment variable 130# in the GNOME2_ECLASS_ICONS environment variable
121# That function should be called from pkg_preinst 131# That function should be called from pkg_preinst
122gnome2_icon_savelist() { 132gnome2_icon_savelist() {
133 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
123 pushd "${D}" &> /dev/null 134 pushd "${ED}" &> /dev/null
124 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)
125 popd &> /dev/null 136 popd &> /dev/null
126} 137}
127 138
128 139
129# 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
130# have installed anything under that location. 141# have installed anything under that location.
131gnome2_icon_cache_update() { 142gnome2_icon_cache_update() {
143 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
132 local updater="${ROOT}${GTK_UPDATE_ICON_CACHE}" 144 local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
133 145
134 if [[ ! -x "${updater}" ]] ; then 146 if [[ ! -x "${updater}" ]] ; then
135 debug-print "${updater} is not executable" 147 debug-print "${updater} is not executable"
136 return 148 return
137 fi 149 fi
138 150
139 if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then 151 if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
152 debug-print "No icon cache to update"
140 return 153 return
141 fi 154 fi
142
143 155
144 ebegin "Updating icons cache" 156 ebegin "Updating icons cache"
145 157
146 local retval=0 158 local retval=0
147 local fails=( ) 159 local fails=( )
148 160
149 for dir in ${GNOME2_ECLASS_ICONS} 161 for dir in ${GNOME2_ECLASS_ICONS}
150 do 162 do
151 if [[ -f "${ROOT}${dir}/index.theme" ]] ; then 163 if [[ -f "${EROOT}${dir}/index.theme" ]] ; then
152 local rv=0 164 local rv=0
153 165
154 "${updater}" -qf "${ROOT}${dir}" 166 "${updater}" -qf "${EROOT}${dir}"
155 rv=$? 167 rv=$?
156 168
157 if [[ ! $rv -eq 0 ]] ; then 169 if [[ ! $rv -eq 0 ]] ; then
158 debug-print "Updating cache failed on ${ROOT}${dir}" 170 debug-print "Updating cache failed on ${EROOT}${dir}"
159 171
160 # Add to the list of failures 172 # Add to the list of failures
161 fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}" 173 fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}"
162 174
163 retval=2 175 retval=2
164 fi 176 fi
165 fi 177 fi
166 done 178 done
220} 232}
221 233
222 234
223# Updates the global scrollkeeper database. 235# Updates the global scrollkeeper database.
224gnome2_scrollkeeper_update() { 236gnome2_scrollkeeper_update() {
237 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
225 if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then 238 if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then
226 einfo "Updating scrollkeeper database ..." 239 einfo "Updating scrollkeeper database ..."
227 "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}" 240 "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
228 fi 241 fi
229} 242}
230 243
231gnome2_schemas_savelist() { 244gnome2_schemas_savelist() {
245 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
232 pushd "${D}" &>/dev/null 246 pushd "${ED}" &>/dev/null
233 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)
234 popd &>/dev/null 248 popd &>/dev/null
235} 249}
236 250
237gnome2_schemas_update() { 251gnome2_schemas_update() {
252 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
238 local updater="${ROOT}${GLIB_COMPILE_SCHEMAS}" 253 local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
239 254
240 if [[ ! -x ${updater} ]]; then 255 if [[ ! -x ${updater} ]]; then
241 debug-print "${updater} is not executable" 256 debug-print "${updater} is not executable"
242 return 257 return
243 fi 258 fi
244 259
245 if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then 260 if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
246 debug-print "no schemas to update" 261 debug-print "No GSettings schemas to update"
247 return 262 return
248 fi 263 fi
249 264
250 ebegin "Updating GSettings schemas" 265 ebegin "Updating GSettings schemas"
251 ${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
252 eend $? 267 eend $?
253} 268}

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20