diff options
author | Remi Collet <remi@remirepo.net> | 2023-10-12 14:12:40 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2023-10-12 14:12:40 +0200 |
commit | 16192a25a02e72eee26009f47bf85e0644ac3daf (patch) | |
tree | 0eb1cc1e384cc21cb803abb19968d24c4d28c665 | |
parent | 9104d986ab93577575eab6cc7c750b1adb84b46a (diff) |
stream require librpm 4.13
-rw-r--r-- | config.m4 | 1 | ||||
-rw-r--r-- | rpminfo.c | 13 | ||||
-rw-r--r-- | tests/014-stream.phpt | 5 |
3 files changed, 18 insertions, 1 deletions
@@ -16,6 +16,7 @@ if test "$PHP_RPMINFO" != "no"; then LIBRPM_VERSON=`$PKG_CONFIG rpm --modversion` AC_MSG_RESULT(from pkgconfig: version $LIBRPM_VERSON) if $PKG_CONFIG rpm --atleast-version 4.13; then + AC_DEFINE(HAVE_ARCHIVE, 1, [ Archive reader since RPM 4.13 ]) AC_DEFINE(HAVE_WEAKDEP, 1, [ Indexes on weak dependency field since RPM 4.13 ]) fi else @@ -35,6 +35,7 @@ #include "rpminfo_arginfo.h" +#ifdef HAVE_ARCHIVE struct php_rpm_stream_data_t { FD_t gzdi; Header h; @@ -45,6 +46,7 @@ struct php_rpm_stream_data_t { #define STREAM_DATA_FROM_STREAM() \ struct php_rpm_stream_data_t *self = (struct php_rpm_stream_data_t *) stream->abstract; +#endif ZEND_DECLARE_MODULE_GLOBALS(rpminfo) @@ -573,6 +575,7 @@ PHP_FUNCTION(rpmaddtag) } /* }}} */ +#ifdef HAVE_ARCHIVE static ssize_t php_rpm_ops_read(php_stream *stream, char *buf, size_t count) { ssize_t n = -1; @@ -736,6 +739,9 @@ const php_stream_wrapper php_stream_rpm_wrapper = { NULL, 0 /* is_url */ }; +#endif + + /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(rpminfo) @@ -781,7 +787,9 @@ PHP_MINIT_FUNCTION(rpminfo) } rpmtdFree(names); +#ifdef HAVE_ARCHIVE php_register_url_stream_wrapper("rpm", &php_stream_rpm_wrapper); +#endif return SUCCESS; } @@ -835,6 +843,11 @@ PHP_MINFO_FUNCTION(rpminfo) php_info_print_table_header(2, "rpminfo support", "enabled"); php_info_print_table_row(2, "Extension version", PHP_RPMINFO_VERSION); php_info_print_table_row(2, "RPM library version", RPMVERSION); +#ifdef HAVE_ARCHIVE + php_info_print_table_row(2, "RPM stream wrapper", "yes"); +#else + php_info_print_table_row(2, "RPM stream wrapper", "no"); +#endif php_info_print_table_end(); /* Remove comments if you have entries in php.ini diff --git a/tests/014-stream.phpt b/tests/014-stream.phpt index 5a4fefa..e8650f7 100644 --- a/tests/014-stream.phpt +++ b/tests/014-stream.phpt @@ -1,7 +1,10 @@ --TEST-- Check for stream --SKIPIF-- -<?php if (!extension_loaded("rpminfo")) print "skip"; ?> +<?php +if (!extension_loaded("rpminfo")) print "skip"; +if (version_compare(RPMVERSION, '4.13', 'lt')) print("skip librpm is older than 4.13"); +?> --FILE-- <?php $n = "rpm://" . __DIR__ . "/bidon.rpm#/usr/share/doc/bidon/README"; |