Date: Thu, 30 May 2013 06:33:46 GMT From: Chenguang Li <horus.li@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/179100: Add missing type for py-txamqp codec Message-ID: <201305300633.r4U6XkUA009367@oldred.FreeBSD.org> Resent-Message-ID: <201305300640.r4U6e0Xf075679@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 179100 >Category: ports >Synopsis: Add missing type for py-txamqp codec >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Thu May 30 06:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Chenguang Li >Release: 9.1-RELEASE i386 >Organization: >Environment: FreeBSD beta 9.1-RELEASE FreeBSD 9.1-RELEASE #1 r246142: Thu Jan 31 16:08:23 CST 2013 root@beta:/usr/obj/usr/src/sys/BETA >Description: Installed www/py-graphite-web, and set Carbon to use AMQP for communication. The message generated by Sensu metric could not be delivered to carbon, an exception showed below was caught(/usr/local/graphite/storage/log/console.log): .. ... --- <exception caught here> --- .. ... File "/usr/local/lib/python2.7/site-packages/txAMQP-0.3-py2.7.egg/txamqp/codec.py", line 184, in decode_table raise ValueError(repr(type)) exceptions.ValueError: 'F' Problem already discussed here: https://bugs.launchpad.net/txamqp/+bug/741147 >How-To-Repeat: Described above. >Fix: This problem is caused by the lack of the type "F" in decode_table method. Simply add a few lines of code will fix this problem. I checked out the code in trunk, which added a few more lines to codec.py, seems to be harmless, so I also include them in the patch attached. Patch attached with submission follows: diff -ruN py-txamqp.orig/Makefile py-txamqp/Makefile --- py-txamqp.orig/Makefile 2013-05-12 12:52:39.000000000 +0800 +++ py-txamqp/Makefile 2013-05-30 14:03:46.000000000 +0800 @@ -28,7 +28,7 @@ # TODO: Install txAMQP examples. # Don't try to install Twisted yourself, txAMQP. thx! -do-patch: +post-patch: @${REINPLACE_CMD} -e '/install_requires/s/^/#/' ${WRKSRC}/setup.py .include <bsd.port.mk> diff -ruN py-txamqp.orig/files/patch-src__txamqp__codec.py py-txamqp/files/patch-src__txamqp__codec.py --- py-txamqp.orig/files/patch-src__txamqp__codec.py 1970-01-01 08:00:00.000000000 +0800 +++ py-txamqp/files/patch-src__txamqp__codec.py 2013-05-30 13:55:04.000000000 +0800 @@ -0,0 +1,42 @@ +--- ./src/txamqp/codec.py.orig 2009-08-16 19:25:45.000000000 +0800 ++++ ./src/txamqp/codec.py 2013-05-30 13:54:50.000000000 +0800 +@@ -25,12 +25,12 @@ + """ + + from cStringIO import StringIO +-from struct import * ++from struct import pack, calcsize, unpack + + class EOF(Exception): + pass + +-class Codec: ++class Codec(object): + + def __init__(self, stream): + self.stream = stream +@@ -153,6 +153,13 @@ + def decode_longstr(self): + return self.dec_str("!L") + ++ # timestamp ++ def encode_timestamp(self, o): ++ self.pack("!Q", o) ++ ++ def decode_timestamp(self): ++ return self.unpack("!Q") ++ + # table + def encode_table(self, tbl): + enc = StringIO() +@@ -180,6 +187,10 @@ + value = self.decode_longstr() + elif type == "I": + value = self.decode_long() ++ elif type == "F": ++ value = self.decode_table() ++ elif type == "t": ++ value = (self.decode_octet() != 0) + else: + raise ValueError(repr(type)) + result[key] = value >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305300633.r4U6XkUA009367>