Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: gnome-base/gconf/, gnome-base/gconf/files/
Date: Thu, 20 Aug 2020 22:20:40
Message-Id: 1597961401.b0311e22fe1952500385ab56183d7fb8d13099ff.chewi@gentoo
1 commit: b0311e22fe1952500385ab56183d7fb8d13099ff
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 20 22:10:01 2020 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 20 22:10:01 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0311e22
7
8 gnome-base/gconf: Python 3, python-single-r1.eclass, EAPI 6
9
10 Only a single Python executable is installed so supporting multiple
11 Python versions does not make sense here.
12
13 Closes: https://bugs.gentoo.org/705354
14 Package-Manager: Portage-3.0.4, Repoman-3.0.1
15 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
16
17 gnome-base/gconf/files/gconf-3.2.6-python3.patch | 164 +++++++++++++++++++++++
18 gnome-base/gconf/gconf-3.2.6-r5.ebuild | 146 ++++++++++++++++++++
19 2 files changed, 310 insertions(+)
20
21 diff --git a/gnome-base/gconf/files/gconf-3.2.6-python3.patch b/gnome-base/gconf/files/gconf-3.2.6-python3.patch
22 new file mode 100644
23 index 00000000000..d1504cc0e23
24 --- /dev/null
25 +++ b/gnome-base/gconf/files/gconf-3.2.6-python3.patch
26 @@ -0,0 +1,164 @@
27 +From dbd4f1bc1992c2942538980e76a50c8b8a758d70 Mon Sep 17 00:00:00 2001
28 +From: Takao Fujiwara <tfujiwar@××××××.com>
29 +Date: Fri, 11 Dec 2015 18:29:49 +0900
30 +Subject: [PATCH] gsettings-schema-convert: Support python3
31 +
32 +https://bugzilla.gnome.org/show_bug.cgi?id=759334
33 +---
34 + gsettings/gsettings-schema-convert | 43 ++++++++++++++++++++------------------
35 + 1 file changed, 23 insertions(+), 20 deletions(-)
36 +
37 +diff --git a/gsettings/gsettings-schema-convert b/gsettings/gsettings-schema-convert
38 +index 913cc83..6ccf8c5 100755
39 +--- a/gsettings/gsettings-schema-convert
40 ++++ b/gsettings/gsettings-schema-convert
41 +@@ -25,6 +25,9 @@
42 + # TODO: we don't support migrating a pair from a gconf schema. It has yet to be
43 + # seen in real-world usage, though.
44 +
45 ++from __future__ import print_function
46 ++
47 ++import codecs
48 + import os
49 + import sys
50 +
51 +@@ -398,7 +401,7 @@ class SimpleSchemaParser:
52 +
53 + def _word_to_token(self, word):
54 + lower = word.lower()
55 +- if lower and lower in self.allowed_tokens.keys():
56 ++ if lower and lower in list(self.allowed_tokens.keys()):
57 + return lower
58 + raise GSettingsSchemaConvertException('\'%s\' is not a valid token.' % lower)
59 +
60 +@@ -594,7 +597,7 @@ class SimpleSchemaParser:
61 + self.object_stack.append(new_object)
62 +
63 + def parse(self):
64 +- f = open(self.file, 'r')
65 ++ f = codecs.open(self.file, 'r', encoding='utf-8')
66 + lines = [ line[:-1] for line in f.readlines() ]
67 + f.close()
68 +
69 +@@ -603,7 +606,7 @@ class SimpleSchemaParser:
70 + for line in lines:
71 + current_line_nb += 1
72 + self.parse_line(line)
73 +- except GSettingsSchemaConvertException, e:
74 ++ except GSettingsSchemaConvertException as e:
75 + raise GSettingsSchemaConvertException('%s:%s: %s' % (os.path.basename(self.file), current_line_nb, e))
76 +
77 + return self.root
78 +@@ -711,7 +714,7 @@ class XMLSchemaParser:
79 + schema = self._parse_schema(schema_node)
80 +
81 + for (child_schema, child_name) in schema._children:
82 +- if parent.has_key(child_schema):
83 ++ if child_schema in parent:
84 + raise GSettingsSchemaConvertException('Child \'%s\' is declared by two different schemas: \'%s\' and \'%s\'.' % (child_schema, parent[child_schema], schema.id))
85 + parent[child_schema] = schema
86 +
87 +@@ -719,7 +722,7 @@ class XMLSchemaParser:
88 +
89 + # now let's move all schemas where they should leave
90 + for schema in schemas:
91 +- if parent.has_key(schema.id):
92 ++ if schema.id in parent:
93 + parent_schema = parent[schema.id]
94 +
95 + # check that the paths of parent and child are supported by
96 +@@ -1054,31 +1057,31 @@ def main(args):
97 + (options, args) = parser.parse_args()
98 +
99 + if len(args) < 1:
100 +- print >> sys.stderr, 'Need a filename to work on.'
101 ++ print('Need a filename to work on.', file=sys.stderr)
102 + return 1
103 + elif len(args) > 1:
104 +- print >> sys.stderr, 'Too many arguments.'
105 ++ print('Too many arguments.', file=sys.stderr)
106 + return 1
107 +
108 + if options.simple and options.xml:
109 +- print >> sys.stderr, 'Too many output formats requested.'
110 ++ print('Too many output formats requested.', file=sys.stderr)
111 + return 1
112 +
113 + if not options.gconf and options.gettext_domain:
114 +- print >> sys.stderr, 'Default gettext domain can only be specified when converting a gconf schema.'
115 ++ print('Default gettext domain can only be specified when converting a gconf schema.', file=sys.stderr)
116 + return 1
117 +
118 + if not options.gconf and options.schema_id:
119 +- print >> sys.stderr, 'Default schema ID can only be specified when converting a gconf schema.'
120 ++ print('Default schema ID can only be specified when converting a gconf schema.', file=sys.stderr)
121 + return 1
122 +
123 + if not options.gconf and options.keep_underscores:
124 +- print >> sys.stderr, 'The --keep-underscores option can only be specified when converting a gconf schema.'
125 ++ print('The --keep-underscores option can only be specified when converting a gconf schema.', file=sys.stderr)
126 + return 1
127 +
128 + argfile = os.path.expanduser(args[0])
129 + if not os.path.exists(argfile):
130 +- print >> sys.stderr, '\'%s\' does not exist.' % argfile
131 ++ print('\'%s\' does not exist.' % argfile, file=sys.stderr)
132 + return 1
133 +
134 + if options.output:
135 +@@ -1095,7 +1098,7 @@ def main(args):
136 + try:
137 + parser = GConfSchemaParser(argfile, options.gettext_domain, options.schema_id, options.keep_underscores)
138 + schema_root = parser.parse()
139 +- except SyntaxError, e:
140 ++ except SyntaxError as e:
141 + raise GSettingsSchemaConvertException('\'%s\' does not look like a valid gconf schema file: %s' % (argfile, e))
142 + else:
143 + # autodetect if file is XML or not
144 +@@ -1104,7 +1107,7 @@ def main(args):
145 + schema_root = parser.parse()
146 + if not options.simple and not options.xml:
147 + options.simple = True
148 +- except SyntaxError, e:
149 ++ except SyntaxError as e:
150 + parser = SimpleSchemaParser(argfile)
151 + schema_root = parser.parse()
152 + if not options.simple and not options.xml:
153 +@@ -1113,10 +1116,10 @@ def main(args):
154 + if options.xml:
155 + node = schema_root.get_xml_node()
156 + try:
157 +- output = ET.tostring(node, pretty_print = True)
158 ++ output = ET.tostring(node, pretty_print = True, encoding="unicode")
159 + except TypeError:
160 + # pretty_print only works with lxml
161 +- output = ET.tostring(node)
162 ++ output = ET.tostring(node, encoding="unicode")
163 + else:
164 + output = schema_root.get_simple_string()
165 +
166 +@@ -1124,17 +1127,17 @@ def main(args):
167 + sys.stdout.write(output)
168 + else:
169 + try:
170 +- fout = open(options.output, 'w')
171 ++ fout = codecs.open(options.output, 'w', encoding='utf-8')
172 + fout.write(output)
173 + fout.close()
174 +- except GSettingsSchemaConvertException, e:
175 ++ except GSettingsSchemaConvertException as e:
176 + fout.close()
177 + if os.path.exists(options.output):
178 + os.unlink(options.output)
179 + raise e
180 +
181 +- except GSettingsSchemaConvertException, e:
182 +- print >> sys.stderr, '%s' % e
183 ++ except GSettingsSchemaConvertException as e:
184 ++ print('%s' % e, file=sys.stderr)
185 + return 1
186 +
187 + return 0
188 +--
189 +2.4.3
190 +
191
192 diff --git a/gnome-base/gconf/gconf-3.2.6-r5.ebuild b/gnome-base/gconf/gconf-3.2.6-r5.ebuild
193 new file mode 100644
194 index 00000000000..ca22f3e6fb6
195 --- /dev/null
196 +++ b/gnome-base/gconf/gconf-3.2.6-r5.ebuild
197 @@ -0,0 +1,146 @@
198 +# Copyright 1999-2020 Gentoo Authors
199 +# Distributed under the terms of the GNU General Public License v2
200 +
201 +EAPI=6
202 +
203 +GNOME_ORG_MODULE="GConf"
204 +GNOME2_LA_PUNT="yes"
205 +PYTHON_COMPAT=( python3_{7,8,9} )
206 +PYTHON_REQ_USE="xml"
207 +
208 +inherit gnome2 multilib-minimal python-single-r1
209 +
210 +DESCRIPTION="GNOME configuration system and daemon"
211 +HOMEPAGE="https://projects.gnome.org/gconf/"
212 +
213 +LICENSE="LGPL-2+"
214 +SLOT="2"
215 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-linux"
216 +IUSE="debug +introspection ldap policykit"
217 +
218 +RDEPEND="
219 + ${PYTHON_DEPS}
220 + >=dev-libs/glib-2.34.3:2[${MULTILIB_USEDEP}]
221 + >=dev-libs/dbus-glib-0.100.2:=[${MULTILIB_USEDEP}]
222 + >=sys-apps/dbus-1.6.18-r1:=[${MULTILIB_USEDEP}]
223 + >=dev-libs/libxml2-2.9.1-r4:2[${MULTILIB_USEDEP}]
224 + introspection? ( >=dev-libs/gobject-introspection-0.9.5:= )
225 + ldap? ( >=net-nds/openldap-2.4.38-r1:=[${MULTILIB_USEDEP}] )
226 + policykit? ( sys-auth/polkit:= )
227 +"
228 +DEPEND="${RDEPEND}
229 + dev-libs/libxslt
230 + dev-util/glib-utils
231 + dev-util/gtk-doc-am
232 + >=dev-util/intltool-0.35
233 + virtual/pkgconfig
234 +"
235 +
236 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
237 +
238 +pkg_setup() {
239 + kill_gconf
240 + python-single-r1_pkg_setup
241 +}
242 +
243 +src_prepare() {
244 + # Do not start gconfd when installing schemas, fix bug #238276, upstream #631983
245 + eapply "${FILESDIR}/${PN}-2.24.0-no-gconfd.patch"
246 +
247 + # Do not crash in gconf_entry_set_value() when entry pointer is NULL, upstream #631985
248 + eapply "${FILESDIR}/${PN}-2.28.0-entry-set-value-sigsegv.patch"
249 +
250 + # From 'master'
251 + # mconvert: enable recursive scheme lookup and fix a crasher
252 + eapply "${FILESDIR}/${P}-mconvert-crasher.patch"
253 +
254 + # dbus: Don't spew to console when unable to connect to dbus daemon
255 + eapply "${FILESDIR}/${P}-spew-console-error.patch"
256 +
257 + # gsettings-data-convert: Warn (and fix) invalid schema paths
258 + eapply "${FILESDIR}/${P}-gsettings-data-convert-paths.patch"
259 +
260 + # gsettings-data-convert: Migrate from Python 2 to 3.
261 + eapply "${FILESDIR}/${P}-python3.patch"
262 +
263 + gnome2_src_prepare
264 +}
265 +
266 +multilib_src_configure() {
267 + ECONF_SOURCE=${S} \
268 + gnome2_src_configure \
269 + --disable-static \
270 + --enable-gsettings-backend \
271 + --with-gtk=3.0 \
272 + --disable-orbit \
273 + $(use_enable debug) \
274 + $(multilib_native_use_enable introspection) \
275 + $(use_with ldap openldap) \
276 + $(multilib_native_use_enable policykit defaults-service)
277 +
278 + if multilib_is_native_abi; then
279 + ln -s "${S}"/doc/gconf/html doc/gconf/html || die
280 + fi
281 +}
282 +
283 +multilib_src_install() {
284 + gnome2_src_install
285 +}
286 +
287 +multilib_src_install_all() {
288 + python_fix_shebang "${ED}"/usr/bin/gsettings-schema-convert
289 +
290 + keepdir /etc/gconf/gconf.xml.mandatory
291 + keepdir /etc/gconf/gconf.xml.defaults
292 + # Make sure this directory exists, bug #268070, upstream #572027
293 + keepdir /etc/gconf/gconf.xml.system
294 +
295 + echo "CONFIG_PROTECT_MASK=\"/etc/gconf\"" > 50gconf
296 + echo 'GSETTINGS_BACKEND="gconf"' >> 50gconf
297 + doenvd 50gconf
298 + dodir /root/.gconfd
299 +}
300 +
301 +pkg_preinst() {
302 + kill_gconf
303 + gnome2_pkg_preinst
304 +}
305 +
306 +pkg_postinst() {
307 + kill_gconf
308 +
309 + gnome2_pkg_postinst
310 +
311 + multilib_pkg_postinst() {
312 + gnome2_giomodule_cache_update \
313 + || die "Update GIO modules cache failed (for ${ABI})"
314 + }
315 + multilib_foreach_abi multilib_pkg_postinst
316 +
317 + # change the permissions to avoid some gconf bugs
318 + einfo "changing permissions for gconf dirs"
319 + find "${EPREFIX}"/etc/gconf/ -type d -exec chmod ugo+rx "{}" \;
320 +
321 + einfo "changing permissions for gconf files"
322 + find "${EPREFIX}"/etc/gconf/ -type f -exec chmod ugo+r "{}" \;
323 +}
324 +
325 +pkg_postrm() {
326 + gnome2_pkg_postrm
327 +
328 + multilib_pkg_postrm() {
329 + gnome2_giomodule_cache_update \
330 + || die "Update GIO modules cache failed (for ${ABI})"
331 + }
332 + multilib_foreach_abi multilib_pkg_postrm
333 +}
334 +
335 +kill_gconf() {
336 + # This function will kill all running gconfd-2 that could be causing troubles
337 + if [ -x "${EPREFIX}"/usr/bin/gconftool-2 ]
338 + then
339 + "${EPREFIX}"/usr/bin/gconftool-2 --shutdown
340 + fi
341 +
342 + return 0
343 +}