[libvirt] [libvirt-php][PATCH 0/8] Build rpms again

There's is a spec file within the sources, but it's outdated and doesn't work. However, in order to fix it, couple of other places need fixing too. Michal Privoznik (8): configure: Prefer /bin/echo before printf Distribute the spec file too configure: Fix build with --prefix Makefile: Introduce 'rpm' target libvirt-php.spec: Don't run configure twice libvirt-php.spec.in: Drop spaces at EOL libvirt-php.spec.in: Cleanup Require newer libvirt Makefile.am | 5 +- configure.ac | 15 +++++- libvirt-php.spec.in | 27 ++++++----- src/libvirt-php.c | 128 ---------------------------------------------------- src/libvirt-php.h | 4 -- 5 files changed, 30 insertions(+), 149 deletions(-) -- 2.3.6

For some reason, configure think it's good to use 'printf %s\n' as $(ECHO). Well, it's not. Problem is, the \n at the end - it does not do what you think. It merely adds 'n' at the end of each printed string. Therefore, use echo which does not need anything special. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9e9fee0..39ec71c 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ AC_LANG([C]) AC_PROG_INSTALL AC_PROG_SED AC_PROG_AWK -AC_CHECK_TOOL([ECHO], [echo]) +AC_PATH_PROG([ECHO], [echo], []) AC_CHECK_TOOL([RM], [rm]) dnl Need to test if pkg-config exists -- 2.3.6

So far, only spec.in is distributed. But preprocessed file should be distributed too, so rpm can be built right from distributed archive. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3b33a99..78ada5b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,4 +2,4 @@ SUBDIRS = tools src docs tests ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = libvirt-php.spec.in winsrc +EXTRA_DIST = libvirt-php.spec libvirt-php.spec.in winsrc -- 2.3.6

If source was configured with different --prefix than usual, local state and sysconfig dir might have improper values. Check that in configure and set the correct ones. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- configure.ac | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index 39ec71c..41c8559 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,17 @@ AC_CHECK_TOOL([RM], [rm]) dnl Need to test if pkg-config exists PKG_PROG_PKG_CONFIG +dnl if --prefix is /usr, don't use /usr/var for localstatedir +dnl or /usr/etc for sysconfdir +dnl as this makes a lot of things break in testing situations + +if test "$prefix" = "/usr" && test "$localstatedir" = '${prefix}/var' ; then + localstatedir='/var' +fi +if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then + sysconfdir='/etc' +fi + LIBVIRT_REQUIRED=0.6.2 PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED) -- 2.3.6

It allows you to 'make rpm'. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.am b/Makefile.am index 78ada5b..9db368a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,6 @@ SUBDIRS = tools src docs tests ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = libvirt-php.spec libvirt-php.spec.in winsrc + +rpm: clean + @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz) -- 2.3.6

