Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jun 2020 16:07:22 +0000 (UTC)
From:      Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r539825 - in head/devel/pecl-zookeeper: . files
Message-ID:  <202006221607.05MG7MB0037980@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sunpoet
Date: Mon Jun 22 16:07:21 2020
New Revision: 539825
URL: https://svnweb.freebsd.org/changeset/ports/539825

Log:
  Fix build with libzookeeper 3.6.0+ (r538532)
  
  ZOO_MAJOR_VERSION, ZOO_MINOR_VERSION and ZOO_PATCH_VERSION have been replaced by ZOO_VERSION.
  
  Reference:	https://github.com/apache/zookeeper/commit/253673f30431344030509b974bd2f65d23c1cd6e

Added:
  head/devel/pecl-zookeeper/files/
  head/devel/pecl-zookeeper/files/patch-php_zookeeper.c   (contents, props changed)
  head/devel/pecl-zookeeper/files/patch-php_zookeeper_log.c   (contents, props changed)
  head/devel/pecl-zookeeper/files/patch-zoo_lock.c   (contents, props changed)
Modified:
  head/devel/pecl-zookeeper/Makefile

Modified: head/devel/pecl-zookeeper/Makefile
==============================================================================
--- head/devel/pecl-zookeeper/Makefile	Mon Jun 22 16:07:16 2020	(r539824)
+++ head/devel/pecl-zookeeper/Makefile	Mon Jun 22 16:07:21 2020	(r539825)
@@ -11,6 +11,7 @@ COMMENT=	PHP extension for interfacing with Apache Zoo
 LICENSE=	PHP301
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
+BUILD_DEPENDS=	libzookeeper>=3.5.0:devel/libzookeeper
 LIB_DEPENDS=	libzookeeper_mt.so:devel/libzookeeper
 
 USES=		php:pecl

Added: head/devel/pecl-zookeeper/files/patch-php_zookeeper.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/pecl-zookeeper/files/patch-php_zookeeper.c	Mon Jun 22 16:07:21 2020	(r539825)
@@ -0,0 +1,72 @@
+--- php_zookeeper.c.orig	2019-12-11 01:31:04 UTC
++++ php_zookeeper.c
+@@ -772,7 +772,6 @@ static PHP_METHOD(Zookeeper, dispatch)
+ }
+ /* }}} */
+ 
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+ /* {{{ Zookeeper::getConfig( .. )
+    */
+ static PHP_METHOD(Zookeeper, getConfig)
+@@ -788,7 +787,6 @@ static PHP_METHOD(Zookeeper, getConfig)
+ 	RETURN_OBJ(php_zk_config_new_from_zk(php_zk_config_ce, i_obj));
+ }
+ /* }}} */
+-#endif
+ 
+ PHP_FUNCTION(zookeeper_dispatch)
+ {
+@@ -1250,10 +1248,8 @@ ZEND_END_ARG_INFO()
+ ZEND_BEGIN_ARG_INFO(arginfo_dispatch, 0)
+ ZEND_END_ARG_INFO()
+ 
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+ ZEND_BEGIN_ARG_INFO(arginfo_getConfig, 0)
+ ZEND_END_ARG_INFO()
+-#endif
+ /* }}} */
+ 
+ /* {{{ zookeeper_class_methods */
+@@ -1290,9 +1286,7 @@ static zend_function_entry zookeeper_class_methods[] =
+ 
+ 	ZK_ME_STATIC(dispatch,    arginfo_dispatch)
+ 
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+ 	ZK_ME(getConfig,          arginfo_getConfig)
+-#endif
+ 
+ 	PHP_FE_END
+ };
+@@ -1381,10 +1375,8 @@ static void php_zk_register_constants(INIT_FUNC_ARGS)
+ 	ZK_CLASS_CONST_LONG2(OPERATIONTIMEOUT);
+ 	ZK_CLASS_CONST_LONG2(BADARGUMENTS);
+ 	ZK_CLASS_CONST_LONG2(INVALIDSTATE);
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+ 	ZK_CLASS_CONST_LONG2(NEWCONFIGNOQUORUM);
+ 	ZK_CLASS_CONST_LONG2(RECONFIGINPROGRESS);
+-#endif
+ 
+ 	ZK_CLASS_CONST_LONG2(OK);
+ 	ZK_CLASS_CONST_LONG2(APIERROR);
+@@ -1463,9 +1455,7 @@ PHP_MINIT_FUNCTION(zookeeper)
+ 
+ 	php_zk_register_exceptions(TSRMLS_C);
+ 
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+ 	php_zk_config_register(TSRMLS_C);
+-#endif
+ 
+ #if PHP_MAJOR_VERSION >= 7 && PHP_MINOR_VERSION >= 1
+ 	orig_interrupt_function = zend_interrupt_function;
+@@ -1537,7 +1527,11 @@ PHP_MINFO_FUNCTION(zookeeper)
+ 	php_info_print_table_header(2, "zookeeper support", "enabled");
+ 	php_info_print_table_row(2, "version", PHP_ZOOKEEPER_VERSION);
+ 
++#if defined(ZOO_VERSION)
++	snprintf(buf, sizeof(buf), "%s", ZOO_VERSION);
++#else
+ 	snprintf(buf, sizeof(buf), "%ld.%ld.%ld", ZOO_MAJOR_VERSION, ZOO_MINOR_VERSION, ZOO_PATCH_VERSION);
++#endif
+ 	php_info_print_table_row(2, "libzookeeper version", buf);
+ 
+ 	php_info_print_table_end();

