From e2dd3d55a95ec6b0b63ce9b56bc95f4ea1229ff3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 13 Nov 2020 09:02:51 +0100 Subject: update to 4.1.0 drop patches merged upstream add patch to fix build with PHP 8 from https://github.com/SkyAPM/SkyAPM-php-sdk/pull/294 --- 274.patch | 30 ------------- 275.patch | 38 ----------------- 276.patch | 61 -------------------------- 294.patch | 109 +++++++++++++++++++++++++++++++++++++++++++++++ PHPINFO | 2 + REFLECTION | 11 ++++- php-pecl-skywalking.spec | 25 ++++++----- 7 files changed, 136 insertions(+), 140 deletions(-) delete mode 100644 274.patch delete mode 100644 275.patch delete mode 100644 276.patch create mode 100644 294.patch diff --git a/274.patch b/274.patch deleted file mode 100644 index 80f2d64..0000000 --- a/274.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 16ed1a4d463014d93b1ddfb432323d00a4ba17a6 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 15 Oct 2020 10:58:51 +0200 -Subject: [PATCH] use cxx for link, and drop uneeded libstdc++ - ---- - config.m4 | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/config.m4 b/config.m4 -index adb7f77..f110c4d 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -78,7 +78,6 @@ if test "$PHP_SKYWALKING" != "no"; then - PHP_ADD_LIBRARY(c++,1,SKYWALKING_SHARED_LIBADD) - ;; - *) -- PHP_ADD_LIBRARY(stdc++,1,SKYWALKING_SHARED_LIBADD) - PHP_ADD_LIBRARY(rt,,SKYWALKING_SHARED_LIBADD) - PHP_ADD_LIBRARY(rt) - ;; -@@ -152,7 +151,7 @@ if test "$PHP_SKYWALKING" != "no"; then - src/network/v3/language-agent/Tracing_grpc.pb.cc \ - src/network/v3/management/Management_grpc.pb.cc \ - src/network/v3/management/Management.pb.cc \ -- , $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) -+ , $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, cxx) - fi - - if test -r $phpincludedir/ext/mysqli/mysqli_mysqlnd.h; then diff --git a/275.patch b/275.patch deleted file mode 100644 index 37958a8..0000000 --- a/275.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 31c23f5f4109e795aa502c3a133a2dba7e1740c1 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 15 Oct 2020 11:32:14 +0200 -Subject: [PATCH] ensure used commands are available at configure time - ---- - config.m4 | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - -diff --git a/config.m4 b/config.m4 -index f110c4d..559c160 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -110,11 +110,20 @@ if test "$PHP_SKYWALKING" != "no"; then - -L$GRPC_LIBDIR - ]) - -+ AC_PATH_PROG(PROTOC, protoc, no) -+ if ! test -x "$PROTOC"; then -+ AC_MSG_ERROR([protoc command missing, please reinstall the protobuf distribution]) -+ fi -+ AC_PATH_PROG(GRPC_CPP_PLUGIN, grpc_cpp_plugin, no) -+ if ! test -x "$GRPC_CPP_PLUGIN"; then -+ AC_MSG_ERROR([grpc_cpp_plugin command missing, please reinstall the grpc distribution]) -+ fi -+ - mkdir -p src/network/v3 -- protoc -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --cpp_out=src/network/v3 src/protocol/v3/common/Common.proto -- protoc -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --cpp_out=src/network/v3 src/protocol/v3/language-agent/*.proto -- protoc -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --cpp_out=src/network/v3 src/protocol/v3/profile/*.proto -- protoc -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --cpp_out=src/network/v3 src/protocol/v3/management/*.proto -+ $PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/common/Common.proto -+ $PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/language-agent/*.proto -+ $PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/profile/*.proto -+ $PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/management/*.proto - find src -name "*.grpc.pb.cc" | while read id; do mv $id ${id/.grpc/_grpc}; done - - PROTOBUF_LIBDIR=$PROTOBUF_DIR/${PROTOBUF_LIB_SUBDIR-lib} diff --git a/276.patch b/276.patch deleted file mode 100644 index 4eb0c88..0000000 --- a/276.patch +++ /dev/null @@ -1,61 +0,0 @@ -From ac1b5c26136dac3f0ce81d3e4ee229340b32fe95 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 15 Oct 2020 12:01:37 +0200 -Subject: [PATCH] fix build with PHP 8.0.0RC2 - ---- - src/sky_predis.cc | 9 ++++++++- - src/sky_utils.cc | 6 +++++- - 2 files changed, 13 insertions(+), 2 deletions(-) - -diff --git a/src/sky_predis.cc b/src/sky_predis.cc -index 0e93241..eb3ddd2 100644 ---- a/src/sky_predis.cc -+++ b/src/sky_predis.cc -@@ -32,9 +32,16 @@ Span *sky_predis(zend_execute_data *execute_data, char *class_name, char *functi - - zval *id = (zval *) emalloc(sizeof(zval)); - zval *arguments = (zval *) emalloc(sizeof(zval)); -+#if PHP_VERSION_ID < 80000 - zend_call_method(command, Z_OBJCE_P(command), nullptr, ZEND_STRL("getid"), id, 0, nullptr, nullptr); - zend_call_method(command, Z_OBJCE_P(command), nullptr, ZEND_STRL("getarguments"), arguments, 0, nullptr, - nullptr); -+#else -+ zend_call_method(Z_OBJ_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("getid"), id, 0, nullptr, -+ nullptr); -+ zend_call_method(Z_OBJ_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("getarguments"), arguments, -+ 0, nullptr, nullptr); -+#endif - - if (id != nullptr && Z_TYPE_P(id) == IS_STRING) { - span->setOperationName(_class_name + "->" + std::string(Z_STRVAL_P(id))); -@@ -118,4 +125,4 @@ static std::string sky_predis_command(zval *id, zval *arguments) { - } - - return nullptr; --} -\ No newline at end of file -+} -diff --git a/src/sky_utils.cc b/src/sky_utils.cc -index 61c5089..d9053e4 100644 ---- a/src/sky_utils.cc -+++ b/src/sky_utils.cc -@@ -86,7 +86,11 @@ zval *sky_read_property(zval *obj, const char *property, int parent) { - ce = object->ce->parent; - } - -+#if PHP_VERSION_ID < 80000 - return zend_read_property(ce, obj, property, strlen(property), 0, nullptr); -+#else -+ return zend_read_property(ce, object, property, strlen(property), 0, nullptr); -+#endif - } - return nullptr; - } -@@ -97,4 +101,4 @@ std::string sky_get_class_name(zval *obj) { - return ZSTR_VAL(object->ce->name); - } - return ""; --} -\ No newline at end of file -+} diff --git a/294.patch b/294.patch new file mode 100644 index 0000000..ba47917 --- /dev/null +++ b/294.patch @@ -0,0 +1,109 @@ +From 4f50ecec5a1cfda6689c41fd0691526cf74cdde7 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 13 Nov 2020 08:49:03 +0100 +Subject: [PATCH] fix for PHP 8 + +--- + skywalking.cc | 7 +++++-- + src/sky_plugin_hyperf_guzzle.cc | 16 ++++++++++++++-- + src/sky_plugin_redis.cc | 8 ++++---- + 3 files changed, 23 insertions(+), 8 deletions(-) + +diff --git a/skywalking.cc b/skywalking.cc +index 31eda51..e27808f 100644 +--- a/skywalking.cc ++++ b/skywalking.cc +@@ -190,8 +190,11 @@ zend_module_dep skywalking_deps[] = { + ZEND_MOD_END + }; + ++ZEND_BEGIN_ARG_INFO_EX(arginfo_skywalking_trace_id, 0, 0, 0) ++ZEND_END_ARG_INFO() ++ + const zend_function_entry skywalking_functions[] = { +- PHP_FE (skywalking_trace_id, NULL) ++ PHP_FE (skywalking_trace_id, arginfo_skywalking_trace_id) + PHP_FE_END + }; + +@@ -215,4 +218,4 @@ zend_module_entry skywalking_module_entry = { + ZEND_TSRMLS_CACHE_DEFINE() + #endif + ZEND_GET_MODULE(skywalking) +-#endif +\ No newline at end of file ++#endif +diff --git a/src/sky_plugin_hyperf_guzzle.cc b/src/sky_plugin_hyperf_guzzle.cc +index ad851e0..68ded0a 100644 +--- a/src/sky_plugin_hyperf_guzzle.cc ++++ b/src/sky_plugin_hyperf_guzzle.cc +@@ -29,18 +29,30 @@ Span *sky_plugin_hyperf_guzzle(zend_execute_data *execute_data, const std::strin + if (arg_count >= 1) { + zval *request = ZEND_CALL_ARG(execute_data, 1); + zval uri; ++#if PHP_VERSION_ID < 80000 + zend_call_method(request, Z_OBJCE_P(request), nullptr, ZEND_STRL("geturi"), &uri, 0, nullptr, nullptr); ++#else ++ zend_call_method(Z_OBJ_P(request), Z_OBJCE_P(request), nullptr, ZEND_STRL("geturi"), &uri, 0, nullptr, nullptr); ++#endif + + if (!Z_ISUNDEF(uri)) { + zval scheme, host, port, path, query, to_string; + int _port = 80; ++#if PHP_VERSION_ID < 80000 + zend_call_method(&uri, Z_OBJCE_P(&uri), nullptr, ZEND_STRL("getscheme"), &scheme, 0, nullptr, nullptr); + zend_call_method(&uri, Z_OBJCE_P(&uri), nullptr, ZEND_STRL("gethost"), &host, 0, nullptr, nullptr); + zend_call_method(&uri, Z_OBJCE_P(&uri), nullptr, ZEND_STRL("getport"), &port, 0, nullptr, nullptr); + zend_call_method(&uri, Z_OBJCE_P(&uri), nullptr, ZEND_STRL("getpath"), &path, 0, nullptr, nullptr); + zend_call_method(&uri, Z_OBJCE_P(&uri), nullptr, ZEND_STRL("getquery"), &query, 0, nullptr, nullptr); + zend_call_method(&uri, Z_OBJCE_P(&uri), nullptr, ZEND_STRL("__tostring"), &to_string, 0, nullptr, nullptr); +- ++#else ++ zend_call_method(Z_OBJ(uri), Z_OBJCE(uri), nullptr, ZEND_STRL("getscheme"), &scheme, 0, nullptr, nullptr); ++ zend_call_method(Z_OBJ(uri), Z_OBJCE(uri), nullptr, ZEND_STRL("gethost"), &host, 0, nullptr, nullptr); ++ zend_call_method(Z_OBJ(uri), Z_OBJCE(uri), nullptr, ZEND_STRL("getport"), &port, 0, nullptr, nullptr); ++ zend_call_method(Z_OBJ(uri), Z_OBJCE(uri), nullptr, ZEND_STRL("getpath"), &path, 0, nullptr, nullptr); ++ zend_call_method(Z_OBJ(uri), Z_OBJCE(uri), nullptr, ZEND_STRL("getquery"), &query, 0, nullptr, nullptr); ++ zend_call_method(Z_OBJ(uri), Z_OBJCE(uri), nullptr, ZEND_STRL("__tostring"), &to_string, 0, nullptr, nullptr); ++#endif + if (!Z_ISUNDEF(scheme) && Z_TYPE(scheme) == IS_STRING) { + + if (strcmp(Z_STRVAL(scheme), "http") == 0 || strcmp(Z_STRVAL(scheme), "https") == 0) { +@@ -74,4 +86,4 @@ Span *sky_plugin_hyperf_guzzle(zend_execute_data *execute_data, const std::strin + } + + return nullptr; +-} +\ No newline at end of file ++} +diff --git a/src/sky_plugin_redis.cc b/src/sky_plugin_redis.cc +index 450e5d7..003b517 100644 +--- a/src/sky_plugin_redis.cc ++++ b/src/sky_plugin_redis.cc +@@ -80,8 +80,8 @@ std::string sky_plugin_redis_peer(zend_execute_data *execute_data) { + zend_call_method(command, Z_OBJCE_P(command), nullptr, ZEND_STRL("gethost"), &host, 0, nullptr, nullptr); + zend_call_method(command, Z_OBJCE_P(command), nullptr, ZEND_STRL("getport"), &port, 0, nullptr, nullptr); + #else +- zend_call_method(Z_OBJCE_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("gethost"), &host, 0, nullptr, nullptr); +- zend_call_method(Z_OBJCE_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("getport"), &port, 0, nullptr, nullptr); ++ zend_call_method(Z_OBJ_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("gethost"), &host, 0, nullptr, nullptr); ++ zend_call_method(Z_OBJ_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("getport"), &port, 0, nullptr, nullptr); + #endif + + if (!Z_ISUNDEF(host) && !Z_ISUNDEF(port) && Z_TYPE(host) == IS_STRING) { +@@ -136,7 +136,7 @@ std::string sky_plugin_redis_bit_count_cmd(zend_execute_data *execute_data, std: + uint32_t arg_count = ZEND_CALL_NUM_ARGS(execute_data); + + if (arg_count >= 1) { +- for (int i = 1; i <= 3; ++i) { ++ for (uint32_t i = 1; i <= 3; ++i) { + if (i <= arg_count) { + zval *value = ZEND_CALL_ARG(execute_data, i); + if (Z_TYPE_P(value) == IS_LONG) { +@@ -154,4 +154,4 @@ std::string sky_plugin_redis_bit_count_cmd(zend_execute_data *execute_data, std: + return cmd; + } + return ""; +-} +\ No newline at end of file ++} diff --git a/PHPINFO b/PHPINFO index a5ec400..9cb9dd0 100644 --- a/PHPINFO +++ b/PHPINFO @@ -11,3 +11,5 @@ skywalking.grpc_tls_enable => 0 => 0 skywalking.grpc_tls_pem_root_certs => no value => no value skywalking.grpc_tls_pem_private_key => no value => no value skywalking.grpc_tls_pem_cert_chain => no value => no value +skywalking.log_enable => 0 => 0 +skywalking.log_path => /tmp/skywalking-php.log => /tmp/skywalking-php.log diff --git a/REFLECTION b/REFLECTION index fbec808..e5b6381 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #116 skywalking version 4.0.0 ] { +Extension [ extension #117 skywalking version 4.1.0 ] { - Dependencies { Dependency [ json (Required) ] @@ -35,10 +35,19 @@ Extension [ extension #116 skywalking version 4.0.0 ] { Entry [ skywalking.grpc_tls_pem_cert_chain ] Current = '' } + Entry [ skywalking.log_enable ] + Current = '0' + } + Entry [ skywalking.log_path ] + Current = '/tmp/skywalking-php.log' + } } - Functions { Function [ function skywalking_trace_id ] { + + - Parameters [0] { + } } } } diff --git a/php-pecl-skywalking.spec b/php-pecl-skywalking.spec index 7d263da..03e2a66 100644 --- a/php-pecl-skywalking.spec +++ b/php-pecl-skywalking.spec @@ -16,19 +16,17 @@ %global with_zts 0 %global ini_name 40-%{pecl_name}.ini # TODO need investigation -%global with_tests 0%{?_with_tests:1} +%bcond_with tests Summary: The PHP instrument agent for Apache SkyWalking Name: %{?sub_prefix}php-pecl-%{pecl_name} -Version: 4.0.0 -Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Version: 4.1.0 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz License: ASL 2.0 URL: https://pecl.php.net/package/%{pecl_name} -Patch0: https://patch-diff.githubusercontent.com/raw/SkyAPM/SkyAPM-php-sdk/pull/274.patch -Patch1: https://patch-diff.githubusercontent.com/raw/SkyAPM/SkyAPM-php-sdk/pull/275.patch -Patch2: https://patch-diff.githubusercontent.com/raw/SkyAPM/SkyAPM-php-sdk/pull/276.patch +Patch0: https://patch-diff.githubusercontent.com/raw/SkyAPM/SkyAPM-php-sdk/pull/294.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel > 7.0 @@ -96,9 +94,7 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml pushd NTS -%patch0 -p1 -b .pr274 -%patch1 -p1 -b .pr275 -%patch2 -p1 -b .pr276 +%patch0 -p1 -b .pr294 : Check version extver=$(sed -n '/#define PHP_SKYWALKING_VERSION /{s/.* "//;s/".*$//;p}' php_skywalking.h) @@ -128,6 +124,8 @@ extension=%{pecl_name}.so ;skywalking.grpc_tls_pem_root_certs = '' ;skywalking.grpc_tls_pem_private_key = '' ;skywalking.grpc_tls_pem_cert_chain = '' +;skywalking.log_enable = 0 +;skywalking.log_path = '/tmp/skywalking-php.log'; EOF @@ -211,7 +209,7 @@ OPT="-n -d extension=curl.so -d extension=json.so" --modules | grep %{pecl_name} %endif -%if %{with_tests} +%if %{with tests} : Upstream test suite for NTS extension cd NTS TEST_PHP_ARGS="$OPT -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ @@ -245,8 +243,15 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \ %{php_ztsextdir}/%{pecl_name}.so %endif +# TODO : missing grpc in EPEL %changelog +* Fri Nov 13 2020 Remi Collet - 4.1.0-1 +- update to 4.1.0 +- drop patches merged upstream +- add patch to fix build with PHP 8 from + https://github.com/SkyAPM/SkyAPM-php-sdk/pull/294 + * Thu Oct 15 2020 Remi Collet - 4.0.0-2 - add patch to properly check available command from https://github.com/SkyAPM/SkyAPM-php-sdk/pull/275 -- cgit