Currently, the configure script is run twice, Firstly with arguments defined by rpmbuild, then with our hardcoded ones. This does not make any sense, since the latter overwrites any result from the former. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- libvirt-php.spec.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libvirt-php.spec.in b/libvirt-php.spec.in index f8b3715..d2a6707 100644 --- a/libvirt-php.spec.in +++ b/libvirt-php.spec.in @@ -59,8 +59,7 @@ This package contain the document for libvirt-php. %setup -q -n libvirt-php-%{version} %build -%configure -./configure --with-html-dir=%{_datadir}/doc --with-html-subdir=%{name}-%{version}/html --libdir=%{php_extdir} +%configure --with-html-dir=%{_datadir}/doc --with-html-subdir=%{name}-%{version}/html --libdir=%{php_extdir} make %{?_smp_mflags} %install -- 2.3.6

Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- libvirt-php.spec.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libvirt-php.spec.in b/libvirt-php.spec.in index d2a6707..e5437d7 100644 --- a/libvirt-php.spec.in +++ b/libvirt-php.spec.in @@ -1,10 +1,10 @@ %define req_libvirt_version 0.6.2 -%if 0%{?suse_version} +%if 0%{?suse_version} %define php_confdir %{_sysconfdir}/php5/conf.d %define php_extdir %{_libdir}/php5/extensions %else -%define php_confdir %{_sysconfdir}/php.d +%define php_confdir %{_sysconfdir}/php.d %define php_extdir %{_libdir}/php/modules %endif @@ -13,7 +13,7 @@ Version: @VERSION@ Release: 3%{?dist}%{?extra_release} Summary: PHP language binding for Libvirt -%if 0%{?suse_version} +%if 0%{?suse_version} Group: Development/Libraries/PHP %else Group: Development/Libraries @@ -27,20 +27,20 @@ BuildRequires: php-devel BuildRequires: libvirt-devel >= %{req_libvirt_version} BuildRequires: libxml2-devel BuildRequires: libxslt -%if 0%{?suse_version} +%if 0%{?suse_version} BuildRequires: xhtml-dtd %else BuildRequires: xhtml1-dtds %endif Requires: libvirt >= %{req_libvirt_version} -%if 0%{?suse_version} +%if 0%{?suse_version} Requires: php5 %else Requires: php %endif %description -PHP language bindings for Libvirt API. +PHP language bindings for Libvirt API. For more details see: http://www.libvirt.org/php/ %package -n libvirt-php-doc @@ -50,7 +50,7 @@ BuildArch: noarch Requires: libvirt-php = %{version} %description -n libvirt-php-doc -PHP language bindings for Libvirt API. +PHP language bindings for Libvirt API. For more details see: http://www.libvirt.org/php/ http://www.php.net/ This package contain the document for libvirt-php. -- 2.3.6

Fix default attributes and add unpackaged files. At the same time, don't explicitly require any specific libvirt version. Let rpm to collect dependencies from .so files. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- libvirt-php.spec.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libvirt-php.spec.in b/libvirt-php.spec.in index e5437d7..7e043cb 100644 --- a/libvirt-php.spec.in +++ b/libvirt-php.spec.in @@ -32,7 +32,6 @@ BuildRequires: xhtml-dtd %else BuildRequires: xhtml1-dtds %endif -Requires: libvirt >= %{req_libvirt_version} %if 0%{?suse_version} Requires: php5 %else @@ -65,18 +64,19 @@ make %{?_smp_mflags} %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} -chmod +x %{buildroot}%{php_extdir}/libvirt-php.so +rm -f ${RPM_BUILD_ROOT}%{php_extdir}/*.la %clean rm -rf %{buildroot} %files -%defattr(-,root,root,-) +%defattr(-,root,root) %{php_extdir}/libvirt-php.so +%{php_extdir}/libvirt-php.so.* %config(noreplace) %{php_confdir}/libvirt-php.ini %files -n libvirt-php-doc -%defattr(-,root,root,-) +%defattr(-,root,root) %doc %dir %{_datadir}/doc/%{name}-%{version} %{_datadir}/doc/%{name}-%{version}/html -- 2.3.6

