rpms/deltarpm/F-12 deltarpm-system-zlib.patch, 1.1, 1.2 deltarpm.spec, 1.32, 1.33

Toshio くらとみ toshio at fedoraproject.org
Thu Oct 1 05:40:55 UTC 2009


Author: toshio

Update of /cvs/pkgs/rpms/deltarpm/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv2882

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/F-12/deltarpm-system-zlib.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- deltarpm-system-zlib.patch	30 Sep 2009 17:24:36 -0000	1.1
+++ deltarpm-system-zlib.patch	1 Oct 2009 05:40:54 -0000	1.2
@@ -2,63 +2,186 @@ Index: deltarpm-git-20090913/Makefile
 ===================================================================
 --- deltarpm-git-20090913.orig/Makefile
 +++ deltarpm-git-20090913/Makefile
-@@ -3,10 +3,9 @@ bindir=$(prefix)/bin
- libdir=$(prefix)/lib
+@@ -4,9 +4,12 @@ libdir=$(prefix)/lib
  mandir=$(prefix)/man
  rpmdumpheader=$(bindir)/rpmdumpheader
--zlibdir=zlib-1.2.2.f-rsyncable
+ zlibdir=zlib-1.2.2.f-rsyncable
++zlibbundled=$(zlibdir)/libz.a
++zlibldflags=$(zlibbundled)
++zlibcppflags=-I$(zlibdir)
  CFLAGS = -fPIC -O2 -Wall -g
 -CPPFLAGS = -fPIC -DDELTARPM_64BIT -DBSDIFF_NO_SUF -DRPMDUMPHEADER=\"$(rpmdumpheader)\" -I$(zlibdir)
 -LDLIBS = -lbz2 $(zlibdir)/libz.a -llzma
-+CPPFLAGS = -fPIC -DDELTARPM_64BIT -DBSDIFF_NO_SUF -DRPMDUMPHEADER=\"$(rpmdumpheader)\" -I.
-+LDLIBS = -lbz2 -lz -llzma
++CPPFLAGS = -fPIC -DDELTARPM_64BIT -DBSDIFF_NO_SUF -DRPMDUMPHEADER=\"$(rpmdumpheader)\" $(zlibcppflags)
++LDLIBS = -lbz2 $(zlibldflags) -llzma
  LDFLAGS =
  PYTHONVERS = $(shell ls /usr/include/python*/Python.h | sed "s|/usr/include/||g"| sed "s|/Python.h||g")
  
-@@ -14,37 +13,33 @@ all: makedeltarpm applydeltarpm rpmdumph
+@@ -14,31 +17,31 @@ all: makedeltarpm applydeltarpm rpmdumph
  
  python: _deltarpmmodule.so
  
 -makedeltarpm: makedeltarpm.o writedeltarpm.o md5.o util.o rpml.o rpmhead.o cpio.o delta.o cfile.o $(zlibdir)/libz.a
-+makedeltarpm: makedeltarpm.o writedeltarpm.o md5.o util.o rpml.o rpmhead.o cpio.o delta.o cfile.o
++makedeltarpm: makedeltarpm.o writedeltarpm.o md5.o util.o rpml.o rpmhead.o cpio.o delta.o cfile.o $(zlibbundled)
  
 -applydeltarpm: applydeltarpm.o readdeltarpm.o md5.o sha256.o util.o rpmhead.o cpio.o cfile.o prelink.o $(zlibdir)/libz.a
-+applydeltarpm: applydeltarpm.o readdeltarpm.o md5.o sha256.o util.o rpmhead.o cpio.o cfile.o prelink.o
++applydeltarpm: applydeltarpm.o readdeltarpm.o md5.o sha256.o util.o rpmhead.o cpio.o cfile.o prelink.o $(zlibbundled)
  
 -combinedeltarpm: combinedeltarpm.o md5.o util.o rpmhead.o cfile.o readdeltarpm.o writedeltarpm.o $(zlibdir)/libz.a
-+combinedeltarpm: combinedeltarpm.o md5.o util.o rpmhead.o cfile.o readdeltarpm.o writedeltarpm.o
++combinedeltarpm: combinedeltarpm.o md5.o util.o rpmhead.o cfile.o readdeltarpm.o writedeltarpm.o $(zlibbundled)
  
  rpmdumpheader: rpmdumpheader.o
  	$(CC) $(LDFLAGS) $^ -lrpm -o $@
  
 -makedeltaiso: makedeltaiso.o delta.o rpmoffs.o rpmhead.o util.o md5.o cfile.o $(zlibdir)/libz.a
-+makedeltaiso: makedeltaiso.o delta.o rpmoffs.o rpmhead.o util.o md5.o cfile.o
++makedeltaiso: makedeltaiso.o delta.o rpmoffs.o rpmhead.o util.o md5.o cfile.o $(zlibbundled)
  
 -applydeltaiso: applydeltaiso.o util.o md5.o cfile.o $(zlibdir)/libz.a
