Bug 179100 - Add missing type for net/py-txamqp codec
Summary: Add missing type for net/py-txamqp codec
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Xin LI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-30 07:40 UTC by horus.li
Modified: 2013-05-30 08:25 UTC (History)
0 users

See Also:


Attachments
file.diff (1.70 KB, patch)
2013-05-30 07:40 UTC, horus.li
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description horus.li 2013-05-30 07:40:00 UTC
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

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:
How-To-Repeat: Described above.
Comment 1 Xin LI freebsd_committer freebsd_triage 2013-05-30 08:05:43 UTC
Responsible Changed
From-To: freebsd-ports-bugs->delphij

Take.
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-05-30 08:07:46 UTC
Author: delphij
Date: Thu May 30 07:07:38 2013
New Revision: 319405
URL: http://svnweb.freebsd.org/changeset/ports/319405

Log:
   - Add missing type for py-txamqp codec
   - Pass maintainership to submitter.
  
  PR:		ports/179100
  Submitted by:	Chenguang Li <horus.li gmail.com>

Added:
  head/net/py-txamqp/files/
  head/net/py-txamqp/files/patch-src__txamqp__codec.py   (contents, props changed)
Modified:
  head/net/py-txamqp/Makefile

Modified: head/net/py-txamqp/Makefile
==============================================================================
--- head/net/py-txamqp/Makefile	Thu May 30 05:55:03 2013	(r319404)
+++ head/net/py-txamqp/Makefile	Thu May 30 07:07:38 2013	(r319405)
@@ -3,14 +3,14 @@
 
 PORTNAME=	txamqp
 PORTVERSION=	0.3
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net python
 MASTER_SITES=	http://launchpadlibrarian.net/30388120/ \
 		# http://launchpad.net/txamqp/trunk/${PORTVERSION}/+download/
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
 DISTNAME=	python-${PORTNAME}_${PORTVERSION}.orig
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	horus.li@gmail.com
 COMMENT=	Twisted Python library for the AMQP messaging protocol
 
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}thrift>0:${PORTSDIR}/devel/py-thrift
@@ -28,7 +28,7 @@ PLIST_SUB=		PORTNAME="${PORTNAME}"
 # 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>

Added: head/net/py-txamqp/files/patch-src__txamqp__codec.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/py-txamqp/files/patch-src__txamqp__codec.py	Thu May 30 07:07:38 2013	(r319405)
@@ -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
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Xin LI freebsd_committer freebsd_triage 2013-05-30 08:07:48 UTC
State Changed
From-To: open->closed

Committed, thanks!