Currently, we require 0.6.2 which is just ancient. While we do some checks and export only those functions for which libvirt counter-part exist, 0.6.2 is just too old. Moreover, not all functions are wrapped by libvirt version check (e.g. libvirt_connect_get_all_domain_stats). Require 1.2.8 at least which is supposed to have all the functions already. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- configure.ac | 2 +- libvirt-php.spec.in | 2 +- src/libvirt-php.c | 128 ---------------------------------------------------- src/libvirt-php.h | 4 -- 4 files changed, 2 insertions(+), 134 deletions(-) diff --git a/configure.ac b/configure.ac index 41c8559..04ebbdc 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,7 @@ if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then sysconfdir='/etc' fi -LIBVIRT_REQUIRED=0.6.2 +LIBVIRT_REQUIRED=1.2.8 PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED) dnl ========================================================================== diff --git a/libvirt-php.spec.in b/libvirt-php.spec.in index 7e043cb..5a11581 100644 --- a/libvirt-php.spec.in +++ b/libvirt-php.spec.in @@ -1,4 +1,4 @@ -%define req_libvirt_version 0.6.2 +%define req_libvirt_version 1.2.8 %if 0%{?suse_version} %define php_confdir %{_sysconfdir}/php5/conf.d diff --git a/src/libvirt-php.c b/src/libvirt-php.c index b87a09b..d13e5b4 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -62,9 +62,7 @@ int le_libvirt_volume; int le_libvirt_network; int le_libvirt_nodedev; int le_libvirt_stream; -#if LIBVIR_VERSION_NUMBER>=8000 int le_libvirt_snapshot; -#endif ZEND_DECLARE_MODULE_GLOBALS(libvirt) @@ -804,7 +802,6 @@ void free_resource(int type, arch_uint mem TSRMLS_DC) } } -#if LIBVIR_VERSION_NUMBER>=8000 if (type == INT_RESOURCE_SNAPSHOT) { rv = virDomainSnapshotFree( (virDomainSnapshotPtr)mem ); if (rv != 0) { @@ -816,7 +813,6 @@ void free_resource(int type, arch_uint mem TSRMLS_DC) resource_change_counter(INT_RESOURCE_SNAPSHOT, NULL, (virDomainSnapshotPtr)mem, 0 TSRMLS_CC); } } -#endif } /* @@ -1168,7 +1164,6 @@ static void php_libvirt_nodedev_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) } } -#if LIBVIR_VERSION_NUMBER>=8000 /* Destructor for snapshot resource */ static void php_libvirt_snapshot_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { @@ -1198,7 +1193,6 @@ static void php_libvirt_snapshot_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) efree(snapshot); } } -#endif /* ZEND Module inicialization function */ PHP_MINIT_FUNCTION(libvirt) @@ -1211,9 +1205,7 @@ PHP_MINIT_FUNCTION(libvirt) le_libvirt_volume = zend_register_list_destructors_ex(php_libvirt_volume_dtor, NULL, PHP_LIBVIRT_VOLUME_RES_NAME, module_number); le_libvirt_network = zend_register_list_destructors_ex(php_libvirt_network_dtor, NULL, PHP_LIBVIRT_NETWORK_RES_NAME, module_number); le_libvirt_nodedev = zend_register_list_destructors_ex(php_libvirt_nodedev_dtor, NULL, PHP_LIBVIRT_NODEDEV_RES_NAME, module_number); -#if LIBVIR_VERSION_NUMBER>=8000 le_libvirt_snapshot = zend_register_list_destructors_ex(php_libvirt_snapshot_dtor, NULL, PHP_LIBVIRT_SNAPSHOT_RES_NAME, module_number); -#endif ZEND_INIT_MODULE_GLOBALS(libvirt, php_libvirt_init_globals, NULL); @@ -1246,10 +1238,8 @@ PHP_MINIT_FUNCTION(libvirt) REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_MAXIMUM", VIR_DOMAIN_VCPU_MAXIMUM, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_GUEST", VIR_DOMAIN_VCPU_GUEST, CONST_CS | CONST_PERSISTENT); -#if LIBVIR_VERSION_NUMBER>=8000 /* Domain snapshot constants */ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_DELETE_CHILDREN", VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, CONST_CS | CONST_PERSISTENT); -#endif /* Memory constants */ REGISTER_LONG_CONSTANT("VIR_MEMORY_VIRTUAL", 1, CONST_CS | CONST_PERSISTENT); @@ -1481,8 +1471,6 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, args, __VA_ARGS__) == FAILU ZEND_FETCH_RESOURCE(volume, php_libvirt_volume*, &zvolume, -1, PHP_LIBVIRT_VOLUME_RES_NAME, le_libvirt_volume);\ if ((volume==NULL) || (volume->volume==NULL)) RETURN_FALSE;\ -#if LIBVIR_VERSION_NUMBER>=8000 - #define GET_SNAPSHOT_FROM_ARGS(args, ...) \ reset_error(TSRMLS_C); \ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, args, __VA_ARGS__) == FAILURE) {\ @@ -1493,8 +1481,6 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, args, __VA_ARGS__) == FAILU ZEND_FETCH_RESOURCE(snapshot, php_libvirt_snapshot*, &zsnapshot, -1, PHP_LIBVIRT_SNAPSHOT_RES_NAME, le_libvirt_snapshot);\ if ((snapshot==NULL) || (snapshot->snapshot==NULL)) RETURN_FALSE;\ -#endif - /* Macro to "recreate" string with emalloc and free the original one */ #define RECREATE_STRING_WITH_E(str_out, str_in) \ str_out = estrndup(str_in, strlen(str_in)); \ @@ -1727,7 +1713,6 @@ PHP_FUNCTION(libvirt_node_get_info) * @cpunr [int]: CPU number to get information about, defaults to VIR_NODE_CPU_STATS_ALL_CPUS to get information about all CPUs * Returns: array of node CPU statistics including time (in seconds since UNIX epoch), cpu number and total number of CPUs on node or FALSE for error */ -#if LIBVIR_VERSION_NUMBER>=9003 PHP_FUNCTION(libvirt_node_get_cpu_stats) { php_libvirt_connection *conn=NULL; @@ -1812,13 +1797,6 @@ PHP_FUNCTION(libvirt_node_get_cpu_stats) free(params); params = NULL; } -#else -PHP_FUNCTION(libvirt_node_get_cpu_stats) -{ - set_error("Function is not supported by libvirt, support has been added in libvirt 0.9.3" TSRMLS_CC); - RETURN_FALSE; -} -#endif /* * Function name: libvirt_node_get_cpu_stats_for_each_cpu @@ -1828,7 +1806,6 @@ PHP_FUNCTION(libvirt_node_get_cpu_stats) * @time [int]: time in seconds to get the information about, without aggregation for further processing * Returns: array of node CPU statistics for each CPU including time (in seconds since UNIX epoch), cpu number and total number of CPUs on node or FALSE for error */ -#if LIBVIR_VERSION_NUMBER>=9003 PHP_FUNCTION(libvirt_node_get_cpu_stats_for_each_cpu) { php_libvirt_connection *conn=NULL; @@ -1919,13 +1896,6 @@ PHP_FUNCTION(libvirt_node_get_cpu_stats_for_each_cpu) free(params); params = NULL; } -#else -PHP_FUNCTION(libvirt_node_get_cpu_stats_for_each_cpu) -{ - set_error("Function is not supported by libvirt, support has been added in libvirt 0.9.3" TSRMLS_CC); - RETURN_FALSE; -} -#endif /* * Function name: libvirt_node_get_mem_stats @@ -1934,7 +1904,6 @@ PHP_FUNCTION(libvirt_node_get_cpu_stats_for_each_cpu) * Arguments: @conn [resource]: resource for connection * Returns: array of node memory statistics including time (in seconds since UNIX epoch) or FALSE for error */ -#if LIBVIR_VERSION_NUMBER>=9003 PHP_FUNCTION(libvirt_node_get_mem_stats) { php_libvirt_connection *conn=NULL; @@ -1976,13 +1945,6 @@ PHP_FUNCTION(libvirt_node_get_mem_stats) free(params); params = NULL; } -#else -PHP_FUNCTION(libvirt_node_get_mem_stats) -{ - set_error("Function is not supported by libvirt, support has been added in libvirt 0.9.3" TSRMLS_CC); - RETURN_FALSE; -} -#endif //virsh capabilities | xpath '//capabilities/guest/arch[@name="x86_64"]/machine[@maxCpus=1]' @@ -2533,7 +2495,6 @@ PHP_FUNCTION(libvirt_connect_get_maxvcpus) * Arguments: @conn [resource]: resource for connection * Returns: XML description of system information from the connection or FALSE for error */ -#if LIBVIR_VERSION_NUMBER>=8008 PHP_FUNCTION(libvirt_connect_get_sysinfo) { php_libvirt_connection *conn=NULL; @@ -2550,13 +2511,6 @@ PHP_FUNCTION(libvirt_connect_get_sysinfo) RETURN_STRING(sysinfo_out,0); } -#else -PHP_FUNCTION(libvirt_connect_get_sysinfo) -{ - set_error("Only libvirt 0.8.8 or higher supports virConnectGetSysinfo() API function" TSRMLS_CC); - RETURN_FALSE; -} -#endif /* * Private function name: get_string_from_xpath @@ -3994,7 +3948,6 @@ static int streamSink(virStreamPtr st ATTRIBUTE_UNUSED, * @screenID [int]: monitor ID from where to take screenshot * Returns: array of filename and mime type as type is hypervisor specific, caller is responsible for temporary file deletion */ -#if LIBVIR_VERSION_NUMBER>=9002 PHP_FUNCTION(libvirt_domain_get_screenshot_api) { php_libvirt_domain *domain=NULL; @@ -4068,13 +4021,6 @@ PHP_FUNCTION(libvirt_domain_get_screenshot_api) add_assoc_string_ex(return_value, "mime", 5, mime, 1); } } -#else -PHP_FUNCTION(libvirt_domain_get_screenshot_api) -{ - set_error("Function is not supported by libvirt, you need at least libvirt 0.9.2 to support this function" TSRMLS_CC); - RETURN_FALSE; -} -#endif /* * Function name: libvirt_domain_get_screenshot @@ -6039,7 +5985,6 @@ PHP_FUNCTION(libvirt_domain_memory_peek) * Arguments: @res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*() * Returns: domain memory stats array (same fields as virDomainMemoryStats, please see libvirt documentation) */ -#if LIBVIR_VERSION_NUMBER>=7005 PHP_FUNCTION(libvirt_domain_memory_stats) { php_libvirt_domain *domain=NULL; @@ -6062,12 +6007,6 @@ PHP_FUNCTION(libvirt_domain_memory_stats) LONGLONG_INDEX(return_value, stats[i].tag,stats[i].val) } } -#else -PHP_FUNCTION(libvirt_domain_memory_stats) -{ - set_error("Only libvirt 0.7.5 and higher supports getting the job information" TSRMLS_CC); -} -#endif /* * Function name: libvirt_domain_update_device @@ -6078,7 +6017,6 @@ PHP_FUNCTION(libvirt_domain_memory_stats) * @flags [int]: Flags to update the device (VIR_DOMAIN_DEVICE_MODIFY_CURRENT, VIR_DOMAIN_DEVICE_MODIFY_LIVE, VIR_DOMAIN_DEVICE_MODIFY_CONFIG, VIR_DOMAIN_DEVICE_MODIFY_FORCE) * Returns: TRUE for success, FALSE on error */ -#if LIBVIR_VERSION_NUMBER>=8000 PHP_FUNCTION(libvirt_domain_update_device) { php_libvirt_domain *domain=NULL; @@ -6097,12 +6035,6 @@ PHP_FUNCTION(libvirt_domain_update_device) RETURN_TRUE; } -#else -PHP_FUNCTION(libvirt_domain_update_device) -{ - set_error("Only libvirt 0.8.0 and higher supports updating the device information" TSRMLS_CC); -} -#endif /* * Function name: libvirt_domain_block_stats @@ -6282,7 +6214,6 @@ PHP_FUNCTION(libvirt_domain_get_network_info) * @dev [string]: device to get block information about * Returns: domain block device information array of device, file or partition, capacity, allocation and physical size */ -#if LIBVIR_VERSION_NUMBER>=8000 PHP_FUNCTION(libvirt_domain_get_block_info) { php_libvirt_domain *domain=NULL; @@ -6354,13 +6285,6 @@ PHP_FUNCTION(libvirt_domain_get_block_info) LONGLONG_ASSOC(return_value, "allocation", info.allocation); LONGLONG_ASSOC(return_value, "physical", info.physical); } -#else -PHP_FUNCTION(libvirt_domain_get_block_info) -{ - set_error("Only libvirt 0.8.0 and higher supports getting the block information" TSRMLS_CC); - RETURN_FALSE; -} -#endif /* * Function name: libvirt_domain_xml_xpath @@ -6610,7 +6534,6 @@ PHP_FUNCTION(libvirt_domain_migrate) * Arguments: @res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*() * Returns: job information array of type, time, data, mem and file fields */ -#if LIBVIR_VERSION_NUMBER>=7007 PHP_FUNCTION(libvirt_domain_get_job_info) { php_libvirt_domain *domain=NULL; @@ -6639,15 +6562,7 @@ PHP_FUNCTION(libvirt_domain_get_job_info) LONGLONG_ASSOC(return_value, "file_processed", jobinfo.fileProcessed); LONGLONG_ASSOC(return_value, "file_remaining", jobinfo.fileRemaining); } -#else -PHP_FUNCTION(libvirt_domain_get_job_info) -{ - set_error("Only libvirt 0.7.7 and higher supports getting the job information" TSRMLS_CC); - RETURN_FALSE; -} -#endif -#if LIBVIR_VERSION_NUMBER>=8000 /* * Function name: libvirt_domain_has_current_snapshot * Since version: 0.4.1(-2) @@ -6835,49 +6750,6 @@ PHP_FUNCTION(libvirt_list_domain_snapshots) } efree(names); } -#else -PHP_FUNCTION(libvirt_domain_has_current_snapshot) -{ - set_error("Only libvirt 0.8.0 and higher support snapshots" TSRMLS_CC); - RETURN_FALSE; -} - -PHP_FUNCTION(libvirt_domain_snapshot_create) -{ - set_error("Only libvirt 0.8.0 and higher support snapshots" TSRMLS_CC); - RETURN_FALSE; -} - -PHP_FUNCTION(libvirt_domain_snapshot_get_xml) -{ - set_error("Only libvirt 0.8.0 and higher support snapshots" TSRMLS_CC); - RETURN_FALSE; -} - -PHP_FUNCTION(libvirt_domain_snapshot_lookup_by_name) -{ - set_error("Only libvirt 0.8.0 and higher support snapshots" TSRMLS_CC); - RETURN_FALSE; -} - -PHP_FUNCTION(libvirt_domain_snapshot_revert) -{ - set_error("Only libvirt 0.8.0 and higher support snapshots" TSRMLS_CC); - RETURN_FALSE; -} - -PHP_FUNCTION(libvirt_domain_snapshot_delete) -{ - set_error("Only libvirt 0.8.0 and higher support snapshots" TSRMLS_CC); - RETURN_FALSE; -} - -PHP_FUNCTION(libvirt_list_domain_snapshots) -{ - set_error("Only libvirt 0.8.0 and higher support snapshots" TSRMLS_CC); - RETURN_FALSE; -} -#endif /* Storagepool functions */ diff --git a/src/libvirt-php.h b/src/libvirt-php.h index 4f25705..8dc5927 100644 --- a/src/libvirt-php.h +++ b/src/libvirt-php.h @@ -268,12 +268,10 @@ typedef struct _php_libvirt_domain { php_libvirt_connection* conn; } php_libvirt_domain; -#if LIBVIR_VERSION_NUMBER>=8000 typedef struct _php_libvirt_snapshot { virDomainSnapshotPtr snapshot; php_libvirt_domain* domain; } php_libvirt_snapshot; -#endif typedef struct _php_libvirt_network { virNetworkPtr network; @@ -322,9 +320,7 @@ int gdebug; #define PHP_LIBVIRT_VOLUME_RES_NAME "Libvirt volume" #define PHP_LIBVIRT_NETWORK_RES_NAME "Libvirt virtual network" #define PHP_LIBVIRT_NODEDEV_RES_NAME "Libvirt node device" -#if LIBVIR_VERSION_NUMBER>=8000 #define PHP_LIBVIRT_SNAPSHOT_RES_NAME "Libvirt domain snapshot" -#endif PHP_MINIT_FUNCTION(libvirt); PHP_MSHUTDOWN_FUNCTION(libvirt); -- 2.3.6

On Fri, Jun 26, 2015 at 11:06:12AM +0200, Michal Privoznik wrote:
There's is a spec file within the sources, but it's outdated and doesn't work. However, in order to fix it, couple of other places need fixing too.
Michal Privoznik (8): configure: Prefer /bin/echo before printf Distribute the spec file too configure: Fix build with --prefix Makefile: Introduce 'rpm' target libvirt-php.spec: Don't run configure twice libvirt-php.spec.in: Drop spaces at EOL libvirt-php.spec.in: Cleanup Require newer libvirt
ACK all Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Michal Privoznik