From f96ced4d79a301ba1f13859b0bee5303ff5200bc Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 23 Oct 2013 08:31:25 +0200 Subject: [PATCH] - update to 1.12.2 - drop merged patches - install doc in pecl doc_dir - install tests in pecl test_dir --- .gitignore | 3 + php-pecl-zip.spec | 63 ++++----- sources | 2 +- zip-git.patch | 292 ----------------------------------------- zip-systemlibzip.patch | 116 ---------------- 5 files changed, 26 insertions(+), 450 deletions(-) delete mode 100644 zip-git.patch delete mode 100644 zip-systemlibzip.patch diff --git a/.gitignore b/.gitignore index 3dac85c..c963b40 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ +clog +php-pecl-zip.spec~ /zip-1.12.1.tgz +/zip-1.12.2.tgz diff --git a/php-pecl-zip.spec b/php-pecl-zip.spec index 21a523a..e14d076 100644 --- a/php-pecl-zip.spec +++ b/php-pecl-zip.spec @@ -7,39 +7,21 @@ # Please, preserve the changelog entries # %global pecl_name zip -%if 0%{?fedora} >= 20 -%global with_libzip 1 -%else -%global with_libzip 0 -%endif %global with_zts 0%{?__ztsphp:1} Summary: A ZIP archive management extension Summary(fr): Une extension de gestion des ZIP Name: php-pecl-zip -Version: 1.12.1 -Release: 5%{?dist} -%if %{with_libzip} +Version: 1.12.2 +Release: 1%{?dist} License: PHP -%else -# Zip extension is PHP, Libzip library is BSD -License: PHP and BSD -%endif Group: Development/Languages URL: http://pecl.php.net/package/zip Source: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz -# https://github.com/pierrejoye/php_zip/pull/3 (merged) -# Cleanups and fix build warnings -Patch0: zip-git.patch -# use system libzip 0.11 instead of bundled copy -Patch1: zip-systemlibzip.patch - BuildRequires: php-devel -%if %{with_libzip} BuildRequires: pkgconfig(libzip) >= 0.11.1 -%endif BuildRequires: zlib-devel BuildRequires: php-pear @@ -53,10 +35,6 @@ Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} Provides: php-%{pecl_name} = %{version}-%{release} Provides: php-%{pecl_name}%{?_isa} = %{version}-%{release} -# Filter private shared -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} - %description Zip is an extension to create and read zip files. @@ -70,16 +48,8 @@ Zip est une extension pour créer et lire les archives au format ZIP. cd %{pecl_name}-%{version} -%patch0 -p1 -b .git - -%if %{with_libzip} -%patch1 -p1 -b .systemlibzip # delete bundled libzip to ensure it is not used (except zipint.h) rm lib/*.c -%endif - -# make rpmlint happy (fixed in upstream git) -find . -type f -exec chmod -x {} \; cd .. : Create the configuration file @@ -95,14 +65,11 @@ cp -pr %{pecl_name}-%{version} %{pecl_name}-zts %build -export PHP_RPATH=no - cd %{pecl_name}-%{version} %{_bindir}/phpize %configure \ -%if %{with_libzip} --with-libzip \ -%endif + --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} @@ -111,9 +78,8 @@ make %{?_smp_mflags} cd ../%{pecl_name}-zts %{_bindir}/zts-phpize %configure \ -%if %{with_libzip} --with-libzip \ -%endif + --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} @@ -132,6 +98,15 @@ make -C %{pecl_name}-zts install INSTALL_ROOT=%{buildroot} install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini %endif +# Test & Documentation +cd %{pecl_name}-%{version} +for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i +done +for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + %check cd %{pecl_name}-%{version} @@ -162,7 +137,7 @@ TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ NO_INTERACTION=1 \ TEST_PHP_EXECUTABLE=%{_bindir}/zts-php \ -%{_bindir}/php \ +%{_bindir}/zts-php \ run-tests.php %endif @@ -178,8 +153,8 @@ fi %files -%doc %{pecl_name}-%{version}/{CREDITS,LICENSE} -%doc %{pecl_name}-%{version}/examples +%doc %{pecl_docdir}/%{pecl_name} +%doc %{pecl_testdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{pecl_name}.ini %{php_extdir}/%{pecl_name}.so @@ -191,6 +166,12 @@ fi %changelog +* Wed Oct 23 2013 Remi Collet 1.12.2-1 +- update to 1.12.2 +- drop merged patches +- install doc in pecl doc_dir +- install tests in pecl test_dir + * Thu Aug 22 2013 Remi Collet 1.12.1-5 - really really fix all spurious-executable-perm diff --git a/sources b/sources index 29ecdc4..56da93b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0df3d8ed7d652ffc4447a62cb7de84f0 zip-1.12.1.tgz +f7aa2b0ebd257c66f81844d17b88eeff zip-1.12.2.tgz diff --git a/zip-git.patch b/zip-git.patch deleted file mode 100644 index 6fffdfd..0000000 --- a/zip-git.patch +++ /dev/null @@ -1,292 +0,0 @@ -From 739f7ace12455b589f464f3d72eb809be950f0a1 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 8 Aug 2013 14:03:25 +0200 -Subject: [PATCH 1/6] drop PCRE test (not used, php_zip_pcre is unconditionaly - defined) - ---- - config.m4 | 24 ------------------------ - 1 file changed, 24 deletions(-) - -diff --git a/config.m4 b/config.m4 -index edf0d2a..aade73d 100755 ---- a/config.m4 -+++ b/config.m4 -@@ -47,30 +47,6 @@ if test "$PHP_ZIP" != "no"; then - PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR) - fi - -- dnl This is PECL build, check if bundled PCRE library is used -- old_CPPFLAGS=$CPPFLAGS -- CPPFLAGS=$INCLUDES -- AC_EGREP_CPP(yes,[ --#include
--#if defined(HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE) --yes --#endif -- ],[ -- PHP_PCRE_REGEX=yes -- ],[ -- AC_EGREP_CPP(yes,[ --#include
--#if defined(HAVE_PCRE) && !defined(COMPILE_DL_PCRE) --yes --#endif -- ],[ -- PHP_PCRE_REGEX=pecl -- ],[ -- PHP_PCRE_REGEX=no -- ]) -- ]) -- CPPFLAGS=$old_CPPFLAGS -- - PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_add_dir.c lib/zip_add_entry.c\ - lib/zip_close.c lib/zip_delete.c lib/zip_dir_add.c lib/zip_dirent.c lib/zip_discard.c lib/zip_entry.c\ - lib/zip_err_str.c lib/zip_error.c lib/zip_error_clear.c lib/zip_error_get.c lib/zip_error_get_sys_type.c\ --- -1.8.1.6 - - -From 09986e947ff8452affb1ae709d0e93dbd112f078 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 8 Aug 2013 14:04:23 +0200 -Subject: [PATCH 2/6] drop duplicate include (already in php_zip.h) - ---- - zip_stream.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/zip_stream.c b/zip_stream.c -index 400edd6..dde5c0b 100755 ---- a/zip_stream.c -+++ b/zip_stream.c -@@ -6,8 +6,6 @@ - #if HAVE_ZIP - #ifdef ZEND_ENGINE_2 - --#include "lib/zip.h" -- - #include "php_streams.h" - #include "ext/standard/file.h" - #include "ext/standard/php_string.h" --- -1.8.1.6 - - -From b06d3de0b7b8e2ea09d55c24b7661f894b70eba2 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 8 Aug 2013 14:05:00 +0200 -Subject: [PATCH 3/6] drop duplicate include (already in php_zip.h) - ---- - php_zip.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/php_zip.c b/php_zip.c -index 8969397..42e9dd1 100755 ---- a/php_zip.c -+++ b/php_zip.c -@@ -30,7 +30,6 @@ - #include "ext/standard/php_string.h" - #include "ext/pcre/php_pcre.h" - #include "php_zip.h" --#include "lib/zip.h" - #include "lib/zipint.h" - - /* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */ --- -1.8.1.6 - - -From 600220bc9a4e1f4488612b47ec26cbe99c7d88dc Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 8 Aug 2013 14:06:08 +0200 -Subject: [PATCH 4/6] fix warning: variable 'file' set but not used - [-Wunused-but-set-variable] - ---- - php_zip.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/php_zip.c b/php_zip.c -index 42e9dd1..36bf8cc 100755 ---- a/php_zip.c -+++ b/php_zip.c -@@ -1727,13 +1727,12 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* - zval **zval_file = NULL; - - for (i = 0; i < found; i++) { -- char *file, *file_stripped, *entry_name; -+ char *file_stripped, *entry_name; - size_t entry_name_len, file_stripped_len; - char entry_name_buf[MAXPATHLEN]; - char *basename = NULL; - - if (zend_hash_index_find(Z_ARRVAL_P(return_value), i, (void **) &zval_file) == SUCCESS) { -- file = Z_STRVAL_PP(zval_file); - if (remove_all_path) { - php_basename(Z_STRVAL_PP(zval_file), Z_STRLEN_PP(zval_file), NULL, 0, - &basename, (size_t *)&file_stripped_len TSRMLS_CC); --- -1.8.1.6 - - -From 3ceb0cc1e76338721634b07638c472d4e32f0fc8 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 8 Aug 2013 14:08:00 +0200 -Subject: [PATCH 5/6] warning: 'remove_path_len' may be used uninitialized in - this function [-Wmaybe-uninitialized] (just to make gcc happy) - ---- - php_zip.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/php_zip.c b/php_zip.c -index 36bf8cc..43bd062 100755 ---- a/php_zip.c -+++ b/php_zip.c -@@ -1678,7 +1678,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* - char *path = NULL; - char *remove_path = NULL; - char *add_path = NULL; -- int pattern_len, add_path_len, remove_path_len, path_len = 0; -+ int pattern_len, add_path_len, remove_path_len = 0, path_len = 0; - long remove_all_path = 0; - long flags = 0; - zval *options = NULL; --- -1.8.1.6 - - -From fe8c5bbddbb60c346474cabcdaa375df781000d0 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 8 Aug 2013 14:22:03 +0200 -Subject: [PATCH 6/6] use public zip_error_clear instead of private - _zip_error_clear - ---- - php_zip.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/php_zip.c b/php_zip.c -index 43bd062..2e97e84 100755 ---- a/php_zip.c -+++ b/php_zip.c -@@ -322,7 +322,7 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam - if (zip_file_add(za, entry_name, zs, ZIP_FL_OVERWRITE) < 0) { - return -1; - } else { -- _zip_error_clear(&za->error); -+ zip_error_clear(za); - return 1; - } - } -@@ -1660,7 +1660,7 @@ static ZIPARCHIVE_METHOD(addEmptyDir) - if (zip_add_dir(intern, (const char *)s) == -1) { - RETVAL_FALSE; - } -- _zip_error_clear(&intern->error); -+ zip_error_clear(intern); - RETVAL_TRUE; - } - -@@ -1886,7 +1886,7 @@ static ZIPARCHIVE_METHOD(addFromString) - if (zip_add(intern, name, zs) == -1) { - RETURN_FALSE; - } else { -- _zip_error_clear(&intern->error); -+ zip_error_clear(intern); - RETURN_TRUE; - } - } --- -1.8.1.6 - -From 04a2bb233459e9e4aa587341f83715839512b587 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 8 Aug 2013 15:08:14 +0200 -Subject: [PATCH] add LICENSE file - ---- - LICENSE | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - package.xml | 1 + - 2 files changed, 69 insertions(+) - create mode 100644 LICENSE - -diff --git a/LICENSE b/LICENSE -new file mode 100644 -index 0000000..42536af ---- /dev/null -+++ b/LICENSE -@@ -0,0 +1,68 @@ -+-------------------------------------------------------------------- -+ The PHP License, version 3.01 -+Copyright (c) 1999 - 2012 The PHP Group. All rights reserved. -+-------------------------------------------------------------------- -+ -+Redistribution and use in source and binary forms, with or without -+modification, is permitted provided that the following conditions -+are met: -+ -+ 1. Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ -+ 2. Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in -+ the documentation and/or other materials provided with the -+ distribution. -+ -+ 3. The name "PHP" must not be used to endorse or promote products -+ derived from this software without prior written permission. For -+ written permission, please contact group@php.net. -+ -+ 4. Products derived from this software may not be called "PHP", nor -+ may "PHP" appear in their name, without prior written permission -+ from group@php.net. You may indicate that your software works in -+ conjunction with PHP by saying "Foo for PHP" instead of calling -+ it "PHP Foo" or "phpfoo" -+ -+ 5. The PHP Group may publish revised and/or new versions of the -+ license from time to time. Each version will be given a -+ distinguishing version number. -+ Once covered code has been published under a particular version -+ of the license, you may always continue to use it under the terms -+ of that version. You may also choose to use such covered code -+ under the terms of any subsequent version of the license -+ published by the PHP Group. No one other than the PHP Group has -+ the right to modify the terms applicable to covered code created -+ under this License. -+ -+ 6. Redistributions of any form whatsoever must retain the following -+ acknowledgment: -+ "This product includes PHP software, freely available from -+ ". -+ -+THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND -+ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP -+DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -+OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+-------------------------------------------------------------------- -+ -+This software consists of voluntary contributions made by many -+individuals on behalf of the PHP Group. -+ -+The PHP Group can be contacted via Email at group@php.net. -+ -+For more information on the PHP Group and the PHP project, -+please see . -+ -+PHP includes the Zend Engine, freely available at -+. --- -1.8.1.6 - diff --git a/zip-systemlibzip.patch b/zip-systemlibzip.patch deleted file mode 100644 index a8a4158..0000000 --- a/zip-systemlibzip.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 4265dac56d5c869163a66ceb85a07ebac4b46217 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 20 Aug 2013 15:17:57 +0200 -Subject: [PATCH] allow to build using system libzip 0.11 (using --with-libzip - option) - ---- - config.m4 | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - php_zip.c | 1 + - php_zip.h | 4 ++++ - 3 files changed, 58 insertions(+) - -diff --git a/config.m4 b/config.m4 -index aade73d..85b94cc 100755 ---- a/config.m4 -+++ b/config.m4 -@@ -13,8 +13,60 @@ fi - PHP_ARG_WITH(pcre-dir, pcre install prefix, - [ --with-pcre-dir ZIP: pcre install prefix], no, no) - -+PHP_ARG_WITH(libzip, libzip, -+[ --with-libzip[=DIR] ZIP: use libzip], no, no) -+ - if test "$PHP_ZIP" != "no"; then - -+ if test "$PHP_LIBZIP" != "no"; then -+ -+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) -+ -+ dnl system libzip, depends on libzip -+ AC_MSG_CHECKING(for libzip) -+ if test -r $PHP_LIBZIP/include/zip.h; then -+ LIBZIP_CFLAGS="-I$PHP_LIBZIP/include" -+ LIBZIP_LIBDIR="$PHP_LIBZIP/$PHP_LIBDIR" -+ AC_MSG_RESULT(from option: found in $PHP_LIBZIP) -+ -+ elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libzip; then -+ LIBZIP_CFLAGS=`$PKG_CONFIG libzip --cflags` -+ LIBZIP_LIBDIR=`$PKG_CONFIG libzip --variable=libdir` -+ AC_MSG_RESULT(from pkgconfig: found in $LIBZIP_LIBDIR) -+ -+ else -+ for i in /usr/local /usr; do -+ if test -r $i/include/zip.h; then -+ LIBZIP_CFLAGS="-I$i/include" -+ LIBZIP_LIBDIR="$i/$PHP_LIBDIR" -+ AC_MSG_RESULT(in default path: found in $i) -+ break -+ fi -+ done -+ fi -+ -+ if test -z "$LIBZIP_LIBDIR"; then -+ AC_MSG_RESULT(not found) -+ AC_MSG_ERROR(Please reinstall the libzip distribution) -+ fi -+ -+ dnl Could not think of a simple way to check libzip for overwrite support -+ PHP_CHECK_LIBRARY(zip, zip_open, -+ [ -+ PHP_ADD_LIBRARY_WITH_PATH(zip, $LIBZIP_LIBDIR, ZIP_SHARED_LIBADD) -+ AC_DEFINE(HAVE_LIBZIP,1,[ ]) -+ ], [ -+ AC_MSG_ERROR(could not find usable libzip) -+ ], [ -+ -L$LIBZIP_LIBDIR -+ ]) -+ -+ AC_DEFINE(HAVE_ZIP,1,[ ]) -+ PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c, $ext_shared,, $LIBZIP_CFLAGS) -+ PHP_SUBST(ZIP_SHARED_LIBADD) -+ else -+ -+ dnl bundled libzip, depends on zlib - if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then - if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then - PHP_ZLIB_DIR="$PHP_ZLIB_DIR" -@@ -70,6 +122,7 @@ if test "$PHP_ZIP" != "no"; then - PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared) - PHP_ADD_BUILD_DIR($ext_builddir/lib, 1) - PHP_SUBST(ZIP_SHARED_LIBADD) -+fi - - - AC_CHECK_TYPES([int8_t]) -diff --git a/php_zip.c b/php_zip.c -index 2e97e84..d8cf7f2 100755 ---- a/php_zip.c -+++ b/php_zip.c -@@ -30,6 +30,7 @@ - #include "ext/standard/php_string.h" - #include "ext/pcre/php_pcre.h" - #include "php_zip.h" -+/* Private struct definition, always use bundled copy */ - #include "lib/zipint.h" - - /* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */ -diff --git a/php_zip.h b/php_zip.h -index d734284..deeb1b4 100755 ---- a/php_zip.h -+++ b/php_zip.h -@@ -28,7 +28,11 @@ - #include "TSRM.h" - #endif - -+#if defined(HAVE_LIBZIP) -+#include -+#else - #include "lib/zip.h" -+#endif - - #define PHP_ZIP_VERSION_STRING "1.12.1" - --- -1.8.1.6 -