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: Thu, 21 Jun 2018 05:12:30
Message-Id: 20180621050950.9162-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 | 78 +++++++++++++++++++++-----------------
14 1 file changed, 44 insertions(+), 34 deletions(-)
15
16 diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
17 index 1597ac4ad08..b2569ce11ed 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 @@ -110,7 +107,6 @@ gnome2_environment_reset() {
31 # in the GNOME2_ECLASS_SCHEMAS environment variable.
32 # This function should be called from pkg_preinst.
33 gnome2_gconf_savelist() {
34 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
35 pushd "${ED}" > /dev/null || die
36 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
37 popd > /dev/null || die
38 @@ -122,8 +118,8 @@ gnome2_gconf_savelist() {
39 # using gconftool-2.
40 # This function should be called from pkg_postinst.
41 gnome2_gconf_install() {
42 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
43 - local updater="${EROOT}${GCONFTOOL_BIN}"
44 + has ${EAPI:-0} 7 || BROOT=${EROOT}
45 + local updater="${BROOT%/}${GCONFTOOL_BIN}"
46
47 if [[ ! -x "${updater}" ]]; then
48 debug-print "${updater} is not executable"
49 @@ -143,9 +139,9 @@ gnome2_gconf_install() {
50
51 local F
52 for F in ${GNOME2_ECLASS_SCHEMAS}; do
53 - if [[ -e "${EROOT}${F}" ]]; then
54 + if [[ -e "${EROOT%/}${F}" ]]; then
55 debug-print "Installing schema: ${F}"
56 - "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
57 + "${updater}" --makefile-install-rule "${EROOT%/}${F}" 1>/dev/null
58 fi
59 done
60
61 @@ -163,8 +159,8 @@ gnome2_gconf_install() {
62 # Removes schema files previously installed by the current ebuild from Gconf's
63 # database.
64 gnome2_gconf_uninstall() {
65 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
66 - local updater="${EROOT}${GCONFTOOL_BIN}"
67 + has ${EAPI:-0} 7 || BROOT=${EROOT}
68 + local updater="${BROOT%/}${GCONFTOOL_BIN}"
69
70 if [[ ! -x "${updater}" ]]; then
71 debug-print "${updater} is not executable"
72 @@ -183,9 +179,9 @@ gnome2_gconf_uninstall() {
73
74 local F
75 for F in ${GNOME2_ECLASS_SCHEMAS}; do
76 - if [[ -e "${EROOT}${F}" ]]; then
77 + if [[ -e "${EROOT%/}${F}" ]]; then
78 debug-print "Uninstalling gconf schema: ${F}"
79 - "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
80 + "${updater}" --makefile-uninstall-rule "${EROOT%/}${F}" 1>/dev/null
81 fi
82 done
83
84 @@ -206,7 +202,6 @@ gnome2_gconf_uninstall() {
85 # gnome2_icon_cache_update conditionally.
86 # This function should be called from pkg_preinst.
87 gnome2_icon_savelist() {
88 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
89 pushd "${ED}" > /dev/null || die
90 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
91 popd > /dev/null || die
92 @@ -277,7 +272,6 @@ gnome2_omf_fix() {
93 # in the GNOME2_ECLASS_SCROLLS environment variable.
94 # This function should be called from pkg_preinst.
95 gnome2_scrollkeeper_savelist() {
96 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
97 pushd "${ED}" > /dev/null || die
98 export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null)
99 popd > /dev/null || die
100 @@ -288,8 +282,8 @@ gnome2_scrollkeeper_savelist() {
101 # Updates the global scrollkeeper database.
102 # This function should be called from pkg_postinst and pkg_postrm.
103 gnome2_scrollkeeper_update() {
104 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
105 - local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}"
106 + has ${EAPI:-0} 7 || BROOT=${EROOT}
107 + local updater="${BROOT%/}${SCROLLKEEPER_UPDATE_BIN}"
108
109 if [[ ! -x "${updater}" ]] ; then
110 debug-print "${updater} is not executable"
111 @@ -302,7 +296,7 @@ gnome2_scrollkeeper_update() {
112 fi
113
114 ebegin "Updating scrollkeeper database ..."
115 - "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
116 + "${updater}" -q -p "${EROOT%/}${SCROLLKEEPER_DIR}"
117 eend $?
118 }
119
120 @@ -313,7 +307,6 @@ gnome2_scrollkeeper_update() {
121 # implementations that call gnome2_schemas_update conditionally.
122 # This function should be called from pkg_preinst.
123 gnome2_schemas_savelist() {
124 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
125 pushd "${ED}" > /dev/null || die
126 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
127 popd > /dev/null || die
128 @@ -325,8 +318,8 @@ gnome2_schemas_savelist() {
129 # Updates GSettings schemas.
130 # This function should be called from pkg_postinst and pkg_postrm.
131 gnome2_schemas_update() {
132 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
133 - local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
134 + has ${EAPI:-0} 7 || BROOT=${EROOT}
135 + local updater="${BROOT%/}${GLIB_COMPILE_SCHEMAS}"
136
137 if [[ ! -x ${updater} ]]; then
138 debug-print "${updater} is not executable"
139 @@ -344,7 +337,6 @@ gnome2_schemas_update() {
140 # GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
141 # This function should be called from pkg_preinst.
142 gnome2_gdk_pixbuf_savelist() {
143 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
144 pushd "${ED}" > /dev/null || die
145 export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find usr/lib*/gdk-pixbuf-2.0 -type f 2>/dev/null)
146 popd > /dev/null || die
147 @@ -356,11 +348,11 @@ gnome2_gdk_pixbuf_savelist() {
148 # Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
149 # This function should be called from pkg_postinst and pkg_postrm.
150 gnome2_gdk_pixbuf_update() {
151 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
152 - local updater="${EROOT}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
153 + has ${EAPI:-0} 7 || BROOT=${EROOT}
154 + local updater="${BROOT%/}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
155
156 if [[ ! -x ${updater} ]]; then
157 - updater="${EROOT}/usr/bin/gdk-pixbuf-query-loaders"
158 + updater="${BROOT%/}/usr/bin/gdk-pixbuf-query-loaders"
159 fi
160
161 if [[ ! -x ${updater} ]]; then
162 @@ -377,7 +369,7 @@ gnome2_gdk_pixbuf_update() {
163 local tmp_file=$(emktemp)
164 ${updater} 1> "${tmp_file}" &&
165 chmod 0644 "${tmp_file}" &&
166 - cp -f "${tmp_file}" "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
167 + cp -f "${tmp_file}" "${EROOT%/}/usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
168 rm "${tmp_file}" # don't replace this with mv, required for SELinux support
169 eend $?
170 }
171 @@ -387,11 +379,20 @@ gnome2_gdk_pixbuf_update() {
172 # @DESCRIPTION:
173 # Updates gtk2 immodules/gdk-pixbuf loaders listing.
174 gnome2_query_immodules_gtk2() {
175 - local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-2.0
176 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0
177 + has ${EAPI:-0} 7 || BROOT=${EROOT}
178 + local updater=${BROOT%/}/usr/bin/${CHOST}-gtk-query-immodules-2.0
179 +
180 + if [[ ! -x ${updater} ]]; then
181 + updater="${BROOT%/}/usr/bin/gtk-query-immodules-2.0"
182 + fi
183 +
184 + if [[ ! -x ${updater} ]]; then
185 + debug-print "${updater} is not executable"
186 + return
187 + fi
188
189 ebegin "Updating gtk2 input method module cache"
190 - GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
191 + GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
192 "${updater}" --update-cache
193 eend $?
194 }
195 @@ -401,11 +402,20 @@ gnome2_query_immodules_gtk2() {
196 # @DESCRIPTION:
197 # Updates gtk3 immodules/gdk-pixbuf loaders listing.
198 gnome2_query_immodules_gtk3() {
199 - local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-3.0
200 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0
201 + has ${EAPI:-0} 7 || BROOT=${EROOT}
202 + local updater=${BROOT%/}/usr/bin/${CHOST}-gtk-query-immodules-3.0
203 +
204 + if [[ -x ${updater} ]]; then
205 + updater=${BROOT%/}/usr/bin/gtk-query-immodules-3.0
206 + fi
207 +
208 + if [[ ! -x ${updater} ]]; then
209 + debug-print "${updater} is not executable"
210 + return
211 + fi
212
213 ebegin "Updating gtk3 input method module cache"
214 - GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
215 + GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
216 "${updater}" --update-cache
217 eend $?
218 }
219 @@ -416,11 +426,11 @@ gnome2_query_immodules_gtk3() {
220 # Updates glib's gio modules cache.
221 # This function should be called from pkg_postinst and pkg_postrm.
222 gnome2_giomodule_cache_update() {
223 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
224 - local updater="${EROOT}/usr/bin/${CHOST}-gio-querymodules"
225 + has ${EAPI:-0} 7 || BROOT=${EROOT}
226 + local updater="${BROOT%/}/usr/bin/${CHOST}-gio-querymodules"
227
228 if [[ ! -x ${updater} ]]; then
229 - updater="${EROOT}/usr/bin/gio-querymodules"
230 + updater="${BROOT%/}/usr/bin/gio-querymodules"
231 fi
232
233 if [[ ! -x ${updater} ]]; then
234 --
235 2.17.1