summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2012-01-27 16:26:42 +0100
committerRemi Collet <fedora@famillecollet.com>2012-01-27 16:26:42 +0100
commit77746f2ac32095e84cd3bcb95c282cbb5d7aed53 (patch)
tree368c1abbfc3c027a3a4b14ddf0415a9df2db0683
parent5bb48dbd2b5181860ba4efd4645e089f2ae5ec19 (diff)
libzip 0.10 with patch from spot
-rw-r--r--.gitignore3
-rw-r--r--libzip-0.10-php.patch87
-rw-r--r--libzip-php.patch68
-rw-r--r--libzip.spec12
4 files changed, 93 insertions, 77 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1648ddf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+abi_dumps/
+compat_reports/
+
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; i<zf->za->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; i<zf->za->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-php.patch b/libzip-php.patch
deleted file mode 100644
index ca9cf7c..0000000
--- a/libzip-php.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-diff -ru libzip-0.10.orig/lib/zip_fclose.c libzip-0.10/lib/zip_fclose.c
---- libzip-0.10.orig/lib/zip_fclose.c 2010-03-08 13:27:48.000000000 +0100
-+++ libzip-0.10/lib/zip_fclose.c 2011-07-03 11:07:22.000000000 +0200
-@@ -47,7 +47,7 @@
- if (zf->src)
- zip_source_free(zf->src);
-
-- for (i=0; i<zf->za->nfile; i++) {
-+ if (zf->za) for (i=0; i<zf->za->nfile; i++) {
- if (zf->za->file[i] == zf) {
- zf->za->file[i] = zf->za->file[zf->za->nfile-1];
- zf->za->nfile--;
-Seulement dans libzip-0.10/lib: zip_fclose.c~
-diff -ru libzip-0.10.orig/lib/zip.h libzip-0.10/lib/zip.h
---- libzip-0.10.orig/lib/zip.h 2011-03-04 18:17:43.000000000 +0100
-+++ libzip-0.10/lib/zip.h 2011-07-03 11:38:39.000000000 +0200
-@@ -59,6 +59,7 @@
- #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, ... */
-Seulement dans libzip-0.10/lib: zip.h~
-diff -ru libzip-0.10.orig/lib/zip_name_locate.c libzip-0.10/lib/zip_name_locate.c
---- libzip-0.10.orig/lib/zip_name_locate.c 2011-02-13 16:06:21.000000000 +0100
-+++ libzip-0.10/lib/zip_name_locate.c 2011-07-03 14:24:44.000000000 +0200
-@@ -91,6 +91,7 @@
- return i;
- }
-
-- _zip_error_set(error, ZIP_ER_NOENT, 0);
-+/* Look for an entry should not raise an error */
-+/* _zip_error_set(error, ZIP_ER_NOENT, 0);*/
- return -1;
- }
-Seulement dans libzip-0.10/lib: zip_name_locate.c~
-diff -ru libzip-0.10.orig/lib/zip_open.c libzip-0.10/lib/zip_open.c
---- libzip-0.10.orig/lib/zip_open.c 2011-03-16 12:18:44.000000000 +0100
-+++ libzip-0.10/lib/zip_open.c 2011-07-03 11:19:41.000000000 +0200
-@@ -62,9 +62,15 @@
- {
- 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 @@
- }
-
- 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);
-Seulement dans libzip-0.10/lib: zip_open.c~
diff --git a/libzip.spec b/libzip.spec
index 2d5d9f7..01873f5 100644
--- a/libzip.spec
+++ b/libzip.spec
@@ -1,6 +1,3 @@
-# Fedora Review Request #393041
-# https://bugzilla.redhat.com/show_bug.cgi?id=393041
-
Name: libzip2
Version: 0.10
Release: 1%{?dist}
@@ -11,10 +8,9 @@ License: BSD
URL: http://www.nih.at/libzip/index.html
Source0: http://www.nih.at/libzip/libzip-%{version}.tar.bz2
-Patch0: libzip-php.patch
+Patch0: libzip-0.10-php.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
BuildRequires: automake libtool
BuildRequires: zlib-devel
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@@ -66,9 +62,6 @@ rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
-# Need to check this, for multilib
-mv $RPM_BUILD_ROOT%{_libdir}/libzip/include/zipconf.h $RPM_BUILD_ROOT%{_includedir}
-
%clean
rm -rf $RPM_BUILD_ROOT
@@ -93,8 +86,9 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(-,root,root,-)
-%{_includedir}/zip*.h
+%{_includedir}/zip.h
%{_libdir}/libzip.so
+%{_libdir}/libzip/include/zipconf.h
%{_libdir}/pkgconfig/libzip.pc
%{_mandir}/man3/*zip*