Gentoo Archives: gentoo-dev

From: David Michael <fedora.dm0@×××××.com>
To: gentoo-dev@l.g.o
Cc: gnome@g.o
Subject: [gentoo-dev] [PATCH] gnome2-utils.eclass: skip executing cross-compiled tools
Date: Thu, 03 Dec 2020 04:04:46
Message-Id: 87o8jbedrc.fsf@gmail.com
1 Executing tools installed in ROOT will fail when cross-compiling,
2 so this prints a warning about manually running the command instead
3 in that case. The warning is copied from dev-libs/glib.
4
5 This also reorders the exception handling by increasing severity so
6 that the "nothing to do" non-error returns first, otherwise the
7 expected problem of unexecutable cross-compiled commands returns,
8 otherwise the unexpected problem of missing commands returns.
9
10 The immodule cache functions were updated to handle a different
11 problem. They run native tools from BROOT, but they are not
12 guaranteed to exist while cross-compiling (e.g. gtk+ can't BDEPEND
13 on itself, so the cross-compiled gtk+ can be installed before the
14 native gtk+, which fails from gtk-query-immodules not existing).
15
16 Closes: https://bugs.gentoo.org/757483
17 Signed-off-by: David Michael <fedora.dm0@×××××.com>
18 ---
19
20 Hi,
21
22 Here is an eclass patch to fix bug #757483. I wasn't sure if the
23 cross-compiling message should be a warning while everything else was a
24 debug-print, but I left it matching what glib does. The message in the
25 glib ebuilds should be dropped if this is applied.
26
27 Thanks.
28
29 David
30
31 eclass/gnome2-utils.eclass | 98 +++++++++++++++++++++++++++++---------
32 1 file changed, 75 insertions(+), 23 deletions(-)
33
34 diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
35 index 06643db0f60..4abaf3a1a5c 100644
36 --- a/eclass/gnome2-utils.eclass
37 +++ b/eclass/gnome2-utils.eclass
38 @@ -16,8 +16,9 @@
39
40 [[ ${EAPI:-0} == [012345] ]] && inherit multilib
41 # eutils.eclass: emktemp
42 +# toolchain-funs.eclass: tc-is-cross-compiler
43 # xdg-utils.eclass: xdg_environment_reset, xdg_icon_cache_update
44 -inherit eutils xdg-utils
45 +inherit eutils toolchain-funcs xdg-utils
46
47 case "${EAPI:-0}" in
48 0|1|2|3|4|5|6|7) ;;
49 @@ -125,13 +126,21 @@ gnome2_gconf_install() {
50 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
51 local updater="${EROOT%/}${GCONFTOOL_BIN}"
52
53 - if [[ ! -x "${updater}" ]]; then
54 - debug-print "${updater} is not executable"
55 + if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
56 + debug-print "No GNOME 2 GConf schemas found"
57 return
58 fi
59
60 - if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
61 - debug-print "No GNOME 2 GConf schemas found"
62 + if tc-is-cross-compiler ; then
63 + ewarn "Updating of GNOME 2 GConf schemas skipped due to cross-compilation."
64 + ewarn "You might want to run gconftool-2 manually on the target for"
65 + ewarn "your final image and re-run it when packages installing"
66 + ewarn "GNOME 2 GConf schemas get upgraded or added to the image."
67 + return
68 + fi
69 +
70 + if [[ ! -x "${updater}" ]]; then
71 + debug-print "${updater} is not executable"
72 return
73 fi
74
75 @@ -166,13 +175,20 @@ gnome2_gconf_uninstall() {
76 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
77 local updater="${EROOT%/}${GCONFTOOL_BIN}"
78
79 - if [[ ! -x "${updater}" ]]; then
80 - debug-print "${updater} is not executable"
81 + if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
82 + debug-print "No GNOME 2 GConf schemas found"
83 return
84 fi
85
86 - if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
87 - debug-print "No GNOME 2 GConf schemas found"
88 + if tc-is-cross-compiler ; then
89 + ewarn "Removal of GNOME 2 GConf schemas skipped due to cross-compilation."
90 + ewarn "You might want to run gconftool-2 manually on the target for"
91 + ewarn "your final image to uninstall this package's schemas."
92 + return
93 + fi
94 +
95 + if [[ ! -x "${updater}" ]]; then
96 + debug-print "${updater} is not executable"
97 return
98 fi
99
100 @@ -269,13 +285,21 @@ gnome2_scrollkeeper_update() {
101 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
102 local updater="${EROOT%/}${SCROLLKEEPER_UPDATE_BIN}"
103
104 - if [[ ! -x "${updater}" ]] ; then
105 - debug-print "${updater} is not executable"
106 + if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
107 + debug-print "No scroll cache to update"
108 return
109 fi
110
111 - if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
112 - debug-print "No scroll cache to update"
113 + if tc-is-cross-compiler ; then
114 + ewarn "Updating of scrollkeeper database skipped due to cross-compilation."
115 + ewarn "You might want to run scrollkeeper-update manually on the target"
116 + ewarn "for your final image and re-run it when packages installing"
117 + ewarn "scrollkeeper OMF files get upgraded or added to the image."
118 + return
119 + fi
120 +
121 + if [[ ! -x "${updater}" ]] ; then
122 + debug-print "${updater} is not executable"
123 return
124 fi
125
126 @@ -305,6 +329,14 @@ gnome2_schemas_update() {
127 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
128 local updater="${EROOT%/}${GLIB_COMPILE_SCHEMAS}"
129
130 + if tc-is-cross-compiler ; then
131 + ewarn "Updating of GSettings schemas skipped due to cross-compilation."
132 + ewarn "You might want to run glib-compile-schemas manually on the target"
133 + ewarn "for your final image and re-run it when packages installing"
134 + ewarn "GSettings schemas get upgraded or added to the image."
135 + return
136 + fi
137 +
138 if [[ ! -x ${updater} ]]; then
139 debug-print "${updater} is not executable"
140 return
141 @@ -334,18 +366,23 @@ gnome2_gdk_pixbuf_savelist() {
142 gnome2_gdk_pixbuf_update() {
143 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
144 local updater="${EROOT%/}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
145 + [[ -x ${updater} ]] || updater="${EROOT%/}/usr/bin/gdk-pixbuf-query-loaders"
146
147 - if [[ ! -x ${updater} ]]; then
148 - updater="${EROOT%/}/usr/bin/gdk-pixbuf-query-loaders"
149 + if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
150 + debug-print "gdk-pixbuf loader cache does not need an update"
151 + return
152 fi
153
154 - if [[ ! -x ${updater} ]]; then
155 - debug-print "${updater} is not executable"
156 + if tc-is-cross-compiler ; then
157 + ewarn "Updating of gdk-pixbuf loader cache skipped due to cross-compilation."
158 + ewarn "You might want to run gdk-pixbuf-query-loaders manually on the target"
159 + ewarn "for your final image and re-run it when packages installing"
160 + ewarn "gdk-pixbuf loaders get upgraded or added to the image."
161 return
162 fi
163
164 - if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
165 - debug-print "gdk-pixbuf loader cache does not need an update"
166 + if [[ ! -x ${updater} ]]; then
167 + debug-print "${updater} is not executable"
168 return
169 fi
170
171 @@ -363,7 +400,12 @@ gnome2_gdk_pixbuf_update() {
172 # Updates gtk2 immodules/gdk-pixbuf loaders listing.
173 gnome2_query_immodules_gtk2() {
174 local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-2.0
175 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0
176 + [[ -x ${updater} ]] || updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0
177 +
178 + if [[ ! -x ${updater} ]]; then
179 + debug-print "${updater} is not executable"
180 + return
181 + fi
182
183 ebegin "Updating gtk2 input method module cache"
184 GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
185 @@ -376,7 +418,12 @@ gnome2_query_immodules_gtk2() {
186 # Updates gtk3 immodules/gdk-pixbuf loaders listing.
187 gnome2_query_immodules_gtk3() {
188 local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-3.0
189 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0
190 + [[ -x ${updater} ]] || updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0
191 +
192 + if [[ ! -x ${updater} ]]; then
193 + debug-print "${updater} is not executable"
194 + return
195 + fi
196
197 ebegin "Updating gtk3 input method module cache"
198 GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
199 @@ -391,9 +438,14 @@ gnome2_query_immodules_gtk3() {
200 gnome2_giomodule_cache_update() {
201 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
202 local updater="${EROOT%/}/usr/bin/${CHOST}-gio-querymodules"
203 + [[ -x ${updater} ]] || updater="${EROOT%/}/usr/bin/gio-querymodules"
204
205 - if [[ ! -x ${updater} ]]; then
206 - updater="${EROOT%/}/usr/bin/gio-querymodules"
207 + if tc-is-cross-compiler ; then
208 + ewarn "Updating of GIO modules cache skipped due to cross-compilation."
209 + ewarn "You might want to run gio-querymodules manually on the target for"
210 + ewarn "your final image for performance reasons and re-run it when packages"
211 + ewarn "installing GIO modules get upgraded or added to the image."
212 + return
213 fi
214
215 if [[ ! -x ${updater} ]]; then
216 --
217 2.26.2