Added: head/devel/pecl-zookeeper/files/patch-php_zookeeper_log.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/pecl-zookeeper/files/patch-php_zookeeper_log.c	Mon Jun 22 16:07:21 2020	(r539825)
@@ -0,0 +1,20 @@
+--- php_zookeeper_log.c.orig	2019-12-11 01:31:04 UTC
++++ php_zookeeper_log.c
+@@ -19,17 +19,10 @@
+ #include <zookeeper_log.h> /* Symbol LOG_INFO defined in this file conflicts with the symbol defined in syslog.h */
+ #include "php_zookeeper_log.h"
+ 
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+ #define PHP_ZK_LOG_ERROR(_zh, ...) LOG_ERROR(LOGCALLBACK(_zh), __VA_ARGS__)
+ #define PHP_ZK_LOG_WARN(_zh, ...) LOG_WARN(LOGCALLBACK(_zh), __VA_ARGS__)
+ #define PHP_ZK_LOG_INFO(_zh, ...) LOG_INFO(LOGCALLBACK(_zh), __VA_ARGS__)
+ #define PHP_ZK_LOG_DEBUG(_zh, ...) LOG_DEBUG(LOGCALLBACK(_zh), __VA_ARGS__)
+-#else
+-#define PHP_ZK_LOG_ERROR(_zh, ...) LOG_ERROR((__VA_ARGS__))
+-#define PHP_ZK_LOG_WARN(_zh, ...) LOG_WARN((__VA_ARGS__))
+-#define PHP_ZK_LOG_INFO(_zh, ...) LOG_INFO((__VA_ARGS__))
+-#define PHP_ZK_LOG_DEBUG(_zh, ...) LOG_DEBUG((__VA_ARGS__))
+-#endif
+ 
+ #define PHP_ZK_LOG_FUNC(func, FUNC) \
+ 	void php_zk_log_##func(zhandle_t *zh, ...)	\

