- Add patch to build with both bundled and external zlib to support

both compression methods at once bsc#1046197:
  * rsync-both-compressions.patch

OBS-URL: https://build.opensuse.org/package/show/network/rsync?expand=0&rev=54
This commit is contained in:
Tomáš Chvátal 2017-07-13 09:01:36 +00:00 committed by Git OBS Bridge
parent e3b5845c6e
commit af157abf19
3 changed files with 149 additions and 8 deletions

View File

@ -0,0 +1,134 @@
diff --git a/configure.ac b/configure.ac
index e01e124b..5a0b9bca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -794,26 +794,23 @@ else
AC_MSG_RESULT(no)
fi
-# We default to using our zlib unless --with-included-zlib=no is given.
+# Always compile with system zlib but if --with-included-zlib=yes is given
+# or not specified at all compile in the support too.
if test x"$with_included_zlib" != x"no"; then
with_included_zlib=yes
elif test x"$ac_cv_header_zlib_h" != x"yes"; then
with_included_zlib=yes
fi
-if test x"$with_included_zlib" != x"yes"; then
- AC_CHECK_LIB(z, deflateParams, , [with_included_zlib=yes])
-fi
AC_MSG_CHECKING([whether to use included zlib])
if test x"$with_included_zlib" = x"yes"; then
AC_MSG_RESULT($srcdir/zlib)
BUILD_ZLIB='$(zlib_OBJS)'
CFLAGS="-I$srcdir/zlib $CFLAGS"
-else
- AC_DEFINE(EXTERNAL_ZLIB, 1, [Define to 1 if using external zlib])
- AC_MSG_RESULT(no)
fi
+AC_CHECK_LIB(z, deflateParams, , [AC_MSG_ERROR([zlib with deflateParams not found])])
+
AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char *s = ""]])],[rsync_cv_SIGNED_CHAR_OK=yes],[rsync_cv_SIGNED_CHAR_OK=no])])
if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
diff --git a/options.c b/options.c
index 64ec8b84..522875c5 100644
--- a/options.c
+++ b/options.c
@@ -1866,16 +1866,6 @@ int parse_arguments(int *argc_p, const char ***argv_p)
create_refuse_error(refused_compress);
return 0;
}
-#ifdef EXTERNAL_ZLIB
- if (do_compression == 1) {
- snprintf(err_buf, sizeof err_buf,
- "This rsync lacks old-style --compress due to its external zlib. Try -zz.\n");
- if (am_server)
- return 0;
- fprintf(stderr, "%s" "Continuing without compression.\n\n", err_buf);
- do_compression = 0;
- }
-#endif
}
#ifdef HAVE_SETVBUF
diff --git a/token.c b/token.c
index ad9b9bcd..0eb95362 100644
--- a/token.c
+++ b/token.c
@@ -405,7 +405,6 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
} else if (token != -2 && do_compression == 1) {
/* Add the data in the current block to the compressor's
* history and hash table. */
-#ifndef EXTERNAL_ZLIB
do {
/* Break up long sections in the same way that
* see_deflate_token() does. */
@@ -417,18 +416,13 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
offset += n1;
tx_strm.next_out = (Bytef *) obuf;
tx_strm.avail_out = AVAIL_OUT_SIZE(CHUNK_SIZE);
- r = deflate(&tx_strm, Z_INSERT_ONLY);
+ r = deflate_int(&tx_strm, Z_INSERT_ONLY);
if (r != Z_OK || tx_strm.avail_in != 0) {
rprintf(FERROR, "deflate on token returned %d (%d bytes left)\n",
r, tx_strm.avail_in);
exit_cleanup(RERR_STREAMIO);
}
} while (toklen > 0);
-#else
- toklen++;
- rprintf(FERROR, "Impossible error in external-zlib code (1).\n");
- exit_cleanup(RERR_STREAMIO);
-#endif
}
}
@@ -579,7 +573,6 @@ static int32 recv_deflated_token(int f, char **data)
*/
static void see_deflate_token(char *buf, int32 len)
{
-#ifndef EXTERNAL_ZLIB
int r;
int32 blklen;
unsigned char hdr[5];
@@ -617,11 +610,6 @@ static void see_deflate_token(char *buf, int32 len)
exit_cleanup(RERR_STREAMIO);
}
} while (len || rx_strm.avail_out == 0);
-#else
- buf++; len++;
- rprintf(FERROR, "Impossible error in external-zlib code (2).\n");
- exit_cleanup(RERR_STREAMIO);
-#endif
}
/**
diff --git a/zlib/deflate.c b/zlib/deflate.c
index 529c5e8d..ba711897 100644
--- a/zlib/deflate.c
+++ b/zlib/deflate.c
@@ -664,7 +664,7 @@ local void flush_pending(strm)
}
/* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
+int ZEXPORT deflate_int (strm, flush)
z_streamp strm;
int flush;
{
diff --git a/zlib/zlib.h b/zlib/zlib.h
index c4536ca7..ee98c332 100644
--- a/zlib/zlib.h
+++ b/zlib/zlib.h
@@ -244,7 +244,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
*/
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+ZEXTERN int ZEXPORT deflate_int OF((z_streamp strm, int flush));
/*
deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jul 13 09:00:59 UTC 2017 - tchvatal@suse.com
- Add patch to build with both bundled and external zlib to support
both compression methods at once bsc#1046197:
* rsync-both-compressions.patch
-------------------------------------------------------------------
Wed Jun 14 12:21:21 UTC 2017 - tchvatal@suse.com

View File

@ -36,9 +36,10 @@ Source9: rsyncd@.service
Source10: http://rsync.samba.org/ftp/rsync/src/rsync-%{version}.tar.gz.asc
Source11: http://rsync.samba.org/ftp/rsync/src/rsync-patches-%{version}.tar.gz.asc
Source12: %{name}.keyring
Patch5: rsync-no-libattr.patch
Patch0: rsync-no-libattr.patch
#PATCH-FIX-SUSE boo#922710 slp
Patch6: rsync-add_back_use_slp_directive.patch
Patch1: rsync-add_back_use_slp_directive.patch
Patch2: rsync-both-compressions.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libacl-devel
@ -49,7 +50,6 @@ BuildRequires: zlib-devel
Requires(post): grep
Requires(post): sed
Recommends: logrotate
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%description
@ -64,14 +64,15 @@ for backups and mirroring and as an improved copy command for everyday use.
%prep
%setup -q -b 1
rm -f zlib/*.h
#rm -f zlib/*.h
patch -p1 < patches/acls.diff
patch -p1 < patches/xattrs.diff
patch -p1 < patches/slp.diff
%patch6 -p1
%patch1 -p1
# fate#312479
patch -p1 < patches/time-limit.diff
%patch5 -p1
%patch0 -p1
%patch2 -p1
%build
autoreconf -fiv
@ -79,7 +80,7 @@ export CFLAGS="%{optflags} -fPIC -DPIC -fPIE"
export LDFLAGS="-Wl,-z,relro,-z,now -pie"
%configure \
--with-included-popt=no \
--with-included-zlib=no \
--with-included-zlib=yes \
--disable-debug \
--enable-slp \
--enable-acl-support \
@ -119,7 +120,6 @@ ln -sf service %{buildroot}%{_sbindir}/rcrsyncd
%service_del_postun rsyncd.service
%files
%defattr(-,root,root)
%{_unitdir}/rsyncd@.service
%{_unitdir}/rsyncd.service
%{_unitdir}/rsyncd.socket