From 7e1495e5b9124861a848906a53cf7114a0b69f83 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 26 Aug 2020 09:03:27 +0200 Subject: update to 0.48.0 drop patch merged upstream install PHP library raise dependency on PHP 5.6 --- 952.patch | 30 ----- PHPINFO | 8 +- REFLECTION | 26 ++++- engine_api.c | 39 ------- engine_api.h | 17 --- handlers_curl.c | 269 -------------------------------------------- php-pecl-datadog-trace.spec | 37 +++--- 7 files changed, 44 insertions(+), 382 deletions(-) delete mode 100644 952.patch delete mode 100644 engine_api.c delete mode 100644 engine_api.h delete mode 100644 handlers_curl.c diff --git a/952.patch b/952.patch deleted file mode 100644 index 24e141d..0000000 --- a/952.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 7720c13ed242e87ce1e934f80378a6f145ebd769 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 9 Jul 2020 07:50:18 +0200 -Subject: [PATCH 1/2] improve CGI usage - ---- - tests/ext/startup_logging.inc | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/tests/ext/startup_logging.inc b/tests/ext/startup_logging.inc -index 17235e11e..869e65da5 100644 ---- a/tests/ext/startup_logging.inc -+++ b/tests/ext/startup_logging.inc -@@ -2,8 +2,12 @@ - - function dd_get_php_cgi() - { -- $executable = dirname(getenv('TEST_PHP_EXECUTABLE')) . '/php-cgi'; -- return file_exists($executable) && is_executable($executable) ? $executable : ''; -+ $executable = getenv('TEST_PHP_CGI_EXECUTABLE') ?: getenv('TEST_PHP_EXECUTABLE') . '-cgi'; -+ if (file_exists($executable) && is_executable($executable)) { -+ $args = getenv('TEST_PHP_ARGS'); -+ return $args ? "$executable $args" : "$executable"; -+ } -+ return ''; - } - - function dd_get_startup_logs(array $args = [], array $env = []) - - diff --git a/PHPINFO b/PHPINFO index 715643a..fdd33d2 100644 --- a/PHPINFO +++ b/PHPINFO @@ -7,15 +7,13 @@ For help, check out the documentation at https://docs.datadoghq.com/tracing/lang (c) Datadog 2020 Datadog tracing support => enabled -Version => 0.47.1 -DATADOG TRACER CONFIGURATION => {"date":"2020-08-02T05:10:02Z","os_name":"Linux builder.remirepo.net 5.7.9-100.fc31.x86_64 #1 SMP Fri Jul 17 17:18:38 UTC 2020 x86_64","os_version":"5.7.9-100.fc31.x86_64","version":"0.47.1","lang":"php","lang_version":"7.3.20","env":null,"enabled":true,"service":null,"enabled_cli":false,"agent_url":"http://localhost:8126","debug":false,"analytics_enabled":false,"sample_rate":1.000000,"sampling_rules":null,"tags":null,"service_mapping":null,"distributed_tracing_enabled":true,"priority_sampling_enabled":true,"dd_version":null,"architecture":"x86_64","sapi":"cli","ddtrace.request_init_hook":null,"open_basedir_configured":false,"uri_fragment_regex":null,"uri_mapping_incoming":null,"uri_mapping_outgoing":null,"auto_flush_enabled":false,"generate_root_span":true,"http_client_split_by_domain":false,"measure_compile_time":true,"report_hostname_on_root_span":false,"traced_internal_functions":null,"auto_prepend_file_configured":false,"integrations_disabled":null,"enabled_from_env":true,"opcache.file_cache":null,"agent_error":"Failed to connect to localhost port 8126: Connection refused","ddtrace.request_init_hook_reachable":false} +Version => 0.48.0 +DATADOG TRACER CONFIGURATION => {"date":"2020-08-26T06:49:36Z","os_name":"Linux builder.remirepo.net 5.7.15-100.fc31.x86_64 #1 SMP Tue Aug 11 17:18:01 UTC 2020 x86_64","os_version":"5.7.15-100.fc31.x86_64","version":"0.48.0","lang":"php","lang_version":"7.3.21","env":null,"enabled":true,"service":null,"enabled_cli":false,"agent_url":"http://localhost:8126","debug":false,"analytics_enabled":false,"sample_rate":1.000000,"sampling_rules":null,"tags":null,"service_mapping":null,"distributed_tracing_enabled":true,"priority_sampling_enabled":true,"dd_version":null,"architecture":"x86_64","sapi":"cli","ddtrace.request_init_hook":"/usr/share/pear/datadog_trace/bridge/dd_wrap_autoloader.php","open_basedir_configured":false,"uri_fragment_regex":null,"uri_mapping_incoming":null,"uri_mapping_outgoing":null,"auto_flush_enabled":false,"generate_root_span":true,"http_client_split_by_domain":false,"measure_compile_time":true,"report_hostname_on_root_span":false,"traced_internal_functions":null,"auto_prepend_file_configured":false,"integrations_disabled":null,"enabled_from_env":true,"opcache.file_cache":null,"agent_error":"Failed to connect to localhost port 8126: Connection refused"} Diagnostics agent_error => Failed to connect to localhost port 8126: Connection refused -ddtrace.request_init_hook_reachable => false Diagnostic checks => failed Directive => Local Value => Master Value ddtrace.disable => Off => Off -ddtrace.request_init_hook => no value => no value -ddtrace.strict_mode => Off => Off +ddtrace.request_init_hook => /usr/share/pear/datadog_trace/bridge/dd_wrap_autoloader.php => /usr/share/pear/datadog_trace/bridge/dd_wrap_autoloader.php diff --git a/REFLECTION b/REFLECTION index 3d583d0..9c019ee 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,19 +1,16 @@ -Extension [ extension #116 ddtrace version 0.47.1 ] { +Extension [ extension #116 ddtrace version 0.48.0 ] { - INI { Entry [ ddtrace.disable ] Current = '0' } Entry [ ddtrace.request_init_hook ] - Current = '' - } - Entry [ ddtrace.strict_mode ] - Current = '0' + Current = '/usr/share/pear/datadog_trace/bridge/dd_wrap_autoloader.php' } } - Constants [1] { - Constant [ string DD_TRACE_VERSION ] { 0.47.1 } + Constant [ string DD_TRACE_VERSION ] { 0.48.0 } } - Functions { @@ -161,6 +158,23 @@ Extension [ extension #116 ddtrace version 0.47.1 ] { Parameter #2 [ $tracing_closure ] } } + Function [ function DDTrace\hook_function ] { + + - Parameters [3] { + Parameter #0 [ $function_name ] + Parameter #1 [ $prehook ] + Parameter #2 [ $posthook ] + } + } + Function [ function DDTrace\hook_method ] { + + - Parameters [4] { + Parameter #0 [ $class_name ] + Parameter #1 [ $method_name ] + Parameter #2 [ $prehook ] + Parameter #3 [ $posthook ] + } + } Function [ function DDTrace\startup_logs ] { - Parameters [0] { diff --git a/engine_api.c b/engine_api.c deleted file mode 100644 index 05cfe15..0000000 --- a/engine_api.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "engine_api.h" - -#include "engine_hooks.h" // for ddtrace_backup_error_handling - -int ddtrace_call_sandboxed_function(const char *name, size_t name_len, zval **retval, int argc, - zval **argv[] TSRMLS_DC) { - zval *fname; - MAKE_STD_ZVAL(fname); - ZVAL_STRINGL(fname, name, name_len, 1); - zend_fcall_info fci; - zend_fcall_info_cache fcc; - - // Play it safe if an exception has not been handled yet - if (EG(exception)) { - return FAILURE; - } - - ddtrace_error_handling eh; - ddtrace_backup_error_handling(&eh, EH_SUPPRESS TSRMLS_CC); - - int result = zend_fcall_info_init(fname, IS_CALLABLE_CHECK_SILENT, &fci, &fcc, NULL, NULL TSRMLS_CC); - if (result == SUCCESS) { - fci.retval_ptr_ptr = retval; - fci.params = argv; - fci.no_separation = 0; // allow for by-ref args - fci.param_count = argc; - result = zend_call_function(&fci, &fcc TSRMLS_CC); - } - - ddtrace_restore_error_handling(&eh TSRMLS_CC); - - if (EG(exception)) { - zend_clear_exception(TSRMLS_C); - } - - zval_dtor(fname); - efree(fname); - return result; -} diff --git a/engine_api.h b/engine_api.h deleted file mode 100644 index e0948ac..0000000 --- a/engine_api.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef DDTRACE_PHP_5_ENGINE_API_H -#define DDTRACE_PHP_5_ENGINE_API_H - -/* This file is for things that make working with the engine easier. Good - * candidates include: - * - Wrappers for functions which change signature/semantics over time. - * - Wrappers that reduce verbosity when working with zend_* functions. - * - Functions that perform high-level language tasks, such as reading and - * writing object properties, calling functions, calling methods, etc. - */ - -#include - -int ddtrace_call_sandboxed_function(const char *name, size_t name_len, zval **retval, int argc, - zval **argv[] TSRMLS_DC); - -#endif // DDTRACE_PHP_5_ENGINE_API_H diff --git a/handlers_curl.c b/handlers_curl.c deleted file mode 100644 index 54a4ea1..0000000 --- a/handlers_curl.c +++ /dev/null @@ -1,269 +0,0 @@ -#include -#include -#include - -#include - -#include "configuration.h" -#include "ddtrace.h" -#include "distributed_tracing.h" -#include "engine_api.h" -#include "handlers_internal.h" -#include "random.h" - -// True global - only modify during MINIT/MSHUTDOWN -long _dd_const_curlopt_httpheader = 0; - -static void (*_dd_curl_close_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; -static void (*_dd_curl_copy_handle_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; -static void (*_dd_curl_exec_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; -static void (*_dd_curl_init_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; -static void (*_dd_curl_setopt_array_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; -static void (*_dd_curl_setopt_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; - -ZEND_EXTERN_MODULE_GLOBALS(ddtrace); - -static bool _dd_load_curl_integration(TSRMLS_D) { - if (!get_dd_trace_sandbox_enabled() || DDTRACE_G(disable_in_current_request)) { - return false; - } - return ddtrace_config_distributed_tracing_enabled(TSRMLS_C) && DDTRACE_G(le_curl); -} - -static void _dd_saved_headers_dtor(void *headers) { - HashTable *ht = *((HashTable **)headers); - zend_hash_destroy(ht); - FREE_HASHTABLE(ht); -} - -static void _dd_store_resource_header_cache(zval *resource, HashTable *headers TSRMLS_DC) { - if (!DDTRACE_G(dt_http_saved_curl_headers)) { - ALLOC_HASHTABLE(DDTRACE_G(dt_http_saved_curl_headers)); - zend_hash_init(DDTRACE_G(dt_http_saved_curl_headers), 8, NULL, (dtor_func_t)_dd_saved_headers_dtor, 0); - } - - HashTable *new_headers; - ALLOC_HASHTABLE(new_headers); - zend_hash_init(new_headers, zend_hash_num_elements(headers), NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(new_headers, headers, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval *)); - - zend_hash_index_update(DDTRACE_G(dt_http_saved_curl_headers), Z_RESVAL_P(resource), &new_headers, - sizeof(HashTable *), NULL); -} - -static void _dd_delete_resource_header_cache(zval *resource TSRMLS_DC) { - if (DDTRACE_G(dt_http_saved_curl_headers)) { - zend_hash_index_del(DDTRACE_G(dt_http_saved_curl_headers), Z_RESVAL_P(resource)); - } -} - -static bool _dd_is_valid_curl_resource(zval *ch TSRMLS_DC) { - void *resource = zend_fetch_resource(&ch TSRMLS_CC, -1, "cURL handle", NULL, 1, DDTRACE_G(le_curl)); - return resource != NULL; -} - -ZEND_FUNCTION(ddtrace_curl_close) { - zval *ch; - - if (_dd_load_curl_integration(TSRMLS_C) && - zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &ch) == SUCCESS) { - if (_dd_is_valid_curl_resource(ch TSRMLS_CC)) { - _dd_delete_resource_header_cache(ch TSRMLS_CC); - } - } - - _dd_curl_close_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); -} - -static void _dd_copy_dt_http_headers(zval *ch_orig, zval *ch_new TSRMLS_DC) { - HashTable *headers_store = DDTRACE_G(dt_http_saved_curl_headers); - HashTable **users_headers = NULL; - if (headers_store && zend_hash_index_find(headers_store, Z_RESVAL_P(ch_orig), (void **)&users_headers) == SUCCESS) { - _dd_store_resource_header_cache(ch_new, *users_headers TSRMLS_CC); - } -} - -ZEND_FUNCTION(ddtrace_curl_copy_handle) { - zval *ch1; - - if (!_dd_load_curl_integration(TSRMLS_C) || - zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &ch1) == FAILURE) { - _dd_curl_copy_handle_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - return; - } - - _dd_curl_copy_handle_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - - if (Z_TYPE_P(return_value) == IS_RESOURCE) { - _dd_copy_dt_http_headers(ch1, return_value TSRMLS_CC); - } -} - -// Returns the user's headers for this resource -// Caller must free the HashTable -static HashTable *_dd_get_existing_headers(zval *resource TSRMLS_DC) { - HashTable *retval; - ALLOC_HASHTABLE(retval); - - HashTable *headers_store = DDTRACE_G(dt_http_saved_curl_headers); - HashTable **users_headers = NULL; - if (headers_store && - zend_hash_index_find(headers_store, Z_RESVAL_P(resource), (void **)&users_headers) == SUCCESS) { - size_t headers_count = zend_hash_num_elements(*users_headers); - zend_hash_init(retval, headers_count, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(retval, *users_headers, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval *)); - } else { - zend_hash_init(retval, 0, NULL, ZVAL_PTR_DTOR, 0); - } - return retval; -} - -ZEND_FUNCTION(ddtrace_curl_exec) { - zval *ch; - - if (_dd_load_curl_integration(TSRMLS_C) && ddtrace_peek_span_id(TSRMLS_C) != 0 && - zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &ch) == SUCCESS) { - if (_dd_is_valid_curl_resource(ch TSRMLS_CC) && - zend_hash_exists(EG(function_table), "ddtrace\\bridge\\curl_inject_distributed_headers", - sizeof("ddtrace\\bridge\\curl_inject_distributed_headers") /* no - 1 */)) { - // Inject distributed tracing headers before the curl_exec() call - zval **setopt_args[2]; - - // Arg 0: resource $ch - setopt_args[0] = &ch; - - // Arg 1: mixed $value (array of headers) - HashTable *headers = _dd_get_existing_headers(ch TSRMLS_CC); - zval *headers_zv; - MAKE_STD_ZVAL(headers_zv); - headers_zv->type = IS_ARRAY; - headers_zv->value.ht = headers; - zval_copy_ctor(headers_zv); - setopt_args[1] = &headers_zv; - - zval *retval = NULL; - DDTRACE_G(back_up_http_headers) = 0; // Don't save our own HTTP headers - if (ddtrace_call_sandboxed_function(ZEND_STRL("ddtrace\\bridge\\curl_inject_distributed_headers"), &retval, - 2, setopt_args TSRMLS_CC) == SUCCESS && - retval) { - zval_ptr_dtor(&retval); - } - DDTRACE_G(back_up_http_headers) = 1; - - zval_ptr_dtor(&headers_zv); - zend_hash_destroy(headers); - FREE_HASHTABLE(headers); - } - } - - _dd_curl_exec_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); -} - -ZEND_FUNCTION(ddtrace_curl_init) { - _dd_curl_init_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - - if (Z_TYPE_P(return_value) == IS_RESOURCE) { - if (!DDTRACE_G(le_curl)) { - zend_list_find(Z_LVAL_P(return_value), &DDTRACE_G(le_curl)); - DDTRACE_G(back_up_http_headers) = 1; - } - if (_dd_load_curl_integration(TSRMLS_C)) { - _dd_delete_resource_header_cache(return_value TSRMLS_CC); - } - } -} - -ZEND_FUNCTION(ddtrace_curl_setopt) { - zval *zid, **zvalue; - long option; - - if (!_dd_load_curl_integration(TSRMLS_C) || - zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rlZ", &zid, &option, &zvalue) == - FAILURE) { - _dd_curl_setopt_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - return; - } - - _dd_curl_setopt_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - - if (DDTRACE_G(back_up_http_headers) && Z_BVAL_P(return_value) && _dd_const_curlopt_httpheader == option) { - _dd_store_resource_header_cache(zid, Z_ARRVAL_PP(zvalue) TSRMLS_CC); - } -} - -ZEND_FUNCTION(ddtrace_curl_setopt_array) { - zval *zid, *arr; - - if (!_dd_load_curl_integration(TSRMLS_C) || - zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ra", &zid, &arr) == FAILURE) { - _dd_curl_setopt_array_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - return; - } - - _dd_curl_setopt_array_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - - if (Z_BVAL_P(return_value)) { - zval **value; - if (zend_hash_index_find(Z_ARRVAL_P(arr), _dd_const_curlopt_httpheader, (void **)&value) == SUCCESS) { - _dd_store_resource_header_cache(zid, Z_ARRVAL_PP(value) TSRMLS_CC); - } - } -} - -struct _dd_curl_handler { - const char *name; - size_t name_len; - void (**old_handler)(INTERNAL_FUNCTION_PARAMETERS); - void (*new_handler)(INTERNAL_FUNCTION_PARAMETERS); -}; -typedef struct _dd_curl_handler _dd_curl_handler; - -static void _dd_install_handler(_dd_curl_handler handler TSRMLS_DC) { - zend_function *old_handler; - if (zend_hash_find(CG(function_table), handler.name, handler.name_len, (void **)&old_handler) == SUCCESS && - old_handler != NULL) { - *handler.old_handler = old_handler->internal_function.handler; - old_handler->internal_function.handler = handler.new_handler; - } -} - -void ddtrace_curl_handlers_startup(void) { - TSRMLS_FETCH(); - // If we cannot find ext/curl then do not hook the functions - if (!zend_hash_exists(&module_registry, "curl", sizeof("curl") /* no - 1 */)) { - return; - } - - zval *tmp; - MAKE_STD_ZVAL(tmp); - int res = zend_get_constant_ex(ZEND_STRL("CURLOPT_HTTPHEADER"), tmp, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC); - if (res) { - _dd_const_curlopt_httpheader = Z_LVAL_P(tmp); - } - zval_dtor(tmp); - efree(tmp); - if (!res) { - return; - } - - // These are not 'sizeof() - 1' on PHP 5 - _dd_curl_handler handlers[] = { - {"curl_close", sizeof("curl_close"), &_dd_curl_close_handler, ZEND_FN(ddtrace_curl_close)}, - {"curl_copy_handle", sizeof("curl_copy_handle"), &_dd_curl_copy_handle_handler, - ZEND_FN(ddtrace_curl_copy_handle)}, - {"curl_exec", sizeof("curl_exec"), &_dd_curl_exec_handler, ZEND_FN(ddtrace_curl_exec)}, - {"curl_init", sizeof("curl_init"), &_dd_curl_init_handler, ZEND_FN(ddtrace_curl_init)}, - {"curl_setopt", sizeof("curl_setopt"), &_dd_curl_setopt_handler, ZEND_FN(ddtrace_curl_setopt)}, - {"curl_setopt_array", sizeof("curl_setopt_array"), &_dd_curl_setopt_array_handler, - ZEND_FN(ddtrace_curl_setopt_array)}, - }; - size_t handlers_len = sizeof handlers / sizeof handlers[0]; - for (size_t i = 0; i < handlers_len; ++i) { - _dd_install_handler(handlers[i] TSRMLS_CC); - } -} - -void ddtrace_curl_handlers_rshutdown(void) { - TSRMLS_FETCH(); - DDTRACE_G(le_curl) = 0; -} diff --git a/php-pecl-datadog-trace.spec b/php-pecl-datadog-trace.spec index 8877f9b..9056d41 100644 --- a/php-pecl-datadog-trace.spec +++ b/php-pecl-datadog-trace.spec @@ -34,7 +34,7 @@ Summary: APM and distributed tracing for PHP Name: %{?sub_prefix}php-pecl-datadog-trace -Version: 0.47.1 +Version: 0.48.0 Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} # extension is dual-licensed under Apache 2.0 or BSD3. # mpack is MIT @@ -42,12 +42,6 @@ License: (ASL 2.0 or BSD) and MIT URL: https://pecl.php.net/package/%{proj_name} Source0: https://pecl.php.net/get/%{proj_name}-%{version}.tgz -Source1: https://raw.githubusercontent.com/DataDog/dd-trace-php/%{version}/src/ext/php5/engine_api.c -Source2: https://raw.githubusercontent.com/DataDog/dd-trace-php/%{version}/src/ext/php5/engine_api.h -Source3: https://raw.githubusercontent.com/DataDog/dd-trace-php/%{version}/src/ext/php5/handlers_curl.c - -Patch0: https://patch-diff.githubusercontent.com/raw/DataDog/dd-trace-php/pull/952.patch - # ddtrace only supports 64-bit platforms ExcludeArch: %{ix86} %{arm} @@ -56,7 +50,7 @@ BuildRequires: devtoolset-6-toolchain %else BuildRequires: %{?dtsprefix}gcc %endif -BuildRequires: %{?scl_prefix}php-devel +BuildRequires: %{?scl_prefix}php-devel > 5.6 BuildRequires: %{?scl_prefix}php-pear BuildRequires: curl-devel # For tests @@ -84,15 +78,12 @@ Provides: %{?scl_prefix}php-pecl-%{safe_name}%{?_isa} = %{version}-%{rele # Other third party repo stuff %if "%{php_version}" > "7.2" Obsoletes: php72u-pecl-%{safe_name} <= %{version} -Obsoletes: php72w-pecl-%{safe_name} <= %{version} %endif %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{safe_name} <= %{version} -Obsoletes: php73w-pecl-%{safe_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{safe_name} <= %{version} -Obsoletes: php74w-pecl-%{safe_name} <= %{version} %endif %endif @@ -119,8 +110,11 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -%patch0 -p1 -cp %{SOURCE1} %{SOURCE2} %{SOURCE3} src/ext/php5/ +: PEAR installer stuff +sed -e 's:@php_dir@:%{pear_phpdir}:' \ + -e 's:_BUILD_FROM_PECL_:1:' \ + -i src/ext/ddtrace.c + cp src/ext/mpack/LICENSE LICENSE.mpack : Sanity check, really often broken extver=$(sed -n '/#define PHP_DDTRACE_VERSION /{s/.* "//;s/".*$//;p}' src/ext/version.h) @@ -142,8 +136,7 @@ extension=%{pecl_name}.so ; Configuration ;ddtrace.disable = Off -;ddtrace.request_init_hook = '' -;ddtrace.strict_mode = Off +;ddtrace.request_init_hook = '%{pear_phpdir}/datadog_trace/bridge/dd_wrap_autoloader.php' EOF @@ -190,6 +183,10 @@ make -C ZTS install INSTALL_ROOT=%{buildroot} install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif +# PEAR stuff +mkdir -p %{buildroot}%{pear_phpdir}/datadog_trace/ +cp -pr NTS/bridge %{buildroot}%{pear_phpdir}/datadog_trace/bridge + # Documentation for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i @@ -201,7 +198,7 @@ done rm ?TS/tests/ext/segfault_backtrace_*.phpt rm ?TS/tests/ext/sandbox/memory_limit_graceful_bailout.phpt -MOD="-n" +MOD="-n -d ddtrace.request_init_hook=" [ -f %{php_extdir}/curl.so ] && MOD="$MOD -d extension=curl.so" [ -f %{php_extdir}/json.so ] && MOD="$MOD -d extension=json.so" [ -f %{php_extdir}/posix.so ] && MOD="$MOD -d extension=posix.so" @@ -256,6 +253,8 @@ fi %files %doc %{pecl_docdir}/%{pecl_name} %{?_licensedir:%license NTS/LICENSE*} +%dir %{pear_phpdir}/datadog_trace + %{pear_phpdir}/datadog_trace/bridge %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} @@ -268,6 +267,12 @@ fi %changelog +* Wed Aug 26 2020 Remi Collet - 0.48.0-1 +- update to 0.48.0 +- drop patch merged upstream +- install PHP library +- raise dependency on PHP 5.6 + * Sat Aug 1 2020 Remi Collet - 0.47.1-1 - update to 0.47.1 -- cgit