- improve system libzip patch

Move private API functions in a separate file.
Only libzip 0.10.x is supported for now
This commit is contained in:
Remi Collet 2013-08-08 09:53:00 +02:00
parent 1c7dc6a051
commit 760d6a2614
2 changed files with 44 additions and 30 deletions

View File

@ -1,6 +1,6 @@
diff -up php5.5-201304181030/ext/zip/config.m4.systzip php5.5-201304181030/ext/zip/config.m4 diff -up php-5.5.2RC1/ext/zip/config.m4.systzip php-5.5.2RC1/ext/zip/config.m4
--- php5.5-201304181030/ext/zip/config.m4.systzip 2012-12-05 11:40:39.000000000 +0100 --- php-5.5.2RC1/ext/zip/config.m4.systzip 2013-07-31 10:41:15.000000000 +0200
+++ php5.5-201304181030/ext/zip/config.m4 2013-04-18 13:17:32.144550036 +0200 +++ php-5.5.2RC1/ext/zip/config.m4 2013-08-08 09:24:07.577567241 +0200
@@ -13,65 +13,116 @@ fi @@ -13,65 +13,116 @@ fi
PHP_ARG_WITH(pcre-dir, pcre install prefix, PHP_ARG_WITH(pcre-dir, pcre install prefix,
[ --with-pcre-dir ZIP: pcre install prefix], no, no) [ --with-pcre-dir ZIP: pcre install prefix], no, no)
@ -175,17 +175,10 @@ diff -up php5.5-201304181030/ext/zip/config.m4.systzip php5.5-201304181030/ext/z
dnl so we always include the known-good working hack. dnl so we always include the known-good working hack.
PHP_ADD_MAKEFILE_FRAGMENT PHP_ADD_MAKEFILE_FRAGMENT
diff -up php5.5-201304181030/ext/zip/php_zip.c.systzip php5.5-201304181030/ext/zip/php_zip.c diff -up php-5.5.2RC1/ext/zip/libzip-missing-0.10.h.systzip php-5.5.2RC1/ext/zip/libzip-missing-0.10.h
--- php5.5-201304181030/ext/zip/php_zip.c.systzip 2013-04-10 22:36:34.000000000 +0200 --- php-5.5.2RC1/ext/zip/libzip-missing-0.10.h.systzip 2013-08-08 09:34:53.338910267 +0200
+++ php5.5-201304181030/ext/zip/php_zip.c 2013-04-18 13:23:29.997871990 +0200 +++ php-5.5.2RC1/ext/zip/libzip-missing-0.10.h 2013-08-08 09:26:21.244072278 +0200
@@ -30,8 +30,233 @@ @@ -0,0 +1,219 @@
#include "ext/pcre/php_pcre.h"
#include "ext/standard/php_filestat.h"
#include "php_zip.h"
+
+#if defined(HAVE_LIBZIP)
+#include <zip.h>
+
+/* Copied from libzip 0.10 */ +/* Copied from libzip 0.10 */
+ +
+/* state of change of a file in zip archive */ +/* state of change of a file in zip archive */
@ -405,6 +398,23 @@ diff -up php5.5-201304181030/ext/zip/php_zip.c.systzip php5.5-201304181030/ext/z
+} +}
+ +
+ +
diff -up php-5.5.2RC1/ext/zip/php_zip.c.systzip php-5.5.2RC1/ext/zip/php_zip.c
--- php-5.5.2RC1/ext/zip/php_zip.c.systzip 2013-07-31 10:41:15.000000000 +0200
+++ php-5.5.2RC1/ext/zip/php_zip.c 2013-08-08 09:33:59.367735224 +0200
@@ -30,8 +30,20 @@
#include "ext/pcre/php_pcre.h"
#include "ext/standard/php_filestat.h"
#include "php_zip.h"
+
+#if defined(HAVE_LIBZIP)
+#include <zip.h>
+
+#if LIBZIP_VERSION_MAJOR == 0 && LIBZIP_VERSION_MINOR == 10
+#include "libzip-missing-0.10.h"
+#else
+#error "Only libzip 0.10 supported for now"
+#endif
+
+#else +#else
#include "lib/zip.h" #include "lib/zip.h"
#include "lib/zipint.h" #include "lib/zipint.h"
@ -412,7 +422,7 @@ diff -up php5.5-201304181030/ext/zip/php_zip.c.systzip php5.5-201304181030/ext/z
/* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */ /* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */
static PHP_NAMED_FUNCTION(zif_zip_open); static PHP_NAMED_FUNCTION(zif_zip_open);
@@ -1631,6 +1856,10 @@ static ZIPARCHIVE_METHOD(addEmptyDir) @@ -1631,6 +1643,10 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
} }
idx = zip_stat(intern, s, 0, &sb); idx = zip_stat(intern, s, 0, &sb);
@ -423,7 +433,7 @@ diff -up php5.5-201304181030/ext/zip/php_zip.c.systzip php5.5-201304181030/ext/z
if (idx >= 0) { if (idx >= 0) {
RETVAL_FALSE; RETVAL_FALSE;
} else { } else {
@@ -1853,6 +2082,10 @@ static ZIPARCHIVE_METHOD(addFromString) @@ -1853,6 +1869,10 @@ static ZIPARCHIVE_METHOD(addFromString)
} }
cur_idx = zip_name_locate(intern, (const char *)name, 0); cur_idx = zip_name_locate(intern, (const char *)name, 0);
@ -434,7 +444,7 @@ diff -up php5.5-201304181030/ext/zip/php_zip.c.systzip php5.5-201304181030/ext/z
/* TODO: fix _zip_replace */ /* TODO: fix _zip_replace */
if (cur_idx >= 0) { if (cur_idx >= 0) {
if (zip_delete(intern, cur_idx) == -1) { if (zip_delete(intern, cur_idx) == -1) {
@@ -2877,5 +3110,9 @@ static PHP_MINFO_FUNCTION(zip)9 @@ -2877,5 +2897,9 @@ static PHP_MINFO_FUNCTION(zip)
php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING); php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING);
- php_info_print_table_row(2, "Libzip version", LIBZIP_VERSION); - php_info_print_table_row(2, "Libzip version", LIBZIP_VERSION);
+#if defined(HAVE_LIBZIP) +#if defined(HAVE_LIBZIP)
@ -445,9 +455,9 @@ diff -up php5.5-201304181030/ext/zip/php_zip.c.systzip php5.5-201304181030/ext/z
php_info_print_table_end(); php_info_print_table_end();
} }
diff -up php5.5-201304181030/ext/zip/php_zip.h.systzip php5.5-201304181030/ext/zip/php_zip.h diff -up php-5.5.2RC1/ext/zip/php_zip.h.systzip php-5.5.2RC1/ext/zip/php_zip.h
--- php5.5-201304181030/ext/zip/php_zip.h.systzip 2013-01-01 11:36:17.000000000 +0100 --- php-5.5.2RC1/ext/zip/php_zip.h.systzip 2013-07-31 10:41:15.000000000 +0200
+++ php5.5-201304181030/ext/zip/php_zip.h 2013-04-18 13:17:32.147550046 +0200 +++ php-5.5.2RC1/ext/zip/php_zip.h 2013-08-08 09:24:07.579567249 +0200
@@ -28,7 +28,11 @@ extern zend_module_entry zip_module_entr @@ -28,7 +28,11 @@ extern zend_module_entry zip_module_entr
#include "TSRM.h" #include "TSRM.h"
#endif #endif
@ -460,9 +470,9 @@ diff -up php5.5-201304181030/ext/zip/php_zip.h.systzip php5.5-201304181030/ext/z
#define PHP_ZIP_VERSION_STRING "1.11.0" #define PHP_ZIP_VERSION_STRING "1.11.0"
diff -up php5.5-201304181030/ext/zip/tests/bug38943.phpt.systzip php5.5-201304181030/ext/zip/tests/bug38943.phpt diff -up php-5.5.2RC1/ext/zip/tests/bug38943.phpt.systzip php-5.5.2RC1/ext/zip/tests/bug38943.phpt
--- php5.5-201304181030/ext/zip/tests/bug38943.phpt.systzip 2012-12-05 11:40:39.000000000 +0100 --- php-5.5.2RC1/ext/zip/tests/bug38943.phpt.systzip 2013-07-31 10:41:15.000000000 +0200
+++ php5.5-201304181030/ext/zip/tests/bug38943.phpt 2013-04-18 13:17:32.147550046 +0200 +++ php-5.5.2RC1/ext/zip/tests/bug38943.phpt 2013-08-08 09:24:07.579567249 +0200
@@ -27,7 +27,7 @@ array(1) { @@ -27,7 +27,7 @@ array(1) {
[0]=> [0]=>
int(1) int(1)
@ -472,9 +482,9 @@ diff -up php5.5-201304181030/ext/zip/tests/bug38943.phpt.systzip php5.5-20130418
["test":"myZip":private]=> ["test":"myZip":private]=>
int(0) int(0)
["testp"]=> ["testp"]=>
diff -up php5.5-201304181030/ext/zip/tests/pecl12414.phpt.systzip php5.5-201304181030/ext/zip/tests/pecl12414.phpt diff -up php-5.5.2RC1/ext/zip/tests/pecl12414.phpt.systzip php-5.5.2RC1/ext/zip/tests/pecl12414.phpt
--- php5.5-201304181030/ext/zip/tests/pecl12414.phpt.systzip 2012-12-05 11:40:39.000000000 +0100 --- php-5.5.2RC1/ext/zip/tests/pecl12414.phpt.systzip 2013-07-31 10:41:15.000000000 +0200
+++ php5.5-201304181030/ext/zip/tests/pecl12414.phpt 2013-04-18 13:17:32.148550050 +0200 +++ php-5.5.2RC1/ext/zip/tests/pecl12414.phpt 2013-08-08 09:24:07.579567249 +0200
@@ -5,6 +5,8 @@ Bug #12414 ( extracting files from damag @@ -5,6 +5,8 @@ Bug #12414 ( extracting files from damag
/*$ */ /*$ */
if(!extension_loaded('zip')) die('skip'); if(!extension_loaded('zip')) die('skip');
@ -484,9 +494,9 @@ diff -up php5.5-201304181030/ext/zip/tests/pecl12414.phpt.systzip php5.5-2013041
--FILE-- --FILE--
<?php <?php
$filename = 'MYLOGOV2.GFX'; $filename = 'MYLOGOV2.GFX';
diff -up php5.5-201304181030/ext/zip/zip_stream.c.systzip php5.5-201304181030/ext/zip/zip_stream.c diff -up php-5.5.2RC1/ext/zip/zip_stream.c.systzip php-5.5.2RC1/ext/zip/zip_stream.c
--- php5.5-201304181030/ext/zip/zip_stream.c.systzip 2012-12-05 11:40:39.000000000 +0100 --- php-5.5.2RC1/ext/zip/zip_stream.c.systzip 2013-07-31 10:41:15.000000000 +0200
+++ php5.5-201304181030/ext/zip/zip_stream.c 2013-04-18 13:17:32.149550054 +0200 +++ php-5.5.2RC1/ext/zip/zip_stream.c 2013-08-08 09:24:07.580567252 +0200
@@ -6,7 +6,11 @@ @@ -6,7 +6,11 @@
#if HAVE_ZIP #if HAVE_ZIP
#ifdef ZEND_ENGINE_2 #ifdef ZEND_ENGINE_2

View File

@ -69,7 +69,7 @@
Summary: PHP scripting language for creating dynamic web sites Summary: PHP scripting language for creating dynamic web sites
Name: php Name: php
Version: 5.5.1 Version: 5.5.1
Release: 2%{?dist} Release: 3%{?dist}
# All files licensed under PHP version 3.01, except # All files licensed under PHP version 3.01, except
# Zend is licensed under Zend # Zend is licensed under Zend
# TSRM is licensed under BSD # TSRM is licensed under BSD
@ -135,6 +135,7 @@ BuildRequires: bzip2, perl, libtool >= 1.4.3, gcc-c++
BuildRequires: libtool-ltdl-devel BuildRequires: libtool-ltdl-devel
%if %{with_libzip} %if %{with_libzip}
BuildRequires: libzip-devel >= 0.10 BuildRequires: libzip-devel >= 0.10
BuildRequires: libzip-devel < 0.11
%endif %endif
%if %{with_dtrace} %if %{with_dtrace}
BuildRequires: systemtap-sdt-devel BuildRequires: systemtap-sdt-devel
@ -1536,6 +1537,9 @@ exit 0
%changelog %changelog
* Thu Aug 08 2013 Remi Collet <rcollet@redhat.com> - 5.5.1-3
- improve system libzip patch
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.5.1-2 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild