Gentoo Archives: gentoo-commits

From: Alexandre Restovtsev <tetromino@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gnome:gnome-next commit in: dev-libs/gobject-introspection/files/, dev-libs/gobject-introspection/
Date: Mon, 26 Sep 2011 02:52:13
Message-Id: 00a6d4dd64014ea46a5a86e36c06ea836fc171a8.tetromino@gentoo
1 commit: 00a6d4dd64014ea46a5a86e36c06ea836fc171a8
2 Author: Alexandre Rostovtsev <tetromino <AT> gmail <DOT> com>
3 AuthorDate: Mon Sep 26 01:38:18 2011 +0000
4 Commit: Alexandre Restovtsev <tetromino <AT> gmail <DOT> com>
5 CommitDate: Mon Sep 26 01:38:18 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=00a6d4dd
7
8 dev-libs/gobject-introspection: 1.29.17 → 1.30.0
9
10 Version bump. Add upstream patch to fix g_irepository_fix_c_prefix().
11
12 ---
13 .../files/1.29.17-docbookdescription.py | 185 --------------------
14 .../gobject-introspection-1.30.0-c_prefix.patch | 47 +++++
15 ....ebuild => gobject-introspection-1.30.0.ebuild} | 7 +-
16 3 files changed, 50 insertions(+), 189 deletions(-)
17
18 diff --git a/dev-libs/gobject-introspection/files/1.29.17-docbookdescription.py b/dev-libs/gobject-introspection/files/1.29.17-docbookdescription.py
19 deleted file mode 100644
20 index 9ec7219..0000000
21 --- a/dev-libs/gobject-introspection/files/1.29.17-docbookdescription.py
22 +++ /dev/null
23 @@ -1,185 +0,0 @@
24 -
25 -TAG_PROGRAM_LISTING = '<programlisting'
26 -TAG_CDATA = '<![CDATA['
27 -TAGS = {TAG_PROGRAM_LISTING, TAG_CDATA, ']]>', '</programlisting>'}
28 -
29 -def get_formatted_description(description):
30 - desc = description.replace("|[", "<informalexample><programlisting>") \
31 - .replace("]|", "</programlisting></informalexample>")
32 -
33 - desc = "<para>%s</para>" % desc
34 -
35 -# we still need to handle this case
36 -# # Handle "#include <xxxxx>"
37 -# $text =~ s/#include(\s+)<([^>]+)>/#include$1&lt;$2&gt;/g;
38 -
39 - formatted_desc = ""
40 -
41 - inside_tags = []
42 - last_offset = 0
43 - for start, end, tag in _find_xml_tag_matches(desc):
44 - if len(inside_tags) == 0:
45 - new_desc = "\n</para>\n<para>\n".join(desc[last_offset:start].split('\n\n'))
46 - else:
47 - new_desc = desc[last_offset:start]
48 -
49 - if TAG_CDATA not in inside_tags:
50 - new_desc = _escape_non_cdata_section(new_desc)
51 -
52 - formatted_desc += new_desc
53 - formatted_desc += tag
54 - if tag == TAG_PROGRAM_LISTING:
55 - formatted_desc += '>'
56 -
57 - if tag in (TAG_CDATA, TAG_PROGRAM_LISTING):
58 - inside_tags.append(tag)
59 - else:
60 - try:
61 - inside_tags.pop()
62 - except IndexError:
63 - print "Error: mismatched tag:", tag
64 - last_offset = end
65 -
66 - formatted_desc += _escape_non_cdata_section(desc[last_offset:])
67 - return formatted_desc
68 -
69 -def _find_xml_tag_matches(string):
70 - offset = 0
71 - while True:
72 - indexes = []
73 - for tag in TAGS:
74 - pos = string.find(tag, offset)
75 - if pos != -1:
76 - indexes.append((tag, pos))
77 -
78 - if indexes:
79 - tag, first = min(indexes, key=lambda x: x[1])
80 - if tag == TAG_PROGRAM_LISTING:
81 - end = string.find('>', first + len(tag) - 1) + 1
82 - else:
83 - end = first + len(tag)
84 - offset = end
85 - yield first, end, tag
86 - else:
87 - return
88 -
89 -def _escape_non_cdata_section(string):
90 - string = _escape_ampersand_not_in_entity(string)
91 - string = _escape_lt_not_in_xml_tag(string)
92 - return _escape_gt_not_in_xml_tag(string)
93 -
94 -def _escape_ampersand_not_in_entity(string):
95 - parts = string.split('&')
96 -
97 - output = parts[0]
98 - for part in parts[1:]:
99 - end = part.find(';')
100 - if end == -1 or not part[:end].isalpha():
101 - output += "&amp;"
102 - else:
103 - output += "&"
104 - output += part
105 -
106 - return output
107 -
108 -def _is_valid_xml_tag_name(name):
109 - if len(name) < 1:
110 - return False
111 - elif name.isalpha() or (name[0].isalpha() and name[1:].isalnum()):
112 - return True
113 -
114 -def _is_valid_xml_tag(string):
115 - # handle case where line end is between tag name and first argument.
116 - # ie. <link\nlinkend="link-id">My Link</link>
117 - string = string.replace('\n', ' ')
118 -
119 - if string[-1] == '/':
120 - string = string[:-1]
121 -
122 - # string is the inner part of the tag, without < and >
123 - if string[0] == '/' and _is_valid_xml_tag_name(string[1:]):
124 - #valid end tag
125 - return True
126 - elif _is_valid_xml_tag_name(string):
127 - #valid start tag with not params
128 - return True
129 - elif " " in string:
130 - # we are looking for: <tagname arg="value" arg2="value2">
131 - # TODO: handle spaces in values (between quotations)
132 - tagname, rest = string.split(" ", 1)
133 - if not _is_valid_xml_tag_name(tagname):
134 - return False
135 -
136 - while rest.strip():
137 - rest = rest.lstrip()
138 -
139 - if not '=' in rest:
140 - return False
141 - argname, rest = rest.split('=', 1)
142 - if not _is_valid_xml_tag_name(argname):
143 - return False
144 - if rest[0] != '"':
145 - return False
146 - value, rest = rest[1:].split('"', 1)
147 -
148 - return True
149 -
150 -def _escape_lt_not_in_xml_tag(string):
151 - parts = string.split('<')
152 -
153 - output = parts[0]
154 - for part in parts[1:]:
155 - end = part.find('>')
156 - if end == -1 or not _is_valid_xml_tag(part[:end]):
157 - output += "&lt;"
158 - else:
159 - output += "<"
160 - output += part
161 -
162 - return output
163 -
164 -def _escape_gt_not_in_xml_tag(string):
165 - parts = string.split('>')
166 -
167 - output = parts[0]
168 - for part in parts[1:]:
169 - start = output.rfind('<')
170 - if start == -1 or not _is_valid_xml_tag(output[start+1:]):
171 - output += "&gt;"
172 - else:
173 - output += ">"
174 - output += part
175 -
176 - return output
177 -
178 -
179 -def test():
180 - assert _is_valid_xml_tag_name('a')
181 - assert _is_valid_xml_tag_name('refsect1')
182 - assert not _is_valid_xml_tag_name('1refsect')
183 - assert not _is_valid_xml_tag_name('1')
184 -
185 - assert _is_valid_xml_tag('/a')
186 - assert _is_valid_xml_tag('/refsect1')
187 - assert not _is_valid_xml_tag('/1')
188 - assert _is_valid_xml_tag('link')
189 - assert _is_valid_xml_tag('link linkend="value"')
190 - assert _is_valid_xml_tag('link linkend="value"')
191 - assert _is_valid_xml_tag('link/')
192 - assert _is_valid_xml_tag('link linkend="value"/')
193 - assert _is_valid_xml_tag('link linkend="value" arg23="anothervalue"')
194 - assert _is_valid_xml_tag('link linkend="value" arg23="anothervalue with spaces"')
195 - assert not _is_valid_xml_tag('link linkend="value arg23="anothervalue with spaces"')
196 - assert not _is_valid_xml_tag('link linkend')
197 - assert _is_valid_xml_tag('link\nlinkend="link-id"')
198 - assert _is_valid_xml_tag('xref linkend="gtkstylecontext-classes"/')
199 -
200 - assert _is_valid_xml_tag('a href="http://www.gtk.org" title="&lt;i&gt;Our&lt;/i&gt; website"')
201 - assert _is_valid_xml_tag('ulink \nurl="http://www.freedesktop.org/Standards/wm-spec"')
202 -
203 - string = 'gtk_label_set_markup (label, "Go to the <a href="http://www.gtk.org" ' \
204 - + 'title="&lt;i&gt;Our&lt;/i&gt; website">GTK+ website</a> for more...");'
205 - assert _escape_lt_not_in_xml_tag(string) == string
206 -
207 -if __name__ == '__main__':
208 - test()
209
210 diff --git a/dev-libs/gobject-introspection/files/gobject-introspection-1.30.0-c_prefix.patch b/dev-libs/gobject-introspection/files/gobject-introspection-1.30.0-c_prefix.patch
211 new file mode 100644
212 index 0000000..d15dcd1
213 --- /dev/null
214 +++ b/dev-libs/gobject-introspection/files/gobject-introspection-1.30.0-c_prefix.patch
215 @@ -0,0 +1,47 @@
216 +From e8b336cc0747b528263ec809d142f4803dcbdf35 Mon Sep 17 00:00:00 2001
217 +From: Colin Walters <walters@××××××.org>
218 +Date: Wed, 21 Sep 2011 17:13:45 +0000
219 +Subject: repository: Fix g_irepository_get_c_prefix()
220 +
221 +It was returning the wrong data.
222 +
223 +https://bugzilla.gnome.org/show_bug.cgi?id=659749
224 +---
225 +diff --git a/girepository/girepository.c b/girepository/girepository.c
226 +index cc81107..b5cd4c7 100644
227 +--- a/girepository/girepository.c
228 ++++ b/girepository/girepository.c
229 +@@ -929,7 +929,7 @@ g_irepository_get_c_prefix (GIRepository *repository,
230 + g_return_val_if_fail (typelib != NULL, NULL);
231 +
232 + header = (Header *) typelib->data;
233 +- if (header->shared_library)
234 ++ if (header->c_prefix)
235 + return g_typelib_get_string (typelib, header->c_prefix);
236 + else
237 + return NULL;
238 +diff --git a/tests/repository/gitestrepo.c b/tests/repository/gitestrepo.c
239 +index cdaeb4c..05ea5d9 100644
240 +--- a/tests/repository/gitestrepo.c
241 ++++ b/tests/repository/gitestrepo.c
242 +@@ -46,6 +46,7 @@ main(int argc, char **argv)
243 + GIBaseInfo *siginfo;
244 + GIEnumInfo *errorinfo;
245 + GType gtype;
246 ++ const char *prefix;
247 +
248 + g_type_init ();
249 +
250 +@@ -55,6 +56,10 @@ main(int argc, char **argv)
251 + if (!ret)
252 + g_error ("%s", error->message);
253 +
254 ++ prefix = g_irepository_get_c_prefix (repo, "Gio");
255 ++ g_assert (prefix != NULL);
256 ++ g_assert_cmpstr (prefix, ==, "G");
257 ++
258 + info = g_irepository_find_by_name (repo, "Gio", "Cancellable");
259 + g_assert (info != NULL);
260 + g_assert (g_base_info_get_type (info) == GI_INFO_TYPE_OBJECT);
261 +--
262 +cgit v0.9.0.2
263
264 diff --git a/dev-libs/gobject-introspection/gobject-introspection-1.29.17.ebuild b/dev-libs/gobject-introspection/gobject-introspection-1.30.0.ebuild
265 similarity index 91%
266 rename from dev-libs/gobject-introspection/gobject-introspection-1.29.17.ebuild
267 rename to dev-libs/gobject-introspection/gobject-introspection-1.30.0.ebuild
268 index 0346999..83b78fa 100644
269 --- a/dev-libs/gobject-introspection/gobject-introspection-1.29.17.ebuild
270 +++ b/dev-libs/gobject-introspection/gobject-introspection-1.30.0.ebuild
271 @@ -45,6 +45,9 @@ pkg_setup() {
272 }
273
274 src_prepare() {
275 + # Patch from upstream git master to fix g_irepository_get_c_prefix
276 + epatch "${FILESDIR}/${P}-c_prefix.patch"
277 +
278 # FIXME: Parallel compilation failure with USE=doc
279 use doc && MAKEOPTS="-j1"
280
281 @@ -58,10 +61,6 @@ src_prepare() {
282 src_install() {
283 gnome2_src_install
284 python_convert_shebangs 2 "${ED}"usr/bin/g-ir-{annotation-tool,doc-tool,scanner}
285 -
286 - # https://bugzilla.gnome.org/show_bug.cgi?id=657686
287 - insinto /usr/$(get_libdir)/${PN}/giscanner
288 - newins "${FILESDIR}/${PV}-docbookdescription.py" docbookdescription.py
289 }
290
291 pkg_postinst() {