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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Wed Jan 24 18:20:01 2007 UTC (7 years, 10 months ago) by compnerd
Branch: MAIN
Changes since 1.2: +7 -4 lines
add patch from solar to kill gconfd only if active

1 leonardop 1.1 # Copyright 1999-2006 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 compnerd 1.3 # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.2 2007/01/01 22:27:01 swegener Exp $
4 leonardop 1.1
5     #
6     # gnome2-utils.eclass
7     #
8     # Set of auxiliary functions used to perform actions commonly needed by packages
9     # using the GNOME framework.
10     #
11     # Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
12     #
13    
14    
15    
16     # Path to gconftool-2
17     GCONFTOOL_BIN=${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"}
18    
19     # Directory where scrollkeeper-update should do its work
20     SCROLLKEEPER_DIR=${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"}
21    
22     # Path to scrollkeeper-update
23     SCROLLKEEPER_UPDATE_BIN=${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"}
24    
25    
26    
27     DEPEND=">=sys-apps/sed-4"
28    
29    
30    
31     # Applies any schema files installed by the current ebuild to Gconf's database
32 swegener 1.2 # using gconftool-2
33 leonardop 1.1 gnome2_gconf_install() {
34     if [[ ! -x ${GCONFTOOL_BIN} ]]; then
35     return
36     fi
37    
38     # We are ready to install the GCONF Scheme now
39     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
40     export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source)
41    
42     einfo "Installing GNOME 2 GConf schemas"
43    
44     local contents="${ROOT}var/db/pkg/*/${PN}-${PVR}/CONTENTS"
45     local F
46    
47     for F in $(grep "^obj /etc/gconf/schemas/.\+\.schemas\b" ${contents} | gawk '{print $2}' ); do
48     if [[ -e "${F}" ]]; then
49     # echo "DEBUG::gconf install ${F}"
50     ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null
51     fi
52     done
53    
54     # have gconf reload the new schemas
55 compnerd 1.3 pids=$(pidof gconfd-2)
56     if [[ $? == 0 ]] ; then
57     ebegin "Reloading GConf schemas"
58     kill -HUP ${pids}
59     eend $?
60     fi
61 leonardop 1.1 }
62    
63    
64     # Removes schema files previously installed by the current ebuild from Gconf's
65     # database.
66     gnome2_gconf_uninstall() {
67     if [[ ! -x ${GCONFTOOL_BIN} ]]; then
68     return
69     fi
70    
71     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
72     export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source)
73    
74     einfo "Uninstalling GNOME 2 GConf schemas"
75    
76     local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS"
77     local F
78    
79     for F in $(grep "obj /etc/gconf/schemas" ${contents} | sed 's:obj \([^ ]*\) .*:\1:' ); do
80     # echo "DEBUG::gconf install ${F}"
81     ${GCONFTOOL_BIN} --makefile-uninstall-rule ${F} 1>/dev/null
82     done
83     }
84    
85    
86     # Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
87     # have installed anything under that location.
88     gnome2_icon_cache_update() {
89     local updater=$(type -p gtk-update-icon-cache 2> /dev/null)
90    
91     if [[ ! -x ${updater} ]] ; then
92     debug-print "${updater} is not executable"
93    
94     return
95     fi
96    
97     if ! grep -q "obj /usr/share/icons" ${ROOT}var/db/pkg/*/${PF}/CONTENTS
98     then
99     debug-print "No items to update"
100    
101     return
102     fi
103    
104     ebegin "Updating icons cache"
105    
106     local retval=0
107     local fails=( )
108    
109     for dir in $(find ${ROOT}/usr/share/icons -maxdepth 1 -mindepth 1 -type d)
110     do
111     if [[ -f "${dir}/index.theme" ]] ; then
112     local rv=0
113    
114     ${updater} -qf ${dir}
115     rv=$?
116    
117     if [[ ! $rv -eq 0 ]] ; then
118     debug-print "Updating cache failed on ${dir}"
119    
120     # Add to the list of failures
121     fails[$(( ${#fails[@]} + 1 ))]=$dir
122    
123     retval=2
124     fi
125     fi
126     done
127    
128     eend ${retval}
129    
130     for (( i = 0 ; i < ${#fails[@]} ; i++ )) ; do
131     ### HACK!! This is needed until bash 3.1 is unmasked.
132     ## The current stable version of bash lists the sizeof fails to be 1
133     ## when there are no elements in the list because it is declared local.
134     ## In order to prevent the declaration from being in global scope, we
135     ## this hack to prevent an empty error message being printed for stable
136     ## users. -- compnerd && allanonjl
137     if [[ "${fails[i]}" != "" && "${fails[i]}" != "()" ]] ; then
138     eerror "Failed to update cache with icon ${fails[i]}"
139     fi
140     done
141     }
142    
143    
144     # Workaround applied to Makefile rules in order to remove redundant
145     # calls to scrollkeeper-update and sandbox violations.
146     gnome2_omf_fix() {
147     local omf_makefiles filename
148    
149     omf_makefiles="$@"
150    
151     if [[ -f ${S}/omf.make ]] ; then
152     omf_makefiles="${omf_makefiles} ${S}/omf.make"
153     fi
154    
155     # testing fixing of all makefiles found
156     for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am") ; do
157     omf_makefiles="${omf_makefiles} ${filename}"
158     done
159    
160     ebegin "Fixing OMF Makefiles"
161    
162     local retval=0
163     local fails=( )
164    
165     for omf in ${omf_makefiles} ; do
166     local rv=0
167    
168     sed -i -e 's:scrollkeeper-update:true:' ${omf}
169     retval=$?
170    
171     if [[ ! $rv -eq 0 ]] ; then
172     debug-print "updating of ${omf} failed"
173    
174     # Add to the list of failures
175     fails[$(( ${#fails[@]} + 1 ))]=$omf
176    
177     retval=2
178     fi
179     done
180    
181     eend $retval
182    
183     for (( i = 0 ; i < ${#fails[@]} ; i++ )) ; do
184     ### HACK!! This is needed until bash 3.1 is unmasked.
185     ## The current stable version of bash lists the sizeof fails to be 1
186     ## when there are no elements in the list because it is declared local.
187     ## In order to prevent the declaration from being in global scope, we
188     ## this hack to prevent an empty error message being printed for stable
189     ## users. -- compnerd && allanonjl
190     if [[ "${fails[i]}" != "" && "${fails[i]}" != "()" ]] ; then
191     eerror "Failed to update OMF Makefile ${fails[i]}"
192     fi
193     done
194     }
195    
196    
197     # Updates the global scrollkeeper database.
198     gnome2_scrollkeeper_update() {
199     if [[ -x ${SCROLLKEEPER_UPDATE_BIN} ]]; then
200     einfo "Updating scrollkeeper database ..."
201     ${SCROLLKEEPER_UPDATE_BIN} -q -p ${SCROLLKEEPER_DIR}
202     fi
203     }

  ViewVC Help
Powered by ViewVC 1.1.20