-+applydeltaiso: applydeltaiso.o util.o md5.o cfile.o
++applydeltaiso: applydeltaiso.o util.o md5.o cfile.o $(zlibbundled)
  
 -fragiso: fragiso.o util.o md5.o rpmhead.o cfile.o $(zlibdir)/libz.a
-+fragiso: fragiso.o util.o md5.o rpmhead.o cfile.o
++fragiso: fragiso.o util.o md5.o rpmhead.o cfile.o $(zlibbundled)
  
 -_deltarpmmodule.so: readdeltarpm.o rpmhead.o util.o md5.o cfile.o $(zlibdir)/libz.a
-+_deltarpmmodule.so: readdeltarpm.o rpmhead.o util.o md5.o cfile.o
++_deltarpmmodule.so: readdeltarpm.o rpmhead.o util.o md5.o cfile.o $(zlibbundled)
  	for ver in $(PYTHONVERS) ; do \
  		if [ ! -f "$$ver/$@" ]; then \
  			mkdir -p $$ver ;\
 -			$(CC) $(CFLAGS) -I/usr/include/$$ver -I$(zlibdir) -fPIC -c -o $$ver/deltarpmmodule.o deltarpmmodule.c ;\
 -			$(CC) -o $$ver/$@ $$ver/deltarpmmodule.o $^ -shared -Wl,-soname,_deltarpmmodule.so $(zlibdir)/libz.a -llzma -lbz2; \
-+			$(CC) $(CFLAGS) -I/usr/include/$$ver -fPIC -c -o $$ver/deltarpmmodule.o deltarpmmodule.c ;\
-+			$(CC) -o $$ver/$@ $$ver/deltarpmmodule.o $^ -shared -Wl,-soname,_deltarpmmodule.so -lz -llzma -lbz2; \
++			$(CC) $(CFLAGS) -I/usr/include/$$ver $(zlibcppflag) -fPIC -c -o $$ver/deltarpmmodule.o deltarpmmodule.c ;\
++			$(CC) -o $$ver/$@ $$ver/deltarpmmodule.o $^ -shared -Wl,-soname,_deltarpmmodule.so $(LDLIBS); \
  		fi; \
  	done
  
 -$(zlibdir)/libz.a:
--	cd $(zlibdir) ; make CFLAGS="-fPIC $(CFLAGS)" libz.a
--
++$(zlibbundled):
+ 	cd $(zlibdir) ; make CFLAGS="-fPIC $(CFLAGS)" libz.a
+ 
  clean:
- 	rm -f *.o
- 	rm -f makedeltarpm applydeltarpm combinedeltarpm rpmdumpheader makedeltaiso applydeltaiso fragiso
--	cd $(zlibdir) ; make 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;
+ }
  
- install:
- 	mkdir -p $(DESTDIR)$(bindir)
+-#else
+-
+-int
+-cfile_detect_rsync(struct cfile *f)
+-{
+-  return -1;
+-}
+-
+-#endif
+-
+ /*****************************************************************
+  *  our open function
+  */


Index: deltarpm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/deltarpm/F-12/deltarpm.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -p -r1.32 -r1.33
--- deltarpm.spec	30 Sep 2009 17:24:36 -0000	1.32
+++ deltarpm.spec	1 Oct 2009 05:40:54 -0000	1.33
@@ -3,7 +3,7 @@
 Summary: Create deltas between rpms
 Name: deltarpm
 Version: 3.5
-Release: 0.2.20090913git%{?dist}
+Release: 0.4.20090913git%{?dist}
 License: BSD
 Group: System Environment/Base
 URL: http://gitorious.org/deltarpm/deltarpm
@@ -55,13 +55,15 @@ This package contains python bindings fo
 %setup -q -n %{name}-git-20090913
 # Build with system zlib
 %patch0 -p1 -b .zlib
-%{__rm} -rf zlib-1.2.2.f-rsyncable
 
 %build
 %{__make} %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" \
-    bindir=%{_bindir} libdir=%{_libdir} mandir=%{_mandir} prefix=%{_prefix}
+    bindir=%{_bindir} libdir=%{_libdir} mandir=%{_mandir} prefix=%{_prefix} \
+    zlibbundled='' zlibldflags='-lz' zlibcppflags=''
 %{__make} %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" \
-    bindir=%{_bindir} libdir=%{_libdir} mandir=%{_mandir} prefix=%{_prefix} python
+    bindir=%{_bindir} libdir=%{_libdir} mandir=%{_mandir} prefix=%{_prefix} \
+    zlibbundled='' zlibldflags='-lz' zlibcppflags='' \
+    python
 
 %install
 %{__rm} -rf %{buildroot}
@@ -102,6 +104,15 @@ 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
+  of making rsync-friendly compressed files.
+
 * Wed Sep 30 2009 Toshio Kuratomi <toshio at fedoraproject.org> - 3.5-0.2.20090913git
 - Correct prerelease rlease numbering.
 - Build against the system zlib, not the bundled library.  This remedies the




More information about the scm-commits mailing list