From 439692065f0c8ba8d59c45b687513a47cfa775f4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 15 Jun 2022 17:10:32 +0200 Subject: Upgrade to 0.5.6 add patch allowing build with PHP 5 --- .gitignore | 2 + Makefile | 4 + PHPINFO | 2 +- REFLECTION | 44 ++++++- libvirt-php5.patch | 29 +++++ libvirt-php8.patch | 329 ----------------------------------------------------- php-libvirt.spec | 26 ++--- 7 files changed, 86 insertions(+), 350 deletions(-) create mode 100644 libvirt-php5.patch delete mode 100644 libvirt-php8.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/Makefile b/Makefile index 91b0fd5..47b51fb 100644 --- a/Makefile +++ b/Makefile @@ -2,3 +2,7 @@ SRCDIR := $(shell pwd) NAME := $(shell basename $(SRCDIR)) include ../../common/Makefile +refl: $(NAME).spec + php -d extension=libvirt-php --re libvirt >REFLECTION + php -d extension=libvirt-php --ri libvirt >PHPINFO + diff --git a/PHPINFO b/PHPINFO index 0a42ed6..b557fb0 100644 --- a/PHPINFO +++ b/PHPINFO @@ -3,7 +3,7 @@ libvirt Libvirt support => enabled Debug support => enabled, default maximum log file size: 1024 KiB -Extension version => 0.5.5 +Extension version => 0.5.6 Libvirt version => 7.6.0 Max. connections => 5 ISO Image path => /var/lib/libvirt/images diff --git a/REFLECTION b/REFLECTION index c6c36a6..a0b4a9b 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,9 +1,12 @@ -Extension [ extension #121 libvirt version 0.5.5 ] { +Extension [ extension #121 libvirt version 0.5.6 ] { - INI { Entry [ libvirt.longlong_to_string ] Current = '1' } + Entry [ libvirt.signed_longlong_to_string ] + Current = '0' + } Entry [ libvirt.iso_path ] Current = '/var/lib/libvirt/images' } @@ -15,7 +18,7 @@ Extension [ extension #121 libvirt version 0.5.5 ] { } } - - Constants [186] { + - Constants [193] { Constant [ int VIR_DOMAIN_XML_SECURE ] { 1 } Constant [ int VIR_DOMAIN_XML_INACTIVE ] { 2 } Constant [ int VIR_DOMAIN_XML_UPDATE_CPU ] { 4 } @@ -32,6 +35,9 @@ Extension [ extension #121 libvirt version 0.5.5 ] { Constant [ int VIR_STORAGE_VOL_RESIZE_ALLOCATE ] { 1 } Constant [ int VIR_STORAGE_VOL_RESIZE_DELTA ] { 2 } Constant [ int VIR_STORAGE_VOL_RESIZE_SHRINK ] { 4 } + Constant [ int VIR_STORAGE_VOL_DELETE_NORMAL ] { 0 } + Constant [ int VIR_STORAGE_VOL_DELETE_ZEROED ] { 1 } + Constant [ int VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS ] { 2 } Constant [ int VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA ] { 1 } Constant [ int VIR_STORAGE_VOL_CREATE_REFLINK ] { 2 } Constant [ int VIR_DOMAIN_VCPU_CONFIG ] { 2 } @@ -90,7 +96,7 @@ Extension [ extension #121 libvirt version 0.5.5 ] { Constant [ int VIR_CRED_CNONCE ] { 4 } Constant [ int VIR_CRED_PASSPHRASE ] { 5 } Constant [ int VIR_CRED_ECHOPROMPT ] { 6 } - Constant [ int VIR_CRED_NOECHOPROMP ] { 7 } + Constant [ int VIR_CRED_NOECHOPROMPT ] { 7 } Constant [ int VIR_CRED_REALM ] { 8 } Constant [ int VIR_CRED_EXTERNAL ] { 9 } Constant [ int VIR_DOMAIN_MEMORY_STAT_SWAP_IN ] { 0 } @@ -202,6 +208,10 @@ Extension [ extension #121 libvirt version 0.5.5 ] { Constant [ int VIR_KEYCODE_SET_USB ] { 7 } Constant [ int VIR_KEYCODE_SET_WIN32 ] { 8 } Constant [ int VIR_KEYCODE_SET_RFB ] { 9 } + Constant [ int VIR_DOMAIN_UNDEFINE_MANAGED_SAVE ] { 1 } + Constant [ int VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA ] { 2 } + Constant [ int VIR_DOMAIN_UNDEFINE_NVRAM ] { 4 } + Constant [ int VIR_DOMAIN_UNDEFINE_KEEP_NVRAM ] { 8 } } - Functions { @@ -581,6 +591,13 @@ Extension [ extension #121 libvirt version 0.5.5 ] { Parameter #0 [ $conn ] } } + Function [ function libvirt_domain_undefine_flags ] { + + - Parameters [2] { + Parameter #0 [ $conn ] + Parameter #1 [ $flags ] + } + } Function [ function libvirt_domain_reboot ] { - Parameters [2] { @@ -936,6 +953,12 @@ Extension [ extension #121 libvirt version 0.5.5 ] { Parameter #0 [ $conn ] } } + Function [ function libvirt_domain_get_cpu_total_stats ] { + + - Parameters [1] { + Parameter #0 [ $conn ] + } + } Function [ function libvirt_domain_has_current_snapshot ] { - Parameters [2] { @@ -958,6 +981,13 @@ Extension [ extension #121 libvirt version 0.5.5 ] { Parameter #1 [ $flags = ] } } + Function [ function libvirt_domain_snapshot_current ] { + + - Parameters [2] { + Parameter #0 [ $conn ] + Parameter #1 [ $flags = ] + } + } Function [ function libvirt_domain_snapshot_get_xml ] { - Parameters [2] { @@ -1312,6 +1342,14 @@ Extension [ extension #121 libvirt version 0.5.5 ] { Parameter #1 [ $flags = ] } } + Function [ function libvirt_network_get_dhcp_leases ] { + + - Parameters [3] { + Parameter #0 [ $conn ] + Parameter #1 [ $mac = ] + Parameter #2 [ $flags = ] + } + } Function [ function libvirt_node_get_info ] { - Parameters [1] { diff --git a/libvirt-php5.patch b/libvirt-php5.patch new file mode 100644 index 0000000..43e718a --- /dev/null +++ b/libvirt-php5.patch @@ -0,0 +1,29 @@ +From 1f7882e3476699ed0296095edadd1ed63b0c14b6 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 15 Jun 2022 17:09:04 +0200 +Subject: [PATCH] missing macro for PHP 5.x + +--- + src/util.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/util.h b/src/util.h +index 237ff43..2261682 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -215,6 +215,12 @@ + # define VIRT_ADD_ASSOC_STRING(_arg, _key, _str) \ + add_assoc_string(_arg, _key, _str, 1) + ++# define VIRT_ADD_ASSOC_STRING_WITH_NULL_POINTER_CHECK(_arg, _key, _str) \ ++ if ((_str)) { \ ++ add_assoc_string(_arg, _key, _str, 1); \ ++ } else { \ ++ add_assoc_null(_arg, _key); \ ++ } + # define VIRT_ADD_ASSOC_STRING_EX(_arg, _key, _key_len, _value) \ + add_assoc_string_ex(_arg, _key, _key_len, _value, 1) + +-- +2.35.3 + diff --git a/libvirt-php8.patch b/libvirt-php8.patch deleted file mode 100644 index c60a5da..0000000 --- a/libvirt-php8.patch +++ /dev/null @@ -1,329 +0,0 @@ -From 103665cce450db8e8c6cc0f8c3fe1e69186f3bb2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Mon, 4 May 2020 18:18:23 +0100 -Subject: [PATCH] src: don't declare global variables in header files -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In Fedora 32 and later the linker will no longer merge duplicate global -variables. Thus headers need fixing to properly use "extern" and put the -actual declaration in the source files. - -Reviewed-by: Michal Privoznik -Signed-off-by: Daniel P. Berrangé ---- - src/libvirt-connection.c | 2 ++ - src/libvirt-connection.h | 2 +- - src/libvirt-domain.c | 2 ++ - src/libvirt-domain.h | 2 +- - src/libvirt-network.c | 2 ++ - src/libvirt-network.h | 2 +- - src/libvirt-nodedev.c | 2 ++ - src/libvirt-nodedev.h | 2 +- - src/libvirt-nwfilter.c | 2 ++ - src/libvirt-nwfilter.h | 2 +- - src/libvirt-php.c | 2 ++ - src/libvirt-php.h | 2 +- - src/libvirt-snapshot.c | 2 ++ - src/libvirt-snapshot.h | 2 +- - src/libvirt-storage.c | 3 +++ - src/libvirt-storage.h | 4 ++-- - src/libvirt-stream.c | 2 ++ - src/libvirt-stream.h | 2 +- - 18 files changed, 29 insertions(+), 10 deletions(-) - -diff --git a/src/libvirt-connection.c b/src/libvirt-connection.c -index 9e70031..adc0045 100644 ---- a/src/libvirt-connection.c -+++ b/src/libvirt-connection.c -@@ -11,6 +11,8 @@ - - DEBUG_INIT("connection"); - -+int le_libvirt_connection; -+ - /* - * Private function name: free_resources_on_connection - * Since version: 0.4.2 -diff --git a/src/libvirt-connection.h b/src/libvirt-connection.h -index 0cae5ec..20f79e0 100644 ---- a/src/libvirt-connection.h -+++ b/src/libvirt-connection.h -@@ -46,7 +46,7 @@ - RETURN_FALSE; \ - } while (0) - --int le_libvirt_connection; -+extern int le_libvirt_connection; - - typedef struct _php_libvirt_connection { - virConnectPtr conn; -diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c -index f594253..419630b 100644 ---- a/src/libvirt-domain.c -+++ b/src/libvirt-domain.c -@@ -15,6 +15,8 @@ - - DEBUG_INIT("domain"); - -+int le_libvirt_domain; -+ - void - php_libvirt_domain_dtor(virt_resource *rsrc TSRMLS_DC) - { -diff --git a/src/libvirt-domain.h b/src/libvirt-domain.h -index 8b80c9c..8640df8 100644 ---- a/src/libvirt-domain.h -+++ b/src/libvirt-domain.h -@@ -120,7 +120,7 @@ - PHP_FE(libvirt_list_active_domains, arginfo_libvirt_conn) \ - PHP_FE(libvirt_list_inactive_domains, arginfo_libvirt_conn) - --int le_libvirt_domain; -+extern int le_libvirt_domain; - - typedef struct _php_libvirt_domain { - virDomainPtr domain; -diff --git a/src/libvirt-network.c b/src/libvirt-network.c -index 673790a..3888780 100644 ---- a/src/libvirt-network.c -+++ b/src/libvirt-network.c -@@ -11,6 +11,8 @@ - - DEBUG_INIT("network"); - -+int le_libvirt_network; -+ - void - php_libvirt_network_dtor(virt_resource *rsrc TSRMLS_DC) - { -diff --git a/src/libvirt-network.h b/src/libvirt-network.h -index 604b803..634c681 100644 ---- a/src/libvirt-network.h -+++ b/src/libvirt-network.h -@@ -45,7 +45,7 @@ - PHP_FE(libvirt_list_all_networks, arginfo_libvirt_conn_optflags) \ - PHP_FE(libvirt_list_networks, arginfo_libvirt_conn_optflags) - --int le_libvirt_network; -+extern int le_libvirt_network; - - typedef struct _php_libvirt_network { - virNetworkPtr network; -diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c -index 5cfe428..e7a8535 100644 ---- a/src/libvirt-nodedev.c -+++ b/src/libvirt-nodedev.c -@@ -11,6 +11,8 @@ - - DEBUG_INIT("nodedev"); - -+int le_libvirt_nodedev; -+ - void - php_libvirt_nodedev_dtor(virt_resource *rsrc TSRMLS_DC) - { -diff --git a/src/libvirt-nodedev.h b/src/libvirt-nodedev.h -index 350b213..1357037 100644 ---- a/src/libvirt-nodedev.h -+++ b/src/libvirt-nodedev.h -@@ -35,7 +35,7 @@ - RETURN_FALSE; \ - } while (0) - --int le_libvirt_nodedev; -+extern int le_libvirt_nodedev; - - typedef struct _php_libvirt_nodedev { - virNodeDevicePtr device; -diff --git a/src/libvirt-nwfilter.c b/src/libvirt-nwfilter.c -index d949052..fa824cb 100644 ---- a/src/libvirt-nwfilter.c -+++ b/src/libvirt-nwfilter.c -@@ -11,6 +11,8 @@ - - DEBUG_INIT("nwfilter"); - -+int le_libvirt_nwfilter; -+ - void - php_libvirt_nwfilter_dtor(virt_resource *rsrc TSRMLS_DC) - { -diff --git a/src/libvirt-nwfilter.h b/src/libvirt-nwfilter.h -index c0cebb3..b450419 100644 ---- a/src/libvirt-nwfilter.h -+++ b/src/libvirt-nwfilter.h -@@ -42,7 +42,7 @@ - RETURN_FALSE; \ - } while (0) \ - --int le_libvirt_nwfilter; -+extern int le_libvirt_nwfilter; - - typedef struct _php_libvirt_nwfilter { - virNWFilterPtr nwfilter; -diff --git a/src/libvirt-php.c b/src/libvirt-php.c -index 75cbf68..04f73d9 100644 ---- a/src/libvirt-php.c -+++ b/src/libvirt-php.c -@@ -31,6 +31,8 @@ - - DEBUG_INIT("core"); - -+ZEND_DECLARE_MODULE_GLOBALS(libvirt) -+ - #ifndef EXTWIN - /* Additional binaries */ - const char *features[] = { "screenshot", "create-image", "screenshot-convert", NULL }; -diff --git a/src/libvirt-php.h b/src/libvirt-php.h -index d6e61c5..f0c77ce 100644 ---- a/src/libvirt-php.h -+++ b/src/libvirt-php.h -@@ -155,7 +155,7 @@ ZEND_BEGIN_MODULE_GLOBALS(libvirt) - int binding_resources_count; - ZEND_END_MODULE_GLOBALS(libvirt) - --ZEND_DECLARE_MODULE_GLOBALS(libvirt) -+ZEND_EXTERN_MODULE_GLOBALS(libvirt) - - /* Private definitions */ - void set_error(char *msg TSRMLS_DC); -diff --git a/src/libvirt-snapshot.c b/src/libvirt-snapshot.c -index e1445a2..3b10c10 100644 ---- a/src/libvirt-snapshot.c -+++ b/src/libvirt-snapshot.c -@@ -11,6 +11,8 @@ - - DEBUG_INIT("snapshot"); - -+int le_libvirt_snapshot; -+ - void php_libvirt_snapshot_dtor(virt_resource *rsrc TSRMLS_DC) - { - php_libvirt_snapshot *snapshot = (php_libvirt_snapshot *)rsrc->ptr; -diff --git a/src/libvirt-snapshot.h b/src/libvirt-snapshot.h -index 32db210..f8339a6 100644 ---- a/src/libvirt-snapshot.h -+++ b/src/libvirt-snapshot.h -@@ -39,7 +39,7 @@ - RETURN_FALSE; \ - } while (0) \ - --int le_libvirt_snapshot; -+extern int le_libvirt_snapshot; - - typedef struct _php_libvirt_snapshot { - virDomainSnapshotPtr snapshot; -diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c -index 0c0d943..593d4d2 100644 ---- a/src/libvirt-storage.c -+++ b/src/libvirt-storage.c -@@ -12,6 +12,9 @@ - - DEBUG_INIT("storage"); - -+int le_libvirt_storagepool; -+int le_libvirt_volume; -+ - void - php_libvirt_storagepool_dtor(virt_resource *rsrc TSRMLS_DC) - { -diff --git a/src/libvirt-storage.h b/src/libvirt-storage.h -index de972f7..7620c15 100644 ---- a/src/libvirt-storage.h -+++ b/src/libvirt-storage.h -@@ -83,8 +83,8 @@ - RETURN_FALSE; \ - } while (0) \ - --int le_libvirt_storagepool; --int le_libvirt_volume; -+extern int le_libvirt_storagepool; -+extern int le_libvirt_volume; - - typedef struct _php_libvirt_storagepool { - virStoragePoolPtr pool; -diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c -index f1fc1ff..11d7752 100644 ---- a/src/libvirt-stream.c -+++ b/src/libvirt-stream.c -@@ -11,6 +11,8 @@ - - DEBUG_INIT("stream"); - -+int le_libvirt_stream; -+ - void - php_libvirt_stream_dtor(virt_resource *rsrc TSRMLS_DC) - { -diff --git a/src/libvirt-stream.h b/src/libvirt-stream.h -index 89b28a6..c041ccb 100644 ---- a/src/libvirt-stream.h -+++ b/src/libvirt-stream.h -@@ -20,7 +20,7 @@ - PHP_FE(libvirt_stream_send, arginfo_libvirt_stream_send) \ - PHP_FE(libvirt_stream_recv, arginfo_libvirt_stream_recv) - --int le_libvirt_stream; -+extern int le_libvirt_stream; - - typedef struct _php_libvirt_stream { - virStreamPtr stream; - -From 6d2731fb449bf5b3eca3f77626e57576e545357d Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 27 Jan 2021 12:07:05 +0100 -Subject: [PATCH] add compat macros for PHP 8 - ---- - src/libvirt-php.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/src/libvirt-php.h b/src/libvirt-php.h -index f0c77ce..2735272 100644 ---- a/src/libvirt-php.h -+++ b/src/libvirt-php.h -@@ -7,6 +7,18 @@ - #ifndef PHP_LIBVIRT_H - #define PHP_LIBVIRT_H 1 - -+/* Use in PHP5, unneeded in PHP 7, droped in PHP 8*/ -+#ifndef TSRMLS_CC -+#define TSRMLS_D void -+#define TSRMLS_DC -+#define TSRMLS_C -+#define TSRMLS_CC -+ -+#define TSRMLS_FETCH() -+#define TSRMLS_FETCH_FROM_CTX(ctx) -+#define TSRMLS_SET_CTX(ctx) -+#endif -+ - /* Network constants */ - #define VIR_NETWORKS_ACTIVE 1 - #define VIR_NETWORKS_INACTIVE 2 - -From 05cdb0548dca50f32cbdaec559f2a1f5bd2ad5d3 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 27 Jan 2021 12:09:37 +0100 -Subject: [PATCH 2/2] missing ; - ---- - src/libvirt-domain.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c -index 29cb452..45deba6 100644 ---- a/src/libvirt-domain.c -+++ b/src/libvirt-domain.c -@@ -2000,7 +2000,7 @@ PHP_FUNCTION(libvirt_domain_interface_addresses) - GET_DOMAIN_FROM_ARGS("rl", &zdomain, &source); - - if ((count = virDomainInterfaceAddresses(domain->domain, &ifaces, source, 0)) < 0) { -- RETURN_FALSE -+ RETURN_FALSE; - goto cleanup; - } - - diff --git a/php-libvirt.spec b/php-libvirt.spec index bd9fbe0..fd1e5fd 100644 --- a/php-libvirt.spec +++ b/php-libvirt.spec @@ -30,17 +30,17 @@ %endif Name: %{?sub_prefix}php-libvirt -Version: 0.5.5 -Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Version: 0.5.6 +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: PHP language binding for Libvirt Group: Development/Libraries # libvirt-php is under the same terms as libvirt License: LGPLv2+ URL: http://libvirt.org/php -Source0: http://libvirt.org/sources/php/libvirt-php-%{version}.tar.gz +Source0: http://libvirt.org/sources/php/libvirt-php-%{version}.tar.xz -Patch0: libvirt-php8.patch +Patch0: libvirt-php5.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -56,18 +56,6 @@ Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -%if "%{php_version}" > "7.3" -Obsoletes: php73-libvirt <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-libvirt <= %{version} -%endif -%if "%{php_version}" > "8.0" -Obsoletes: php80-libvirt <= %{version} -%endif -%endif - # Filter shared private - always as libvirt-php.so is a very bad name %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} @@ -99,7 +87,7 @@ This package contain the document for php-libvirt. %prep %setup -q -n libvirt-php-%{version} -%patch0 -p1 -b .php8 +%patch0 -p1 -b .php5 %build @@ -152,6 +140,10 @@ rm %{buildroot}%{php_extdir}/%{extname}.la %changelog +* Wed Jun 15 2022 Remi Collet - 0.5.6-1 +- Upgrade to 0.5.6 +- add patch allowing build with PHP 5 + * Wed Sep 01 2021 Remi Collet - 0.5.5-5 - rebuild for 8.1.0RC1 -- cgit