rpms/deltarpm/devel deltarpm-system-zlib.patch, 1.2, 1.3 deltarpm.spec, 1.33, 1.34

Toshio くらとみ toshio at fedoraproject.org
Thu Oct 1 04:57:27 UTC 2009


Author: toshio

Update of /cvs/pkgs/rpms/deltarpm/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28901

Modified Files:
	deltarpm-system-zlib.patch deltarpm.spec 
Log Message:

* Wed Sep 30 2009 Toshio Kuratomi <toshio at fedoraproject.org> - 3.5-0.4.20090913git
- Update patch to properly detect when an rpm is built with an rsync-friendly
  zlib and bail out.


deltarpm-system-zlib.patch:
 Makefile |   27 +++++++++++++++------------
 cfile.c  |   60 ++++++++++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 63 insertions(+), 24 deletions(-)

Index: deltarpm-system-zlib.patch
===================================================================
RCS file: /cvs/pkgs/rpms/deltarpm/devel/deltarpm-system-zlib.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- deltarpm-system-zlib.patch	30 Sep 2009 21:56:29 -0000	1.2
+++ deltarpm-system-zlib.patch	1 Oct 2009 04:57:27 -0000	1.3
@@ -1,67 +1,7 @@
-diff -up deltarpm-git-20090913/cfile.c.mine deltarpm-git-20090913/cfile.c
---- deltarpm-git-20090913/cfile.c.mine	2009-09-30 14:14:01.422201390 -0700
-+++ deltarpm-git-20090913/cfile.c	2009-09-30 14:14:04.779201784 -0700
-@@ -17,6 +17,16 @@
- 
- #include "cfile.h"
- 
-+/* Unfortunately, we need to know what this flag is whether we have a zlib
-+ * which has been modified to include it or not
-+ */
-+#ifdef Z_RSYNCABLE
-+#define CFILE_Z_RSYNCABLE Z_RSYNCABLE
-+#else
-+/* This is the value from the current patch */
-+#define CFILE_Z_RSYNCABLE           0x4000
-+#endif
-+
- /*****************************************************************
-  *  generic input/output routines
-  */
-@@ -888,8 +898,12 @@ crunread_un(struct cfile *f, void *buf, 
- }
- 
- 
--#ifdef Z_RSYNCABLE
--
-+/*
-+ * Checks whether a cfile was compressed with the RSYNCABLE flag via amodified
-+ * zlib. If so, it changes the cfile->comp to CFILE_COMP_GZ_RSYNC.
-+ *
-+ * On error, return -1, otherwise return 0.
-+ */
- int
- cfile_detect_rsync(struct cfile *f)
- {
-@@ -922,7 +936,7 @@ cfile_detect_rsync(struct cfile *f)
-       cstrm[i].zalloc = 0;
-       cstrm[i].zfree = 0;
-       cstrm[i].opaque = 0;
--      if (deflateInit2(&cstrm[i], Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY | (i == 1 ? Z_RSYNCABLE : 0)) != Z_OK)
-+      if (deflateInit2(&cstrm[i], Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY | (i == 1 ? CFILE_Z_RSYNCABLE : 0)) != Z_OK)
- 	{
- 	  if (i)
- 	    deflateEnd(&cstrm[0]);
-@@ -1053,16 +1067,6 @@ cfile_detect_rsync(struct cfile *f)
-   return comp == -1 ? -1 : 0;
- }
- 
--#else
--
--int
--cfile_detect_rsync(struct cfile *f)
--{
--  return -1;
--}
--
--#endif
--
- /*****************************************************************
-  *  our open function
-  */
-diff -up deltarpm-git-20090913/Makefile.mine deltarpm-git-20090913/Makefile
---- deltarpm-git-20090913/Makefile.mine	2009-09-30 14:13:54.161201546 -0700
-+++ deltarpm-git-20090913/Makefile	2009-09-30 14:14:09.189200835 -0700
+Index: deltarpm-git-20090913/Makefile
+===================================================================
+--- deltarpm-git-20090913.orig/Makefile
++++ deltarpm-git-20090913/Makefile
 @@ -4,9 +4,12 @@ libdir=$(prefix)/lib
  mandir=$(prefix)/man
  rpmdumpheader=$(bindir)/rpmdumpheader
@@ -119,3 +59,129 @@ diff -up deltarpm-git-20090913/Makefile.
  	cd $(zlibdir) ; make CFLAGS="-fPIC $(CFLAGS)" libz.a
  
  clean:
+Index: deltarpm-git-20090913/cfile.c
+===================================================================
+--- deltarpm-git-20090913.orig/cfile.c
++++ deltarpm-git-20090913/cfile.c
+@@ -888,8 +888,6 @@ crunread_un(struct cfile *f, void *buf, 
+ }
+ 
+ 
+-#ifdef Z_RSYNCABLE
+-
+ int
+ cfile_detect_rsync(struct cfile *f)
+ {
+@@ -919,10 +917,22 @@ cfile_detect_rsync(struct cfile *f)
+     }
+   for (i = 0; i < 2; i++)
+     {
++#ifndef Z_RSYNCABLE
++      /* Rsync friendly zlib not available, don't set up a compressor for it
++       * */
++      if (i)
++	{
++	  break;
++	}
++#endif
+       cstrm[i].zalloc = 0;
+       cstrm[i].zfree = 0;
+       cstrm[i].opaque = 0;
++#ifdef Z_RSYNCABLE
+       if (deflateInit2(&cstrm[i], Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY | (i == 1 ? Z_RSYNCABLE : 0)) != Z_OK)
++#else
++      if (deflateInit2(&cstrm[i], Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK)
++#endif
+ 	{
+ 	  if (i)
+ 	    deflateEnd(&cstrm[0]);
+@@ -964,6 +974,23 @@ cfile_detect_rsync(struct cfile *f)
+ 		{
+ 		  for (i = 0; i < 2 && !done; i++)
+ 		    {
++#ifndef Z_RSYNCABLE
++		      /* No rsync friendly zlib so we can only test against
++		       * COMP_GZ.  This is suboptimal as it's only when we
++		       * run into an error that we can cut to the end.  So
++		       * we're forced to uncompress and recompress the whole
++		       * output.  Need to determine if we can determine that
++		       * we used the other algorithm is being used after
++		       * decompressing a certain amount of blocks.  Perhaps
++		       * after RSYNC_WIN or MAX_DIST blocks have been
++		       * decompressed we can know whether COMP_GZ_RSYNC was
++		       * used?
++		       */
++		      if (i)
++			{
++			    break;
++			}
++#endif
+ 		      cstrm[i].avail_in = sizeof(dbuf) - dstrm.avail_out;
+ 		      cstrm[i].next_in = dbuf;
+ 		      while (cstrm[i].avail_in)
+@@ -971,14 +998,23 @@ cfile_detect_rsync(struct cfile *f)
+ 			  cstrm[i].avail_out = sizeof(cbuf);
+ 			  cstrm[i].next_out = cbuf;
+ 			  ret = deflate(&cstrm[i], dret == Z_STREAM_END ? Z_FINISH : Z_NO_FLUSH);
++			  /* Any errors in compressing, set to the other
++			   * compression algorithm
++			   */
+ 			  if (ret != Z_OK && ret != Z_STREAM_END)
+ 			    {
+ 			      comp = i ? CFILE_COMP_GZ: CFILE_COMP_GZ_RSYNC;
+ 			      done = 1;
+ 			      break;
+ 			    }
++			  /* if compression yielded something
++			   */
+ 			  if (cstrm[i].avail_out != sizeof(cbuf))
+ 			    {
++			      /* If the newly compressed block is not equal to
++			       * the original compressed payload, set to the
++			       * opposite compression algorithm
++			       */
+ 			      if (memcmp(b + p[i], cbuf, sizeof(cbuf) - cstrm[i].avail_out))
+ 				{
+ 				  comp = i ? CFILE_COMP_GZ: CFILE_COMP_GZ_RSYNC;
+@@ -987,6 +1023,14 @@ cfile_detect_rsync(struct cfile *f)
+ 				}
+ 			      p[i] += sizeof(cbuf) - cstrm[i].avail_out;
+ 			    }
++			  /* If the input stream is not empty but the
++			   * compressor says that the stream is empty we have
++			   * an error.  Set to the opposite compression
++			   * algorithm.
++			   *
++			   * Note -- This code looks wrong:
++			   * Should be Z_STREAM_END, not BZ_STREAM_END
++			   */
+ 			  if (cstrm[i].avail_in && ret == BZ_STREAM_END)
+ 			    {
+ 			      comp = i ? CFILE_COMP_GZ: CFILE_COMP_GZ_RSYNC;
+@@ -1011,7 +1055,9 @@ cfile_detect_rsync(struct cfile *f)
+       b = b2;
+     }
+   deflateEnd(&cstrm[0]);
++#ifdef Z_RSYNCABLE
+   deflateEnd(&cstrm[1]);
++#endif
+   inflateEnd(&dstrm);
+   f->bufN = -1;
+   f->strm.gz.avail_in = 0;
+@@ -1053,16 +1099,6 @@ cfile_detect_rsync(struct cfile *f)
+   return comp == -1 ? -1 : 0;
+ }
+ 
+-#else
+-
+-int
+-cfile_detect_rsync(struct cfile *f)
+-{
+-  return -1;
+-}
+-
+-#endif
+-
+ /*****************************************************************
+  *  our open function
+  */


Index: deltarpm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/deltarpm/devel/deltarpm.spec,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -p -r1.33 -r1.34
--- deltarpm.spec	30 Sep 2009 21:56:29 -0000	1.33
+++ deltarpm.spec	1 Oct 2009 04:57:27 -0000	1.34
@@ -3,7 +3,7 @@
 Summary: Create deltas between rpms
 Name: deltarpm
 Version: 3.5
-Release: 0.3.20090913git%{?dist}
+Release: 0.4.20090913git%{?dist}
 License: BSD
 Group: System Environment/Base
 URL: http://gitorious.org/deltarpm/deltarpm
@@ -104,6 +104,10 @@ This package contains python bindings fo
 %{python_sitearch}/*
 
 %changelog
+* Wed Sep 30 2009 Toshio Kuratomi <toshio at fedoraproject.org> - 3.5-0.4.20090913git
+- Update patch to properly detect when an rpm is built with an rsync-friendly
+  zlib and bail out.
+
 * Wed Sep 30 2009 Toshio Kuratomi <toshio at fedoraproject.org> - 3.5-0.3.20090913git
 - Make building with system zlib selectable at build time.
 - Fix cfile_detect_rsync() to detect rsync even if we don't have a zlib capable




More information about the fedora-extras-commits mailing list