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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Mon Jan 1 22:27:01 2007 UTC (7 years, 7 months ago) by swegener
Branch: MAIN
Changes since 1.1: +2 -2 lines
Apply whitespace checks from repoman to eclasses.

1 leonardop 1.1 # Copyright 1999-2006 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 swegener 1.2 # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.1 2006/12/13 02:25:02 leonardop 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     ebegin "Reloading GConf schemas"
56     killall -HUP gconfd-2
57     eend $?
58     }
59    
60    
61     # Removes schema files previously installed by the current ebuild from Gconf's
62     # database.
63     gnome2_gconf_uninstall() {
64     if [[ ! -x ${GCONFTOOL_BIN} ]]; then
65     return
66     fi
67    
68     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
69     export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source)
70    
71     einfo "Uninstalling GNOME 2 GConf schemas"
72    
73     local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS"
74     local F
75    
76     for F in $(grep "obj /etc/gconf/schemas" ${contents} | sed 's:obj \([^ ]*\) .*:\1:' ); do
77     # echo "DEBUG::gconf install ${F}"
78     ${GCONFTOOL_BIN} --makefile-uninstall-rule ${F} 1>/dev/null
79     done
80     }
81    
82    
83     # Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
84     # have installed anything under that location.
85     gnome2_icon_cache_update() {
86     local updater=$(type -p gtk-update-icon-cache 2> /dev/null)
87    
88     if [[ ! -x ${updater} ]] ; then
89     debug-print "${updater} is not executable"
90    
91     return
92     fi
93    
94     if ! grep -q "obj /usr/share/icons" ${ROOT}var/db/pkg/*/${PF}/CONTENTS
95     then
96     debug-print "No items to update"
97    
98     return
99     fi
100    
101     ebegin "Updating icons cache"
102    
103     local retval=0
104     local fails=( )
105    
106     for dir in $(find ${ROOT}/usr/share/icons -maxdepth 1 -mindepth 1 -type d)
107     do
108     if [[ -f "${dir}/index.theme" ]] ; then
109     local rv=0
110    
111     ${updater} -qf ${dir}
112     rv=$?
113    
114     if [[ ! $rv -eq 0 ]] ; then
115     debug-print "Updating cache failed on ${dir}"
116    
117     # Add to the list of failures
118     fails[$(( ${#fails[@]} + 1 ))]=$dir
119    
120     retval=2
121     fi
122     fi
123     done
124    
125     eend ${retval}
126    
127     for (( i = 0 ; i < ${#fails[@]} ; i++ )) ; do
128     ### HACK!! This is needed until bash 3.1 is unmasked.
129     ## The current stable version of bash lists the sizeof fails to be 1
130     ## when there are no elements in the list because it is declared local.
131     ## In order to prevent the declaration from being in global scope, we
132     ## this hack to prevent an empty error message being printed for stable
133     ## users. -- compnerd && allanonjl
134     if [[ "${fails[i]}" != "" && "${fails[i]}" != "()" ]] ; then
135     eerror "Failed to update cache with icon ${fails[i]}"
136     fi
137     done
138     }
139    
140    
141     # Workaround applied to Makefile rules in order to remove redundant
142     # calls to scrollkeeper-update and sandbox violations.
143     gnome2_omf_fix() {
144     local omf_makefiles filename
145    
146     omf_makefiles="$@"
147    
148     if [[ -f ${S}/omf.make ]] ; then
149     omf_makefiles="${omf_makefiles} ${S}/omf.make"
150     fi
151    
152     # testing fixing of all makefiles found
153     for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am") ; do
154     omf_makefiles="${omf_makefiles} ${filename}"
155     done
156    
157     ebegin "Fixing OMF Makefiles"
158    
159     local retval=0
160     local fails=( )
161    
162     for omf in ${omf_makefiles} ; do
163     local rv=0
164    
165     sed -i -e 's:scrollkeeper-update:true:' ${omf}
166     retval=$?
167    
168     if [[ ! $rv -eq 0 ]] ; then
169     debug-print "updating of ${omf} failed"
170    
171     # Add to the list of failures
172     fails[$(( ${#fails[@]} + 1 ))]=$omf
173    
174     retval=2
175     fi
176     done
177    
178     eend $retval
179    
180     for (( i = 0 ; i < ${#fails[@]} ; i++ )) ; do
181     ### HACK!! This is needed until bash 3.1 is unmasked.
182     ## The current stable version of bash lists the sizeof fails to be 1
183     ## when there are no elements in the list because it is declared local.
184     ## In order to prevent the declaration from being in global scope, we
185     ## this hack to prevent an empty error message being printed for stable
186     ## users. -- compnerd && allanonjl
187     if [[ "${fails[i]}" != "" && "${fails[i]}" != "()" ]] ; then
188     eerror "Failed to update OMF Makefile ${fails[i]}"
189     fi
190     done
191     }
192    
193    
194     # Updates the global scrollkeeper database.
195     gnome2_scrollkeeper_update() {
196     if [[ -x ${SCROLLKEEPER_UPDATE_BIN} ]]; then
197     einfo "Updating scrollkeeper database ..."
198     ${SCROLLKEEPER_UPDATE_BIN} -q -p ${SCROLLKEEPER_DIR}
199     fi
200     }

  ViewVC Help
Powered by ViewVC 1.1.20