Added: head/devel/pecl-zookeeper/files/patch-zoo_lock.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/pecl-zookeeper/files/patch-zoo_lock.c	Mon Jun 22 16:07:21 2020	(r539825)
@@ -0,0 +1,98 @@
+--- zoo_lock.c.orig	2019-12-11 01:31:04 UTC
++++ zoo_lock.c
+@@ -97,11 +97,7 @@ ZOOAPI int zkr_lock_unlock(zkr_lock_mutex_t *mutex) {
+         while (ret == ZCONNECTIONLOSS && (count < 3)) {
+             ret = zoo_delete(zh, buf, -1);
+             if (ret == ZCONNECTIONLOSS) {
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+                 LOG_DEBUG(LOGCALLBACK(zh), ("connectionloss while deleting the node"));
+-#else
+-                LOG_DEBUG(("connectionloss while deleting the node"));
+-#endif
+                 nanosleep(&ts, 0);
+                 count++;
+             }
+@@ -117,11 +113,7 @@ ZOOAPI int zkr_lock_unlock(zkr_lock_mutex_t *mutex) {
+             pthread_mutex_unlock(&(mutex->pmutex));
+             return 0;
+         }
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+         LOG_WARN(LOGCALLBACK(zh), ("not able to connect to server - giving up"));
+-#else
+-        LOG_WARN(("not able to connect to server - giving up"));
+-#endif
+         pthread_mutex_unlock(&(mutex->pmutex));
+         return ZCONNECTIONLOSS;
+     }
+@@ -188,11 +180,7 @@ static int retry_getchildren(zhandle_t *zh, char* path
+     while (ret == ZCONNECTIONLOSS && count < retry) {
+         ret = zoo_get_children(zh, path, 0, vector);
+         if (ret == ZCONNECTIONLOSS) {
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+             LOG_DEBUG(LOGCALLBACK(zh), ("connection loss to the server"));
+-#else
+-            LOG_DEBUG(("connection loss to the server"));
+-#endif
+             nanosleep(ts, 0);
+             count++;
+         }
+@@ -228,11 +216,7 @@ static int retry_zoowexists(zhandle_t *zh, char* path,
+     while (ret == ZCONNECTIONLOSS && count < retry) {
+         ret = zoo_wexists(zh, path, watcher, ctx, stat);
+         if (ret == ZCONNECTIONLOSS) {
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+             LOG_DEBUG(LOGCALLBACK(zh), ("connectionloss while setting watch on my predecessor"));
+-#else
+-            LOG_DEBUG(("connectionloss while setting watch on my predecessor"));
+-#endif
+             nanosleep(ts, 0);
+             count++;
+         }
+@@ -287,11 +271,7 @@ static int zkr_lock_operation(zkr_lock_mutex_t *mutex,
+             // do not want to retry the create since
+             // we would end up creating more than one child
+             if (ret != ZOK) {
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+                 LOG_WARN(LOGCALLBACK(zh), ("could not create zoo node %s", buf));
+-#else
+-                LOG_WARN(("could not create zoo node %s", buf));
+-#endif
+                 return ret;
+             }
+             mutex->id = getName(retbuf);
+@@ -301,11 +281,7 @@ static int zkr_lock_operation(zkr_lock_mutex_t *mutex,
+             ret = ZCONNECTIONLOSS;
+             ret = retry_getchildren(zh, path, vector, ts, retry);
+             if (ret != ZOK) {
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+                 LOG_WARN(LOGCALLBACK(zh), ("could not connect to server"));
+-#else
+-                LOG_WARN(("could not connect to server"));
+-#endif
+                 return ret;
+             }
+             //sort this list
+@@ -327,11 +303,7 @@ static int zkr_lock_operation(zkr_lock_mutex_t *mutex,
+                 // will keep waiting
+                 if (ret != ZOK) {
+                     free_String_vector(vector);
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+                     LOG_WARN(LOGCALLBACK(zh), ("unable to watch my predecessor"));
+-#else
+-                    LOG_WARN(("unable to watch my predecessor"));
+-#endif
+                     ret = zkr_lock_unlock(mutex);
+                     while (ret == 0) {
+                         //we have to give up our leadership
+@@ -347,11 +319,7 @@ static int zkr_lock_operation(zkr_lock_mutex_t *mutex,
+                 // this is the case when we are the owner
+                 // of the lock
+                 if (strcmp(mutex->id, owner_id) == 0) {
+-#if ZOO_MAJOR_VERSION>=3 && ZOO_MINOR_VERSION>=5
+                     LOG_DEBUG(LOGCALLBACK(zh), ("got the zoo lock owner - %s", mutex->id));
+-#else
+-                    LOG_DEBUG(("got the zoo lock owner - %s", mutex->id));
+-#endif
+                     mutex->isOwner = 1;
+                     if (mutex->completion != NULL) {
+                         mutex->completion(0, mutex->cbdata);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006221607.05MG7MB0037980>