From 85e1d6e404dfcbf2a1bb2f3b226fa80a086d00fe Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 17 Jun 2015 13:45:17 +0200 Subject: php-pecl-rrd: 2.0.0beta2 + upstream patches (for php7) --- php-pecl-rrd-dev.spec | 15 ++- rrd-upstream.patch | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 303 insertions(+), 3 deletions(-) create mode 100644 rrd-upstream.patch diff --git a/php-pecl-rrd-dev.spec b/php-pecl-rrd-dev.spec index 53caacb..2e48657 100644 --- a/php-pecl-rrd-dev.spec +++ b/php-pecl-rrd-dev.spec @@ -33,6 +33,10 @@ URL: http://pecl.php.net/package/rrd Source: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz +# http://svn.php.net/viewvc?view=revision&revision=336981 +# http://svn.php.net/viewvc?view=revision&revision=336985 +Patch0: %{pecl_name}-upstream.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{?scl_prefix}php-devel >= 7 BuildRequires: rrdtool @@ -89,12 +93,16 @@ mv %{pecl_name}-%{version}%{?prever} NTS # Don't install/register tests sed -e 's/role="test"/role="src"/' -i package.xml +cd NTS +%patch0 -p3 -b .upstream + # Sanity check, really often broken -extver=$(sed -n '/#define PHP_RRD_VERSION/{s/.* "//;s/".*$//;p}' NTS/php_rrd.h) +extver=$(sed -n '/#define PHP_RRD_VERSION/{s/.* "//;s/".*$//;p}' php_rrd.h) if test "x${extver}" != "x%{version}%{?prever}"; then : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever}. exit 1 fi +cd .. cat > %{ini_name} << 'EOF' ; Enable %{pecl_name} extension module @@ -156,12 +164,12 @@ done cd NTS if pkg-config librrd --atleast-version=1.5.0 then - : ignore test failed with rrdtool > 1.5 + : ignore test failed with rrdtool gt 1.5 rm tests/rrd_{016,017}.phpt fi if ! pkg-config librrd --atleast-version=1.4.0 then - : ignore test failed with rrdtool < 1.4 + : ignore test failed with rrdtool lt 1.4 rm tests/rrd_{012,017}.phpt fi @@ -220,6 +228,7 @@ fi - raise dependency on php >= 7 - drop runtime dependency on pear, new scriptlets - don't install test suite +- add some upstream patches, post-beta2 * Wed Dec 24 2014 Remi Collet - 1.1.3-3.1 - Fedora 21 SCL mass rebuild diff --git a/rrd-upstream.patch b/rrd-upstream.patch new file mode 100644 index 0000000..20d0f2b --- /dev/null +++ b/rrd-upstream.patch @@ -0,0 +1,291 @@ +--- pecl/rrd/trunk/rrd_create.c 2015/06/16 16:14:28 336980 ++++ pecl/rrd/trunk/rrd_create.c 2015/06/16 16:20:26 336981 +@@ -102,9 +102,9 @@ + PHP_METHOD(RRDCreator, __construct) + { + rrd_create_object *intern_obj; +- char *path; int path_length; ++ char *path; size_t path_length; + /* better to set defaults for optional parameters */ +- char *start_time = NULL; int start_time_length = 0; ++ char *start_time = NULL; size_t start_time_length = 0; + long step = 0; + int argc = ZEND_NUM_ARGS(); + +@@ -146,7 +146,7 @@ + { + rrd_create_object *intern_obj; + char *desc, *rrd_source_desc; +- int desc_length; ++ size_t desc_length; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &desc, &desc_length) == FAILURE) { + return; +@@ -181,7 +181,7 @@ + { + rrd_create_object *intern_obj; + char *desc, *rrd_archive_desc; +- int desc_length; ++ size_t desc_length; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &desc, &desc_length) == FAILURE) { + return; +@@ -284,7 +284,7 @@ + PHP_FUNCTION(rrd_create) + { + char *filename; +- int filename_length; ++ size_t filename_length; + zval *zv_arr_options; + rrd_args *argv; + +--- pecl/rrd/trunk/rrd_graph.c 2015/06/16 16:14:28 336980 ++++ pecl/rrd/trunk/rrd_graph.c 2015/06/16 16:20:26 336981 +@@ -89,7 +89,7 @@ + { + rrd_graph_object *intern_obj; + char *path; +- int path_length; ++ size_t path_length; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &path, &path_length) == FAILURE) { + return; +@@ -294,7 +294,7 @@ + PHP_FUNCTION(rrd_graph) + { + char *filename; +- int filename_length; ++ size_t filename_length; + zval *zv_arr_options; + rrd_args *argv; + /* returned values if rrd_graph doesn't fail */ +--- pecl/rrd/trunk/rrd_info.c 2015/06/16 16:14:28 336980 ++++ pecl/rrd/trunk/rrd_info.c 2015/06/16 16:20:26 336981 +@@ -25,7 +25,7 @@ + PHP_FUNCTION(rrd_info) + { + char *filename; +- int filename_length; ++ size_t filename_length; + /* list of arguments for rrd_info call, it's more efficient then u + * usage of rrd_args, because there isn't array of arguments in parameters + */ +--- pecl/rrd/trunk/rrd_update.c 2015/06/16 16:14:28 336980 ++++ pecl/rrd/trunk/rrd_update.c 2015/06/16 16:20:26 336981 +@@ -83,7 +83,7 @@ + { + rrd_update_object *intern_obj; + char *path; +- int path_length; ++ size_t path_length; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &path, &path_length) == FAILURE) { + return; +@@ -107,7 +107,7 @@ + rrd_args *update_argv; + + char *time = NULL; +- int time_str_length = 0; ++ size_t time_str_length = 0; + + int argc = ZEND_NUM_ARGS(); + zend_string *zs_ds_name; +@@ -215,7 +215,7 @@ + PHP_FUNCTION(rrd_update) + { + char *filename; +- int filename_length; ++ size_t filename_length; + zval *zv_arr_options; + rrd_args *argv; + +Index: rrd_create.c +=================================================================== +--- pecl/rrd/trunk/rrd_create.c (révision 336981) ++++ pecl/rrd/trunk/rrd_create.c (copie de travail) +@@ -30,7 +30,6 @@ + of having dedicated creating/cloning/destruction functions + */ + typedef struct _rrd_create_object { +- zend_object std; + /** path to newly created rrd file */ + char *file_path; + /* "--start" parameters in rrd create */ +@@ -41,6 +40,7 @@ + zval zv_arr_data_sources; + /* "RRA" parameters in rrd create */ + zval zv_arr_archives; ++ zend_object std; + } rrd_create_object; + + /** +@@ -79,7 +79,7 @@ + static zend_object *rrd_create_object_new(zend_class_entry *ce) + { + rrd_create_object *intern_obj = ecalloc(1, sizeof(rrd_create_object) + +- sizeof(zval) * (ce->default_properties_count - 1)); ++ zend_object_properties_size(ce)); + intern_obj->file_path = NULL; + intern_obj->start_time = NULL; + ZVAL_UNDEF(&intern_obj->zv_step); +@@ -329,7 +329,7 @@ + PHP_ME(RRDCreator, save, NULL, ZEND_ACC_PUBLIC) + PHP_ME(RRDCreator, addDataSource, arginfo_rrdcreator_description, ZEND_ACC_PUBLIC) + PHP_ME(RRDCreator, addArchive, arginfo_rrdcreator_description, ZEND_ACC_PUBLIC) +- {NULL, NULL, NULL} ++ PHP_FE_END + }; + + /* minit hook, called from main module minit */ +Index: rrd_graph.c +=================================================================== +--- pecl/rrd/trunk/rrd_graph.c (révision 336981) ++++ pecl/rrd/trunk/rrd_graph.c (copie de travail) +@@ -32,9 +32,9 @@ + * of having dedicated creating/cloning/destruction functions + */ + typedef struct _rrd_graph_object { +- zend_object std; + char *file_path; + zval zv_arr_options; ++ zend_object std; + } rrd_graph_object; + + /** +@@ -69,7 +69,7 @@ + static zend_object *rrd_graph_object_new(zend_class_entry *ce) + { + rrd_graph_object *intern_obj = ecalloc(1, sizeof(rrd_graph_object) + +- sizeof(zval) * (ce->default_properties_count - 1)); ++ zend_object_properties_size(ce)); + intern_obj->file_path = NULL; + ZVAL_UNDEF(&intern_obj->zv_arr_options); + +@@ -370,7 +370,7 @@ + PHP_ME(RRDGraph, save, NULL, ZEND_ACC_PUBLIC) + PHP_ME(RRDGraph, saveVerbose, NULL, ZEND_ACC_PUBLIC) + PHP_ME(RRDGraph, setOptions, arginfo_rrd_options, ZEND_ACC_PUBLIC) +- {NULL, NULL, NULL} ++ PHP_FE_END + }; + + /* minit hook, called from main module minit */ +Index: rrd_update.c +=================================================================== +--- pecl/rrd/trunk/rrd_update.c (révision 336981) ++++ pecl/rrd/trunk/rrd_update.c (copie de travail) +@@ -31,9 +31,9 @@ + * of having dedicated creating/cloning/destruction functions + */ + typedef struct _rrd_update_object { +- zend_object std; + /** path to newly created rrd file */ + char *file_path; ++ zend_object std; + } rrd_update_object; + + /** +@@ -63,8 +63,8 @@ + */ + static zend_object *rrd_update_object_new(zend_class_entry *ce) + { +- rrd_update_object *intern_obj = ecalloc(1, sizeof(rrd_update_object) + +- sizeof(zval) * (ce->default_properties_count - 1)); ++ rrd_update_object *intern_obj = ecalloc(1, sizeof(rrd_update_object) + ++ zend_object_properties_size(ce)); + intern_obj->file_path = NULL; + + zend_object_std_init(&intern_obj->std, ce); +@@ -257,7 +257,7 @@ + static zend_function_entry rrd_update_methods[] = { + PHP_ME(RRDUpdater, __construct, arginfo_rrdupdater_construct, ZEND_ACC_PUBLIC) + PHP_ME(RRDUpdater, update, arginfo_rrdupdater_update, ZEND_ACC_PUBLIC) +- {NULL, NULL, NULL} ++ PHP_FE_END + }; + + /* minit hook, called from main module minit */ +@@ -271,5 +271,5 @@ + memcpy(&rrd_update_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + rrd_update_handlers.clone_obj = NULL; + rrd_update_handlers.offset = XtOffsetOf(rrd_update_object, std); +- rrd_update_handlers.free_obj = rrd_update_object_dtor; ++ rrd_update_handlers.free_obj = rrd_update_object_dtor; + } +Index: rrd.c +=================================================================== +--- pecl/rrd/trunk/rrd.c (revision 336979) ++++ pecl/rrd/trunk/rrd.c (working copy) +@@ -17,6 +17,9 @@ + #include "ext/standard/info.h" + + #include ++#ifdef HAVE_RRDC_DISCONNECT ++#include ++#endif + + #include "php_rrd.h" + #include "rrd_graph.h" +@@ -47,7 +50,7 @@ + PHP_FUNCTION(rrd_fetch) + { + char *filename; +- int filename_length; ++ size_t filename_length; + zval *zv_arr_options; + rrd_args *argv; + /* returned values if rrd_fetch doesn't fail */ +@@ -147,7 +150,7 @@ + PHP_FUNCTION(rrd_first) + { + char *filename; +- int filename_length; ++ size_t filename_length; + long rraindex = 0; + /* return value from rrd_first_r call */ + time_t rrd_first_return_val; +@@ -183,7 +186,7 @@ + PHP_FUNCTION(rrd_last) + { + char *filename; +- int filename_length; ++ size_t filename_length; + /* return value from rrd_first_r call */ + time_t rrd_last_return_val; + +@@ -212,7 +215,7 @@ + PHP_FUNCTION(rrd_lastupdate) + { + char *filename; +- int filename_length; ++ size_t filename_length; + /* list of arguments for rrd_lastupdate call, it's more efficient then + * usage of rrd_args, because there isn't array of arguments in parameters + */ +@@ -297,7 +300,7 @@ + PHP_FUNCTION(rrd_restore) + { + char *xml_filename, *rrd_filename; +- int xml_filename_length, rrd_filename_length; ++ size_t xml_filename_length, rrd_filename_length; + zval *zv_arr_options = NULL; + /* this is merge of options and rrd_filename. This is needed because + * rrd_args_init_by_phparray allows only one filename as argument, so +@@ -349,7 +352,7 @@ + PHP_FUNCTION(rrd_tune) + { + char *filename; +- int filename_length; ++ size_t filename_length; + zval *zv_arr_options; + rrd_args *argv; + +@@ -569,7 +572,7 @@ + PHP_FE(rrdc_disconnect, NULL) + #endif + PHP_FE(rrd_version, NULL) +- {NULL, NULL, NULL} ++ PHP_FE_END + }; + /* }}} */ + -- cgit