diff --git a/.gitignore b/.gitignore index 0dc3473..a77e1ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ libzip-0.9.3.tar.bz2 +/libzip-0.10.tar.bz2 diff --git a/libzip-0.10-php.patch b/libzip-0.10-php.patch new file mode 100644 index 0000000..e3dea35 --- /dev/null +++ b/libzip-0.10-php.patch @@ -0,0 +1,87 @@ +diff -up libzip-0.10/lib/zip_close.c.php libzip-0.10/lib/zip_close.c +--- libzip-0.10/lib/zip_close.c.php 2011-02-20 09:01:03.000000000 -0500 ++++ libzip-0.10/lib/zip_close.c 2012-01-25 18:37:04.188136374 -0500 +@@ -602,13 +602,15 @@ _zip_create_temp_output(struct zip *za, + char *temp; + int tfd; + FILE *tfp; ++ ++ int len = strlen(za->zn) + 8; + +- if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) { ++ if ((temp=(char *)malloc(len)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + +- sprintf(temp, "%s.XXXXXX", za->zn); ++ snprintf(temp, len, "%s.XXXXXX", za->zn); + + if ((tfd=mkstemp(temp)) == -1) { + _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno); +diff -up libzip-0.10/lib/zip_fclose.c.php libzip-0.10/lib/zip_fclose.c +--- libzip-0.10/lib/zip_fclose.c.php 2010-03-08 07:27:48.000000000 -0500 ++++ libzip-0.10/lib/zip_fclose.c 2012-01-25 18:36:22.389542215 -0500 +@@ -47,12 +47,14 @@ zip_fclose(struct zip_file *zf) + if (zf->src) + zip_source_free(zf->src); + +- for (i=0; iza->nfile; i++) { +- if (zf->za->file[i] == zf) { +- zf->za->file[i] = zf->za->file[zf->za->nfile-1]; +- zf->za->nfile--; +- break; +- } ++ if (zf->za) { ++ for (i=0; iza->nfile; i++) { ++ if (zf->za->file[i] == zf) { ++ zf->za->file[i] = zf->za->file[zf->za->nfile-1]; ++ zf->za->nfile--; ++ break; ++ } ++ } + } + + ret = 0; +diff -up libzip-0.10/lib/zip.h.php libzip-0.10/lib/zip.h +--- libzip-0.10/lib/zip.h.php 2011-03-04 12:17:43.000000000 -0500 ++++ libzip-0.10/lib/zip.h 2012-01-25 18:36:22.389542215 -0500 +@@ -59,7 +59,7 @@ extern "C" { + #define ZIP_CREATE 1 + #define ZIP_EXCL 2 + #define ZIP_CHECKCONS 4 +- ++#define ZIP_OVERWRITE 8 + + /* flags for zip_name_locate, zip_fopen, zip_stat, ... */ + +diff -up libzip-0.10/lib/zip_open.c.php libzip-0.10/lib/zip_open.c +--- libzip-0.10/lib/zip_open.c.php 2011-03-16 07:18:44.000000000 -0400 ++++ libzip-0.10/lib/zip_open.c 2012-01-25 18:36:22.389542215 -0500 +@@ -61,10 +61,16 @@ ZIP_EXTERN struct zip * + zip_open(const char *fn, int flags, int *zep) + { + FILE *fp; ++ ++ if (flags & ZIP_OVERWRITE) { ++ return _zip_allocate_new(fn, zep); ++ } + + switch (_zip_file_exists(fn, flags, zep)) { + case -1: +- return NULL; ++ if (!(flags & ZIP_OVERWRITE)) { ++ return NULL; ++ } + case 0: + return _zip_allocate_new(fn, zep); + default: +@@ -482,7 +488,7 @@ _zip_file_exists(const char *fn, int fla + } + + if (stat(fn, &st) != 0) { +- if (flags & ZIP_CREATE) ++ if (flags & ZIP_CREATE || flags & ZIP_OVERWRITE) + return 0; + else { + set_error(zep, NULL, ZIP_ER_OPEN); diff --git a/libzip.spec b/libzip.spec index cce5d93..f8f5e25 100644 --- a/libzip.spec +++ b/libzip.spec @@ -2,16 +2,22 @@ # https://bugzilla.redhat.com/show_bug.cgi?id=393041 Name: libzip -Version: 0.9.3 -Release: 4%{?dist} +Version: 0.10 +Release: 1%{?dist} Summary: C library for reading, creating, and modifying zip archives Group: System Environment/Libraries License: BSD URL: http://www.nih.at/libzip/index.html -Source0: http://www.nih.at/libzip/%{name}-%{version}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Source0: http://www.nih.at/libzip/libzip-%{version}.tar.bz2 +# to handle multiarch headers, ex from mysql-devel package +Source1: zipconf.h + +# fonctionnal changes from php bundled library +Patch0: libzip-0.10-php.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: automake libtool BuildRequires: zlib-devel @@ -34,6 +40,8 @@ developing applications that use %{name}. %prep %setup -q +%patch0 -p1 -b .forphp + # Avoid lib64 rpaths (FIXME: recheck this on newer releases) #if "%{_libdir}" != "/usr/lib" #sed -i -e 's|"/lib /usr/lib|"/%{_lib} %{_libdir}|' configure @@ -51,6 +59,11 @@ rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' +# Handle multiarch headers +mv $RPM_BUILD_ROOT%{_libdir}/libzip/include/zipconf.h \ + $RPM_BUILD_ROOT%{_includedir}/zipconf_$(uname -i).h +install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/zipconf.h + %clean rm -rf $RPM_BUILD_ROOT @@ -67,18 +80,23 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/zipcmp %{_bindir}/zipmerge %{_bindir}/ziptorrent -%{_libdir}/libzip.so.1* +%{_libdir}/libzip.so.2* %{_mandir}/man1/*zip* %files devel %defattr(-,root,root,-) -%{_includedir}/zip.h +%{_includedir}/zip*.h %{_libdir}/libzip.so %{_libdir}/pkgconfig/libzip.pc %{_mandir}/man3/*zip* %changelog +* Sat Feb 04 2012 Remi Collet - 0.10-1 +- update to 0.10 +- apply patch with changes from php bundled lib (thanks spot) +- handle multiarch headers (ex from MySQL) + * Fri Jan 13 2012 Fedora Release Engineering - 0.9.3-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/sources b/sources index 67c6167..5388206 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -27610091ca27bf843a6646cd05de35b9 libzip-0.9.3.tar.bz2 +663d79a9d299a61026d1860d52cdf6fc libzip-0.10.tar.bz2 diff --git a/zipconf.h b/zipconf.h new file mode 100644 index 0000000..89a6da1 --- /dev/null +++ b/zipconf.h @@ -0,0 +1,26 @@ +/* + * Kluge to support multilib installation of both 32 and 64-bit RPMS: + * we need to arrange that header files that appear in both RPMs are + * identical. Hence, this file is architecture-independent and calls + * in an arch-dependent file that will appear in just one RPM. + * + * To avoid breaking arches not explicitly supported by Fedora, we + * use this indirection file *only* on known multilib arches. + */ +#if defined(__x86_64__) +#include "zipconf_x86_64.h" +#elif defined(__i386__) +#include "zipconf_i386.h" +#elif defined(__ppc64__) || defined(__powerpc64__) +#include "zipconf_ppc64.h" +#elif defined(__ppc__) || defined(__powerpc__) +#include "zipconf_ppc.h" +#elif defined(__s390x__) +#include "zipconf_s390x.h" +#elif defined(__s390__) +#include "zipconf_s390.h" +#elif defined(__sparc__) && defined(__arch64__) +#include "zipconf_sparc64.h" +#elif defined(__sparc__) +#include "zipconf_sparc.h" +#endif