Gentoo Archives: gentoo-dev

From: "Marty E. Plummer" <hanetzer@×××××××××.com>
To: gentoo-dev@l.g.o
Cc: "Marty E. Plummer" <hanetzer@×××××××××.com>
Subject: [gentoo-dev] [PATCH 04/10] gnome2-utils.eclass: make EAPI 7 ready
Date: Wed, 27 Jun 2018 01:31:08
Message-Id: 20180627012734.1319-5-hanetzer@startmail.com
In Reply to: [gentoo-dev] [PATCH 00/10] {gnome2,xdg}{,-utils}.eclass: EAPI 7 work by "Marty E. Plummer"
1 Use ${EROOT%/} whereever possible, as most of the directories and files
2 used in conjunction with it have a leading /; add missing leading /
3 where apropriate.
4
5 Drop EAPI 0-2 support as no in-tree ebuilds use it to simplify the
6 ROOT/EROOT/BROOT logic.
7
8 Use BROOT to specify path to executable files, setting that to EROOT
9 when not EAPI 7
10
11 Package-Manager: Portage-2.3.40, Repoman-2.3.9
12 ---
13 eclass/gnome2-utils.eclass | 100 ++++++++++++++++++++++---------------
14 1 file changed, 61 insertions(+), 39 deletions(-)
15
16 diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
17 index 1597ac4ad08..6bd3cebac2d 100644
18 --- a/eclass/gnome2-utils.eclass
19 +++ b/eclass/gnome2-utils.eclass
20 @@ -76,9 +76,6 @@ esac
21 # @DESCRIPTION:
22 # List of gdk-pixbuf loaders provided by the package
23
24 -DEPEND=">=sys-apps/sed-4"
25 -
26 -
27 # @FUNCTION: gnome2_environment_reset
28 # @DESCRIPTION:
29 # Reset various variables inherited from root's evironment to a reasonable
30 @@ -95,7 +92,7 @@ gnome2_environment_reset() {
31 # Ensure we don't rely on dconf/gconf while building, bug #511946
32 export GSETTINGS_BACKEND="memory"
33
34 - if has ${EAPI:-0} 6; then
35 + if [[ ${EAPI:-0} != [012345] ]]; then
36 # Try to cover the packages honoring this variable, bug #508124
37 export GST_INSPECT="$(type -P true)"
38
39 @@ -110,7 +107,6 @@ gnome2_environment_reset() {
40 # in the GNOME2_ECLASS_SCHEMAS environment variable.
41 # This function should be called from pkg_preinst.
42 gnome2_gconf_savelist() {
43 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
44 pushd "${ED}" > /dev/null || die
45 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
46 popd > /dev/null || die
47 @@ -122,8 +118,8 @@ gnome2_gconf_savelist() {
48 # using gconftool-2.
49 # This function should be called from pkg_postinst.
50 gnome2_gconf_install() {
51 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
52 - local updater="${EROOT}${GCONFTOOL_BIN}"
53 + [[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
54 + local updater="${BROOT%/}${GCONFTOOL_BIN}"
55
56 if [[ ! -x "${updater}" ]]; then
57 debug-print "${updater} is not executable"
58 @@ -143,9 +139,9 @@ gnome2_gconf_install() {
59
60 local F
61 for F in ${GNOME2_ECLASS_SCHEMAS}; do
62 - if [[ -e "${EROOT}${F}" ]]; then
63 + if [[ -e "${EROOT%/}${F}" ]]; then
64 debug-print "Installing schema: ${F}"
65 - "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
66 + "${updater}" --makefile-install-rule "${EROOT%/}${F}" 1>/dev/null
67 fi
68 done
69
70 @@ -163,8 +159,8 @@ gnome2_gconf_install() {
71 # Removes schema files previously installed by the current ebuild from Gconf's
72 # database.
73 gnome2_gconf_uninstall() {
74 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
75 - local updater="${EROOT}${GCONFTOOL_BIN}"
76 + [[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
77 + local updater="${BROOT%/}${GCONFTOOL_BIN}"
78
79 if [[ ! -x "${updater}" ]]; then
80 debug-print "${updater} is not executable"
81 @@ -183,9 +179,9 @@ gnome2_gconf_uninstall() {
82
83 local F
84 for F in ${GNOME2_ECLASS_SCHEMAS}; do
85 - if [[ -e "${EROOT}${F}" ]]; then
86 + if [[ -e "${EROOT%/}${F}" ]]; then
87 debug-print "Uninstalling gconf schema: ${F}"
88 - "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
89 + "${updater}" --makefile-uninstall-rule "${EROOT%/}${F}" 1>/dev/null
90 fi
91 done
92
93 @@ -206,10 +202,15 @@ gnome2_gconf_uninstall() {
94 # gnome2_icon_cache_update conditionally.
95 # This function should be called from pkg_preinst.
96 gnome2_icon_savelist() {
97 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
98 - pushd "${ED}" > /dev/null || die
99 - export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
100 - popd > /dev/null || die
101 + if [[ ${EAPI:-0} == [0123456] ]]; then
102 + pushd "${ED}" > /dev/null || die
103 + export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
104 + popd > /dev/null || die
105 + else
106 + eerror "gnome2_icon_savelist is banned in EAPI ${EAPI}"
107 + eerror "please migrate to the related functions in xdg-utils and xdg"
108 + die
109 + fi
110 }
111
112 # @FUNCTION: gnome2_icon_cache_update
113 @@ -217,7 +218,13 @@ gnome2_icon_savelist() {
114 # Updates Gtk+ icon cache files under /usr/share/icons.
115 # Deprecated. Please use xdg_icon_cache_update from xdg-utils.eclass
116 gnome2_icon_cache_update() {
117 - xdg_icon_cache_update
118 + if [[ ${EAPI:-0} == [0123456] ]]; then
119 + xdg_icon_cache_update
120 + else
121 + eerror "gnome2_icon_cache_update is banned in EAPI ${EAPI}"
122 + eerror "please migrate to xdg_icon_cache_update in xdg-utils"
123 + die
124 + fi
125 }
126
127 # @FUNCTION: gnome2_omf_fix
128 @@ -277,7 +284,6 @@ gnome2_omf_fix() {
129 # in the GNOME2_ECLASS_SCROLLS environment variable.
130 # This function should be called from pkg_preinst.
131 gnome2_scrollkeeper_savelist() {
132 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
133 pushd "${ED}" > /dev/null || die
134 export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null)
135 popd > /dev/null || die
136 @@ -288,8 +294,8 @@ gnome2_scrollkeeper_savelist() {
137 # Updates the global scrollkeeper database.
138 # This function should be called from pkg_postinst and pkg_postrm.
139 gnome2_scrollkeeper_update() {
140 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
141 - local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}"
142 + [[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
143 + local updater="${BROOT%/}${SCROLLKEEPER_UPDATE_BIN}"
144
145 if [[ ! -x "${updater}" ]] ; then
146 debug-print "${updater} is not executable"
147 @@ -302,7 +308,7 @@ gnome2_scrollkeeper_update() {
148 fi
149
150 ebegin "Updating scrollkeeper database ..."
151 - "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
152 + "${updater}" -q -p "${EROOT%/}${SCROLLKEEPER_DIR}"
153 eend $?
154 }
155
156 @@ -313,7 +319,6 @@ gnome2_scrollkeeper_update() {
157 # implementations that call gnome2_schemas_update conditionally.
158 # This function should be called from pkg_preinst.
159 gnome2_schemas_savelist() {
160 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
161 pushd "${ED}" > /dev/null || die
162 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
163 popd > /dev/null || die
164 @@ -325,8 +330,8 @@ gnome2_schemas_savelist() {
165 # Updates GSettings schemas.
166 # This function should be called from pkg_postinst and pkg_postrm.
167 gnome2_schemas_update() {
168 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
169 - local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
170 + [[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
171 + local updater="${BROOT%/}${GLIB_COMPILE_SCHEMAS}"
172
173 if [[ ! -x ${updater} ]]; then
174 debug-print "${updater} is not executable"
175 @@ -344,7 +349,6 @@ gnome2_schemas_update() {
176 # GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
177 # This function should be called from pkg_preinst.
178 gnome2_gdk_pixbuf_savelist() {
179 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
180 pushd "${ED}" > /dev/null || die
181 export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find usr/lib*/gdk-pixbuf-2.0 -type f 2>/dev/null)
182 popd > /dev/null || die
183 @@ -356,11 +360,11 @@ gnome2_gdk_pixbuf_savelist() {
184 # Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
185 # This function should be called from pkg_postinst and pkg_postrm.
186 gnome2_gdk_pixbuf_update() {
187 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
188 - local updater="${EROOT}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
189 + [[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
190 + local updater="${BROOT%/}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
191
192 if [[ ! -x ${updater} ]]; then
193 - updater="${EROOT}/usr/bin/gdk-pixbuf-query-loaders"
194 + updater="${BROOT%/}/usr/bin/gdk-pixbuf-query-loaders"
195 fi
196
197 if [[ ! -x ${updater} ]]; then
198 @@ -377,7 +381,7 @@ gnome2_gdk_pixbuf_update() {
199 local tmp_file=$(emktemp)
200 ${updater} 1> "${tmp_file}" &&
201 chmod 0644 "${tmp_file}" &&
202 - cp -f "${tmp_file}" "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
203 + cp -f "${tmp_file}" "${EROOT%/}/usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
204 rm "${tmp_file}" # don't replace this with mv, required for SELinux support
205 eend $?
206 }
207 @@ -387,11 +391,20 @@ gnome2_gdk_pixbuf_update() {
208 # @DESCRIPTION:
209 # Updates gtk2 immodules/gdk-pixbuf loaders listing.
210 gnome2_query_immodules_gtk2() {
211 - local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-2.0
212 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0
213 + [[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
214 + local updater=${BROOT%/}/usr/bin/${CHOST}-gtk-query-immodules-2.0
215 +
216 + if [[ ! -x ${updater} ]]; then
217 + updater="${BROOT%/}/usr/bin/gtk-query-immodules-2.0"
218 + fi
219 +
220 + if [[ ! -x ${updater} ]]; then
221 + debug-print "${updater} is not executable"
222 + return
223 + fi
224
225 ebegin "Updating gtk2 input method module cache"
226 - GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
227 + GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
228 "${updater}" --update-cache
229 eend $?
230 }
231 @@ -401,11 +414,20 @@ gnome2_query_immodules_gtk2() {
232 # @DESCRIPTION:
233 # Updates gtk3 immodules/gdk-pixbuf loaders listing.
234 gnome2_query_immodules_gtk3() {
235 - local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-3.0
236 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0
237 + [[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
238 + local updater=${BROOT%/}/usr/bin/${CHOST}-gtk-query-immodules-3.0
239 +
240 + if [[ -x ${updater} ]]; then
241 + updater=${BROOT%/}/usr/bin/gtk-query-immodules-3.0
242 + fi
243 +
244 + if [[ ! -x ${updater} ]]; then
245 + debug-print "${updater} is not executable"
246 + return
247 + fi
248
249 ebegin "Updating gtk3 input method module cache"
250 - GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
251 + GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
252 "${updater}" --update-cache
253 eend $?
254 }
255 @@ -416,11 +438,11 @@ gnome2_query_immodules_gtk3() {
256 # Updates glib's gio modules cache.
257 # This function should be called from pkg_postinst and pkg_postrm.
258 gnome2_giomodule_cache_update() {
259 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
260 - local updater="${EROOT}/usr/bin/${CHOST}-gio-querymodules"
261 + [[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
262 + local updater="${BROOT%/}/usr/bin/${CHOST}-gio-querymodules"
263
264 if [[ ! -x ${updater} ]]; then
265 - updater="${EROOT}/usr/bin/gio-querymodules"
266 + updater="${BROOT%/}/usr/bin/gio-querymodules"
267 fi
268
269 if [[ ! -x ${updater} ]]; then
270 --
271 2.17.1