--- a/components/python/librabbitmq/Makefile Thu Aug 25 16:28:16 2016 -0700
+++ b/components/python/librabbitmq/Makefile Thu Aug 25 22:11:53 2016 -0700
@@ -24,11 +24,6 @@
#
include ../../../make-rules/shared-macros.mk
-# librabbitmq will not configure with Studio compilers. Despite
-# passing LDFLAGS explicitly, the configure script in $SRC/clib is not
-# able to find getaddrinfo in libsocket. GCC builds with no issue.
-COMPILER= gcc
-
COMPONENT_NAME= librabbitmq
COMPONENT_VERSION= 1.6.1
COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
@@ -50,14 +45,21 @@
ASLR_MODE = $(ASLR_NOT_APPLICABLE)
+CFLAGS += -erroff=E_EMPTY_DECLARATION $(studio_C99_ENABLE)
+
+COMPONENT_TEST_ARGS= setup.py build test
+COMPONENT_TEST_DIR= $(SOURCE_DIR)
+COMPONENT_TEST_ENV += PYTHONPATH=$(PROTO_DIR)$(PYTHON_VENDOR_PACKAGES.32)
+
# common targets
build: $(BUILD_32_and_64)
install: $(INSTALL_32_and_64)
-# librabbitmq tests fail to compile; more investigation is needed.
-test: $(NO_TESTS)
+# svc:/application/rabbitmq:default needs to be online for tests to run
+test: $(TEST_32_and_64)
-system-test: $(NO_TESTS)
+system-test: $(NO_TESTS)
+
REQUIRED_PACKAGES += system/library
--- a/components/python/librabbitmq/librabbitmq-PYVER.p5m Thu Aug 25 16:28:16 2016 -0700
+++ b/components/python/librabbitmq/librabbitmq-PYVER.p5m Thu Aug 25 22:11:53 2016 -0700
@@ -53,9 +53,8 @@
depend type=optional \
fmri=library/python-2/librabbitmq-$(PYV)@1.0.1,5.12-5.12.0.0.0.41.0
-# force a dependency on the Python runtime
-depend type=require fmri=__TBD pkg.debug.depend.file=python$(PYVER) \
- pkg.debug.depend.path=usr/bin
+# force a dependency on amqp; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python/amqp-$(PYV)
# force a dependency on the librabbitmq package
depend type=require \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/librabbitmq/patches/librabbitmq-issue-72.patch Thu Aug 25 22:11:53 2016 -0700
@@ -0,0 +1,108 @@
+This upstream patch addresses the following upstream issue
+
+ https://github.com/celery/librabbitmq/issues/72
+
+and consists of the the consolidation of the following three commits
+
+ 017e25f4ecb7e87a201ec0432999a6b8dd9d434c
+ 4cebef5a2bde65027fe448461a7717b81ebb1b4a
+ ca579d1ae42fe7d41afeb5c8dfd7cfd06722b281
+
+that were part of the following pull request
+
+ https://github.com/celery/librabbitmq/pull/74
+
+--- librabbitmq-1.6.1/Modules/_librabbitmq/connection.c.~1~ 2014-11-17 05:37:38.000000000 -0800
++++ librabbitmq-1.6.1/Modules/_librabbitmq/connection.c 2016-08-24 01:14:26.782217730 -0700
+@@ -349,7 +349,7 @@ PyIter_ToAMQArray(amqp_connection_state_
+ }
+ else if (PyLong_Check(item) || PyInt_Check(item)) {
+ /* Int | Long */
+- clong_value = (int64_t)PyLong_AsLong(item);
++ clong_value = (int64_t)PyLong_AsLongLong(item);
+ AMQArray_SetIntValue(&dst, clong_value);
+ }
+ else {
+@@ -581,7 +581,7 @@ AMQArray_toPyList(amqp_array_t *array)
+ {
+ register PyObject *value = NULL;
+ PyObject *list = NULL;
+- list = PyList_New(array->num_entries);
++ list = PyList_New((PY_SIZE_TYPE) array->num_entries);
+
+ if (array) {
+ int i;
+@@ -732,7 +732,7 @@ amqp_basic_deliver_to_PyDict(PyObject *d
+ PyObject *value = NULL;
+
+ /* -- delivery_tag (PyInt) */
+- value = PyLong_FROM_SSIZE_T((PY_SIZE_TYPE)delivery_tag);
++ value = PyLong_FromLongLong(delivery_tag);
+ PyDICT_SETSTR_DECREF(dest, "delivery_tag", value);
+
+ /* -- exchange (PyString) */
+@@ -1233,8 +1233,8 @@ PyRabbitMQ_recv(PyRabbitMQ_Connection *s
+ amqp_frame_t frame;
+ amqp_basic_deliver_t *deliver;
+ amqp_basic_properties_t *props;
+- size_t body_target;
+- size_t body_received;
++ PY_SIZE_TYPE body_target;
++ PY_SIZE_TYPE body_received;
+ PyObject *channel = NULL;
+ PyObject *consumer_tag = NULL;
+ PyObject *delivery_info = NULL;
+@@ -1288,7 +1288,7 @@ PyRabbitMQ_recv(PyRabbitMQ_Connection *s
+ }
+
+ /* channel */
+- channel = PyInt_FromLong((long)frame.channel);
++ channel = PyInt_FromLong((unsigned long)frame.channel);
+
+ /* properties */
+ props = (amqp_basic_properties_t *)frame.payload.properties.decoded;
+@@ -1576,7 +1576,7 @@ PyRabbitMQ_Connection_queue_declare(PyRa
+
+ if ((ret = PyTuple_New(3)) == NULL) goto bail;
+ PyTuple_SET_ITEM(ret, 0, PyString_FromStringAndSize(ok->queue.bytes,
+- ok->queue.len));
++ (PY_SIZE_TYPE)ok->queue.len));
+ PyTuple_SET_ITEM(ret, 1, PyInt_FromLong((long)ok->message_count));
+ PyTuple_SET_ITEM(ret, 2, PyInt_FromLong((long)ok->consumer_count));
+ return ret;
+@@ -1730,7 +1730,7 @@ PyRabbitMQ_Connection_basic_publish(PyRa
+ unsigned int immediate = 0;
+
+ char *body_buf = NULL;
+- int *body_size = 0;
++ PY_SIZE_TYPE body_size = 0;
+
+ int ret = 0;
+ amqp_basic_properties_t props;
+--- librabbitmq-1.6.1/Modules/_librabbitmq/connection.h.~1~ 2014-05-15 09:42:32.000000000 -0700
++++ librabbitmq-1.6.1/Modules/_librabbitmq/connection.h 2016-08-24 01:14:26.770655970 -0700
+@@ -1,6 +1,7 @@
+ #ifndef __PYLIBRABBIT_CONNECTION_H__
+ #define __PYLIBRABBIT_CONNECTION_H__
+
++#define PY_SSIZE_T_CLEAN
+ #include <Python.h>
+ #include <structmember.h>
+
+@@ -11,7 +12,6 @@
+ # define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000 /* 2.6 and up */
+-# define PY_SSIZE_T_CLEAN
+ # define PY_SIZE_TYPE Py_ssize_t
+ # define PyLong_FROM_SSIZE_T PyLong_FromSsize_t
+ # define PyLong_AS_SSIZE_T PyLong_AsSsize_t
+@@ -69,7 +69,7 @@
+ } while(0)
+
+ #define PySTRING_FROM_AMQBYTES(member) \
+- PyString_FromStringAndSize(member.bytes, member.len); \
++ PyString_FromStringAndSize(member.bytes, (PY_SIZE_TYPE)member.len); \
+
+ #define AMQTable_TO_PYKEY(table, i) \
+ PySTRING_FROM_AMQBYTES(table->entries[i].key)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/librabbitmq/patches/librabbitmq-pr-75.patch Thu Aug 25 22:11:53 2016 -0700
@@ -0,0 +1,82 @@
+This upstream patch was part of the following pull request
+
+ https://github.com/celery/librabbitmq/pull/75
+
+commit 093bc0405298c1d7ee957c306bd37514ed002112
+Author: Michael Verrilli <[email protected]>
+Date: Sun Sep 6 21:34:22 2015 -0400
+
+ Fixing tests to match librabbitmq's Message class.
+
+ Message class' __init__(self, channel, properties, delivery_info={}, body='') does not match how it was used here. This caused most tests to fail due to a blank message being published (and then a following BAD FRAME error when trying to read it, which is very confusing at first).
+
+diff --git a/librabbitmq/tests/test_functional.py b/librabbitmq/tests/test_functional.py
+index 58c2ddf..2dc9bd6 100644
+--- a/librabbitmq/tests/test_functional.py
++++ b/librabbitmq/tests/test_functional.py
+@@ -19,7 +19,8 @@ class test_Channel(unittest.TestCase):
+
+ def test_send_message(self):
+ message = Message(
+- 'the quick brown fox jumps over the lazy dog',
++ channel=self.channel,
++ body='the quick brown fox jumps over the lazy dog',
+ properties=dict(content_type='application/json',
+ content_encoding='utf-8'))
+ self.channel.basic_publish(message, TEST_QUEUE, TEST_QUEUE)
+@@ -40,7 +41,8 @@ class test_Channel(unittest.TestCase):
+
+ def test_basic_get_ack(self):
+ message = Message(
+- 'the quick brown fox jumps over the lazy dog',
++ channel=self.channel,
++ body='the quick brown fox jumps over the lazy dog',
+ properties=dict(content_type='application/json',
+ content_encoding='utf-8'))
+ self.channel.basic_publish(message, TEST_QUEUE, TEST_QUEUE)
+@@ -65,9 +67,11 @@ class test_Channel(unittest.TestCase):
+ that we can fetch them with a timeout without needing to receive
+ any more messages."""
+
+- message = Message('the quick brown fox jumps over the lazy dog',
+- properties=dict(content_type='application/json',
+- content_encoding='utf-8'))
++ message = Message(
++ channel=self.channel,
++ body='the quick brown fox jumps over the lazy dog',
++ properties=dict(content_type='application/json',
++ content_encoding='utf-8'))
+
+ for i in xrange(100):
+ self.channel.basic_publish(message, TEST_QUEUE, TEST_QUEUE)
+@@ -87,9 +91,11 @@ class test_Channel(unittest.TestCase):
+ def test_timeout(self):
+ """Check that our ``drain_events`` call actually times out if
+ there are no messages."""
+- message = Message('the quick brown fox jumps over the lazy dog',
+- properties=dict(content_type='application/json',
+- content_encoding='utf-8'))
++ message = Message(
++ channel=self.channel,
++ body='the quick brown fox jumps over the lazy dog',
++ properties=dict(content_type='application/json',
++ content_encoding='utf-8'))
+
+ self.channel.basic_publish(message, TEST_QUEUE, TEST_QUEUE)
+
+@@ -152,9 +158,11 @@ class test_Delete(unittest.TestCase):
+ self.channel.queue_bind(self.TEST_QUEUE, self.TEST_QUEUE,
+ self.TEST_QUEUE)
+
+- message = Message('the quick brown fox jumps over the lazy dog',
+- properties=dict(content_type='application/json',
+- content_encoding='utf-8'))
++ message = Message(
++ channel=self.channel,
++ body='the quick brown fox jumps over the lazy dog',
++ properties=dict(content_type='application/json',
++ content_encoding='utf-8'))
+
+ self.channel.basic_publish(message, self.TEST_QUEUE, self.TEST_QUEUE)
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/librabbitmq/patches/librabbitmq-pr-76.patch Thu Aug 25 22:11:53 2016 -0700
@@ -0,0 +1,34 @@
+This upstream patch was part of the following pull request
+
+ https://github.com/celery/librabbitmq/pull/76
+
+commit 507678498bda405ac388b1e520d34c388a3e642d
+Author: Michael Verrilli <[email protected]>
+Date: Sun Sep 6 22:18:32 2015 -0400
+
+ Adding in message_count to the delivery_info. Fixes test case.
+
+ This is an expected return value for a test case so rather than remove the test case, I'm adding the expected functionality.
+
+--- librabbitmq-1.6.1/Modules/_librabbitmq/connection.c.~2~ 2016-08-24 01:53:24.951206505 -0700
++++ librabbitmq-1.6.1/Modules/_librabbitmq/connection.c 2016-08-24 01:53:24.975077805 -0700
+@@ -2104,6 +2104,7 @@ PyRabbitMQ_Connection_basic_get(PyRabbit
+ amqp_basic_get_ok_t *ok = NULL;
+ PyObject *p = NULL;
+ PyObject *delivery_info = NULL;
++ PyObject *message_count = NULL;
+
+ if (PyRabbitMQ_Not_Connected(self))
+ goto bail;
+@@ -2134,6 +2135,11 @@ PyRabbitMQ_Connection_basic_get(PyRabbit
+ ok->exchange,
+ ok->routing_key,
+ ok->redelivered);
++ /* add in the message_count */
++ message_count = PyLong_FromLong(ok->message_count);
++ PyDict_SetItemString(delivery_info, "message_count", message_count);
++ Py_XDECREF(message_count);
++
+ if (amqp_data_in_buffer(self->conn)) {
+ if (PyRabbitMQ_recv(self, p, self->conn, 1) < 0) {
+ if (!PyErr_Occurred())
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/librabbitmq/patches/studio.patch Thu Aug 25 22:11:53 2016 -0700
@@ -0,0 +1,180 @@
+Adjust definition of _PYRMQ_INLINE and _AMQP_INLINE to prevent
+E_REF_STATIC_EXTERN_INLINE warnings.
+
+Remove the testing and use of GCC-specific flags.
+
+Correct use of pointer arithmetic to prevent
+E_PTR_TO_VOID_IN_ARITHMETIC warnings.
+
+Don't regenerate amqp_framing.[ch] if the source hasn't changed.
+
+Finally, we inherit CFLAGS and LDFLAGS from the environment rather than
+using what Python was compiled with. In particular, Python 2.7 in
+Userland currently has some undesired settings such as including
+/usr/gnu/lib in the RUNPATH.
+
+--- librabbitmq-1.6.1/Modules/_librabbitmq/connection.h.~2~ 2016-08-25 14:50:58.820215166 -0700
++++ librabbitmq-1.6.1/Modules/_librabbitmq/connection.h 2016-08-25 14:50:58.885646596 -0700
+@@ -44,6 +44,8 @@
+ # define _PYRMQ_INLINE
+ # elif defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
+ # define _PYRMQ_INLINE extern __inline
++# elif defined(__SUNPRO_C)
++# define _PYRMQ_INLINE static __inline
+ # else
+ # define _PYRMQ_INLINE __inline
+ # endif
+@@ -146,7 +148,7 @@ typedef struct {
+ PyObject *weakreflist;
+ } PyRabbitMQ_Connection;
+
+-int
++_PYRMQ_INLINE int
+ PyDict_to_basic_properties(PyObject *, amqp_basic_properties_t *,
+ amqp_connection_state_t, amqp_pool_t *);
+
+--- librabbitmq-1.6.1/clib/configure.~1~ 2014-10-24 04:36:46.000000000 -0700
++++ librabbitmq-1.6.1/clib/configure 2016-08-25 14:50:58.890629993 -0700
+@@ -12432,79 +12432,6 @@ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+-_ax_cflags=$CFLAGS
+-CFLAGS="-fno-common $CFLAGS"
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts '-fno-common'" >&5
+-$as_echo_n "checking if compiler accepts '-fno-common'... " >&6; }
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-
+-int
+-main ()
+-{
+-
+- ;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-$as_echo "yes" >&6; }
+- CFLAGS=$_ax_cflags
+- case " $CFLAGS " in #(
+- *[\ \ ]-fno-common[\ \ ]*) :
+- ;; #(
+- *) :
+- CFLAGS="$CFLAGS -fno-common" ;; #(
+- *) :
+- ;;
+-esac
+-
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+- CFLAGS=$_ax_cflags
+-
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-
+-
+-_ax_cflags=$CFLAGS
+-CFLAGS="-fvisibility=hidden $CFLAGS"
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts '-fvisibility=hidden'" >&5
+-$as_echo_n "checking if compiler accepts '-fvisibility=hidden'... " >&6; }
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-
+-int
+-main ()
+-{
+-
+- ;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-$as_echo "yes" >&6; }
+- CFLAGS=$_ax_cflags
+- case " $CFLAGS " in #(
+- *[\ \ ]-fvisibility=hidden[\ \ ]*) :
+- ;; #(
+- *) :
+- CFLAGS="$CFLAGS -fvisibility=hidden" ;; #(
+- *) :
+- ;;
+-esac
+-
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+- CFLAGS=$_ax_cflags
+-
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-
+ _ax_ldflags=$LDFLAGS
+ LDFLAGS="-no-undefined $LDFLAGS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker accepts '-no-undefined'" >&5
+--- librabbitmq-1.6.1/clib/librabbitmq/amqp_private.h.~1~ 2014-10-24 04:36:40.000000000 -0700
++++ librabbitmq-1.6.1/clib/librabbitmq/amqp_private.h 2016-08-25 14:52:09.507960376 -0700
+@@ -57,6 +57,8 @@
+ # define _AMQP_INLINE static
+ # elif defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
+ # define _AMQP_INLINE extern __inline
++# elif defined(__SUNPRO_C)
++# define _AMQP_INLINE static __inline
+ # else
+ # define _AMQP_INLINE __inline
+ # endif
+--- librabbitmq-1.6.1/clib/librabbitmq/amqp_tcp_socket.c.~1~ 2014-10-24 04:36:40.000000000 -0700
++++ librabbitmq-1.6.1/clib/librabbitmq/amqp_tcp_socket.c 2016-08-25 14:50:58.892307461 -0700
+@@ -186,7 +186,7 @@ start:
+ bufferp = self->buffer;
+ for (i = 0; i < iovcnt; ++i) {
+ memcpy(bufferp, iov[i].iov_base, iov[i].iov_len);
+- bufferp += iov[i].iov_len;
++ bufferp = (void *)((uintptr_t)bufferp + iov[i].iov_len);
+ }
+
+ ret = amqp_tcp_socket_send_inner(self, self->buffer, bytes, 0);
+--- librabbitmq-1.6.1/setup.py.~1~ 2014-11-17 06:43:15.000000000 -0800
++++ librabbitmq-1.6.1/setup.py 2016-08-25 14:50:58.893190143 -0700
+@@ -2,6 +2,7 @@ import os
+ import platform
+ import sys
+ from setuptools import setup, find_packages
++from distutils.dep_util import newer
+
+ # --with-librabbitmq=<dir>: path to librabbitmq package if needed
+
+@@ -24,9 +25,16 @@ def codegen():
+ codegen = LRMQSRC('codegen.py')
+ spec = SPECPATH('amqp-rabbitmq-0.9.1.json')
+ sys.path.insert(0, SPECPATH())
++ hfile = LRMQSRC('amqp_framing.h')
++ cfile = LRMQSRC('amqp_framing.c')
++ # Don't regenerate the files if the spec file hasn't changed. This
++ # prevents a separate install phase from unnecessarily rebuilding the
++ # extension.
++ if not (newer(spec, hfile) or newer(spec, cfile)):
++ return
+ commands = [
+- (sys.executable, codegen, 'header', spec, LRMQSRC('amqp_framing.h')),
+- (sys.executable, codegen, 'body', spec, LRMQSRC('amqp_framing.c')),
++ (sys.executable, codegen, 'header', spec, hfile),
++ (sys.executable, codegen, 'body', spec, cfile),
+ ]
+ restore = senv(('PYTHONPATH', SPECPATH()), sep=':')
+ try:
+@@ -133,10 +141,7 @@ def create_builder():
+ vars[key] = vars[key].replace(
+ '-isysroot /Developer/SDKs/MacOSX10.6.sdk', '')
+ vars[key] = vars[key].replace('-Wall', '')
+- restore = senv(
+- ('CFLAGS', vars['c']),
+- ('LDFLAGS', vars['ld']),
+- )
++ restore = senv()
+ try:
+ os.chdir(LRMQDIST())
+ if not os.path.isfile('config.h'):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/librabbitmq/patches/unittest.patch Thu Aug 25 22:11:53 2016 -0700
@@ -0,0 +1,26 @@
+In-house patch to account for the lack of the unittest2 package, which
+isn't needed on Solaris as there are no longer any supported Python
+versions prior to 2.7.
+
+--- librabbitmq-1.6.1/funtests/config.py.~1~ 2014-01-22 12:00:13.000000000 -0800
++++ librabbitmq-1.6.1/funtests/config.py 2016-08-23 16:19:23.777341750 -0700
+@@ -7,7 +7,7 @@ BROKER_USER = os.environ.get('BROKER_USE
+ BROKER_PASSWORD = os.environ.get('BROKER_PASSWORD', 'guest')
+
+ from functools import partial
+-from unittest2 import TestCase
++from unittest import TestCase
+ from uuid import uuid4
+
+
+--- librabbitmq-1.6.1/librabbitmq/tests/test_functional.py.~1~ 2014-11-17 06:31:29.000000000 -0800
++++ librabbitmq-1.6.1/librabbitmq/tests/test_functional.py 2016-08-23 16:20:21.437166565 -0700
+@@ -2,7 +2,7 @@ from __future__ import absolute_import
+ from __future__ import with_statement
+
+ import socket
+-import unittest2 as unittest
++import unittest
+
+ from librabbitmq import Message, Connection, ConnectionError, ChannelError
+ TEST_QUEUE = 'pyrabbit.testq'