[Xcb] xcb-proto-1.7 broke existing xcbgen API

Jeremy Huddleston jeremyhu at apple.com
Thu Mar 8 09:45:40 PST 2012


Ping.  Any thoughts on "the right way" to handle this?

On Mar 3, 2012, at 9:55 PM, Jeremy Huddleston <jeremyhu at freedesktop.org> wrote:

> Back in late 2010(1), someone reported that xpyb failed to build with recent xcb-proto changes.  It seems this regression in xcb-proto was never addressed and unfortunately xcb-proto-1.7 shipped.
> 
> I bisected the issue to 76ca2c0b1 which changed xcbgen's API from using "parent" to using "parents".  The patch actually made two completely unrelated changes simultaneously; in the future, please remember to keep one change per patch.
> 
> So how should this be addressed?  
>  1) We revert the entire thing and then push just the spec changes
>  2) We just "flag day" this and move on, changing xpyb.
>  3) We support both "parent" and "parents" for maximum compatability?
> 
> For 3)
> From 140262f2291d09863e23fc587bb0034f5bddf571 Mon Sep 17 00:00:00 2001
> From: Jeremy Huddleston <jeremyhu at apple.com>
> Date: Sat, 3 Mar 2012 21:53:59 -0800
> Subject: [PATCH] xcbgen: Address API incompatability between xcb-proto-1.6
> and xcb-proto-1.7
> 
> Regression From: 76ca2c0b1527541be59c344118c538ba055ad9d8
> 
> Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> ---
> xcbgen/xtypes.py |    9 +++++++++
> 1 file changed, 9 insertions(+)
> 
> diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
> index 14c318a..faf2463 100644
> --- a/xcbgen/xtypes.py
> +++ b/xcbgen/xtypes.py
> @@ -159,6 +159,10 @@ class ListType(Type):
>         Type.__init__(self, member.name)
>         self.is_list = True
>         self.member = member
> +
> +        # We store both parent and parents for API compatability
> +        # <1.6 used parent (which is deprecated) and 1.7 used parents
> +        self.parent = list(parent)
>         self.parents = list(parent)
> 
>         if elt.tag == 'list':
> @@ -357,7 +361,12 @@ class SwitchType(ComplexType):
> 
>     def __init__(self, name, elt, *parents):
>         ComplexType.__init__(self, name, elt)
> +
> +        # We store both parent and parents for API compatability
> +        # <1.6 used parent (which is deprecated) and 1.7 used parents
> +        self.parent = parents
>         self.parents = parents
> +
>         # FIXME: switch cannot store lenfields, so it should just delegate the parents
>         self.lenfield_parent = list(parents) + [self]
>         # self.fields contains all possible fields collected from the Bitcase objects, 
> -- 
> 1.7.9.2
> 
> 
> 
> 
> 76ca2c0b1527541be59c344118c538ba055ad9d8 is the first bad commit
> commit 76ca2c0b1527541be59c344118c538ba055ad9d8
> Author: Christoph Reimann <oss at arcor.de>
> Date:   Mon Aug 16 18:32:13 2010 +0200
> 
>    xcbgen: small fix to store anchestor objects more systematic
>    xml: small fixes according to Xlib or the spec
> 
> :040000 040000 aa9bf5cfab1a4ffeb98873a581d846823340cf58 5841b923617e73a242896ed8763ec559b120bedd M	src
> :040000 040000 108193a81580d531c2c147e16cc539c388c87b1a cf01ce48775fed08e361ae295a0790c76a19cdcd M	xcbgen
> 
> 
> 1: http://lists.freedesktop.org/archives/xcb/2011-January/006724.html
>> On 12/29/2010 11:22 AM, Nicolas Chauvat wrote:
>>> Hi,
>>> 
>>> I am trying to compile the qtile window manager.
>>> 
>>> I use the attached script under Debian/Lenny and Debian/Squeeze.
>>> 
>>> I get the following error::
>>> 
>>>   $ /usr/bin/python ./py_client.py -p
>>>   /home/nico/tmp/local-qtile/lib/python2.5/site-packages
>>>   /home/nico/tmp/local-qtile/share/xcb/xproto.xml
>>>   Traceback (most recent call last):
>>>     File "./py_client.py", line 623, in<module>
>>>       module.generate()
>>>     File "/home/nico/tmp/local-qtile/lib/python2.5/site-packages/xcbgen/state.py",
>>>     line 101, in generate
>>>       item.out(name)
>>>     File "./py_client.py", line 363, in py_struct
>>>       _py_complex(self, name)
>>>     File "./py_client.py", line 327, in _py_complex
>>>       _py('        self.%s = xcb.List(self, count, %s, %s, %d)',
>>>       _n(field.field_name), _py_get_expr(field.type.expr),
>>>       field.py_listtype, field.py_listsize)
>>>     File "./py_client.py", line 278, in _py_get_expr
>>>       lenexp = _py_get_length_field(expr)
>>>     File "./py_client.py", line 264, in _py_get_length_field
>>>       if hasattr(expr.parent.parent, "opcode"):
>>>   AttributeError: 'ListType' object has no attribute 'parent'
>>> 
>>> The versions I have are::
>>> 
>>>   proto c4497cdbf0640c376cdebb0a9e5ea62458e6ba51
>>>   xcb   3c5813697169a33ecfd6ac0ab5641dec654f6612
>>>   xpyb  68015314d8f95ee6029d07a4bf89bdd73c46ac9c
>>> 
>>> Since the changeset that added line 264 to py_client is fairly recent,
>>> I am surprised it does not compile with the head of xcb and proto.
>>> 
>>> Any hint ?
>>> 
>> 
>> Recent changes seem to have broken it, will try and take a look at it 
>> this week, thanks for the report.
>> 
>> --Eamon
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
> 



More information about the Xcb mailing list