commit:     f0c6c276cbc2bc2b5eb25264586b2a5fef1af3c2
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 28 06:54:11 2020 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Jul 28 06:54:47 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f0c6c276

net-misc/rsync: Revbump to backport two fixes

- Allow --bwlimit=0 again
- Fix usage of zstd compression

Closes: https://bugs.gentoo.org/731306
Closes: https://bugs.gentoo.org/733084
Package-Manager: Portage-3.0.1, Repoman-2.3.23
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 .../rsync/files/rsync-3.2.2-allow_bwlimit_0.patch  |  77 ++++++++++
 .../rsync/files/rsync-3.2.2-zstd_see_token.patch   |  31 ++++
 net-misc/rsync/rsync-3.2.2-r1.ebuild               | 158 +++++++++++++++++++++
 3 files changed, 266 insertions(+)

diff --git a/net-misc/rsync/files/rsync-3.2.2-allow_bwlimit_0.patch 
b/net-misc/rsync/files/rsync-3.2.2-allow_bwlimit_0.patch
new file mode 100644
index 00000000000..4a795bb17b9
--- /dev/null
+++ b/net-misc/rsync/files/rsync-3.2.2-allow_bwlimit_0.patch
@@ -0,0 +1,77 @@
+From 5dcb49c7ddec765d4a24b4f801ffc7212c085db1 Mon Sep 17 00:00:00 2001
+From: Wayne Davison <[email protected]>
+Date: Tue, 7 Jul 2020 11:40:27 -0700
+Subject: [PATCH] Allow --bwlimit=0 again.
+
+---
+ options.c            | 12 ++++++------
+ testsuite/hands.test |  2 +-
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/options.c b/options.c
+index 5a372ae7..0b7b9f33 100644
+--- a/options.c
++++ b/options.c
+@@ -1253,7 +1253,7 @@ static int count_args(const char **argv)
+ /* If the size_arg is an invalid string or the value is < min_value, an error
+  * is put into err_buf & the return is -1.  Note that this parser does NOT
+  * support negative numbers, so a min_value < 0 doesn't make any sense. */
+-static ssize_t parse_size_arg(char *size_arg, char def_suf, const char 
*opt_name, ssize_t min_value)
++static ssize_t parse_size_arg(char *size_arg, char def_suf, const char 
*opt_name, ssize_t min_value, BOOL allow_0)
+ {
+       int reps, mult;
+       const char *arg, *err = "invalid";
+@@ -1299,7 +1299,7 @@ static ssize_t parse_size_arg(char *size_arg, char 
def_suf, const char *opt_name
+               size += atoi(arg), arg += 2;
+       if (*arg)
+               goto failure;
+-      if (size < min_value) {
++      if (size < min_value && (!allow_0 || size != 0)) {
+               err = size < 0 ? "too big" : "too small";
+               goto failure;
+       }
+@@ -1683,19 +1683,19 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+                       break;
+ 
+               case OPT_MAX_SIZE:
+-                      if ((max_size = parse_size_arg(max_size_arg, 'b', 
"max-size", 0)) < 0)
++                      if ((max_size = parse_size_arg(max_size_arg, 'b', 
"max-size", 0, True)) < 0)
+                               return 0;
+                       max_size_arg = num_to_byte_string(max_size);
+                       break;
+ 
+               case OPT_MIN_SIZE:
+-                      if ((min_size = parse_size_arg(min_size_arg, 'b', 
"min-size", 0)) < 0)
++                      if ((min_size = parse_size_arg(min_size_arg, 'b', 
"min-size", 0, True)) < 0)
+                               return 0;
+                       min_size_arg = num_to_byte_string(min_size);
+                       break;
+ 
+               case OPT_BWLIMIT: {
+-                      ssize_t size = parse_size_arg(bwlimit_arg, 'K', 
"bwlimit", 512);
++                      ssize_t size = parse_size_arg(bwlimit_arg, 'K', 
"bwlimit", 512, True);
+                       if (size < 0)
+                               return 0;
+                       bwlimit_arg = num_to_byte_string(size);
+@@ -1889,7 +1889,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+                       max_alloc_arg = NULL;
+       }
+       if (max_alloc_arg) {
+-              ssize_t size = parse_size_arg(max_alloc_arg, 'B', "max-alloc", 
1024*1024);
++              ssize_t size = parse_size_arg(max_alloc_arg, 'B', "max-alloc", 
1024*1024, False);
+               if (size < 0)
+                       return 0;
+               max_alloc = size;
+diff --git a/testsuite/hands.test b/testsuite/hands.test
+index 46928d4e..8e265b7c 100644
+--- a/testsuite/hands.test
++++ b/testsuite/hands.test
+@@ -16,7 +16,7 @@ DEBUG_OPTS="--debug=all0,deltasum0"
+ runtest "basic operation" 'checkit "$RSYNC -av \"$fromdir/\" \"$todir\"" 
"$fromdir/" "$todir"'
+ 
+ ln "$fromdir/filelist" "$fromdir/dir"
+-runtest "hard links" 'checkit "$RSYNC -avH $DEBUG_OPTS \"$fromdir/\" 
\"$todir\"" "$fromdir/" "$todir"'
++runtest "hard links" 'checkit "$RSYNC -avH --bwlimit=0 $DEBUG_OPTS 
\"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
+ 
+ rm "$todir/text"
+ runtest "one file" 'checkit "$RSYNC -avH $DEBUG_OPTS \"$fromdir/\" 
\"$todir\"" "$fromdir/" "$todir"'

diff --git a/net-misc/rsync/files/rsync-3.2.2-zstd_see_token.patch 
b/net-misc/rsync/files/rsync-3.2.2-zstd_see_token.patch
new file mode 100644
index 00000000000..02f22409d4c
--- /dev/null
+++ b/net-misc/rsync/files/rsync-3.2.2-zstd_see_token.patch
@@ -0,0 +1,31 @@
+From bb1365dd7736b264738f50b683a0f81a2ed11aba Mon Sep 17 00:00:00 2001
+From: Wayne Davison <[email protected]>
+Date: Fri, 10 Jul 2020 09:47:16 -0700
+Subject: [PATCH] Fix see_token zstd case.
+
+---
+ token.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/token.c b/token.c
+index cad6b641..61be8dd9 100644
+--- a/token.c
++++ b/token.c
+@@ -1093,13 +1093,13 @@ void see_token(char *data, int32 toklen)
+               break;
+       case CPRES_ZLIBX:
+               break;
+-#ifdef SUPPORT_LZ4
+-      case CPRES_LZ4:
+-              /*see_uncompressed_token(data, toklen);*/
++#ifdef SUPPORT_ZSTD
++      case CPRES_ZSTD:
+               break;
+ #endif
+ #ifdef SUPPORT_LZ4
+-      case CPRES_ZSTD:
++      case CPRES_LZ4:
++              /*see_uncompressed_token(data, toklen);*/
+               break;
+ #endif
+       default:

diff --git a/net-misc/rsync/rsync-3.2.2-r1.ebuild 
b/net-misc/rsync/rsync-3.2.2-r1.ebuild
new file mode 100644
index 00000000000..2507bc58986
--- /dev/null
+++ b/net-misc/rsync/rsync-3.2.2-r1.ebuild
@@ -0,0 +1,158 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic prefix systemd
+
+DESCRIPTION="File transfer program to keep remote files into sync"
+HOMEPAGE="https://rsync.samba.org/";
+if [[ "${PV}" == *9999 ]] ; then
+       PYTHON_COMPAT=( python3_{6,7,8} )
+       inherit autotools git-r3 python-any-r1
+       EGIT_REPO_URI="https://github.com/WayneD/rsync.git";
+else
+       if [[ "${PV}" == *_pre* ]] ; then
+               SRC_DIR="src-previews"
+       else
+               SRC_DIR="src"
+               KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips 
~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux 
~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris 
~sparc64-solaris ~x64-solaris ~x86-solaris"
+       fi
+       SRC_URI="https://rsync.samba.org/ftp/rsync/${SRC_DIR}/${P/_/}.tar.gz";
+       S="${WORKDIR}/${P/_/}"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+IUSE_CPU_FLAGS_X86=" sse2"
+IUSE="acl examples iconv ipv6 libressl lz4 ssl static stunnel system-zlib 
xattr xxhash zstd"
+IUSE+=" ${IUSE_CPU_FLAGS_X86// / cpu_flags_x86_}"
+
+LIB_DEPEND="acl? ( virtual/acl[static-libs(+)] )
+       lz4? ( app-arch/lz4[static-libs(+)] )
+       ssl? (
+               !libressl? ( dev-libs/openssl:0=[static-libs(+)] )
+               libressl? ( dev-libs/libressl:0=[static-libs(+)] )
+       )
+       system-zlib? ( sys-libs/zlib[static-libs(+)] )
+       xattr? ( kernel_linux? ( sys-apps/attr[static-libs(+)] ) )
+       xxhash? ( dev-libs/xxhash[static-libs(+)] )
+       zstd? ( app-arch/zstd[static-libs(+)] )
+       >=dev-libs/popt-1.5[static-libs(+)]"
+RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
+       iconv? ( virtual/libiconv )"
+DEPEND="${RDEPEND}
+       static? ( ${LIB_DEPEND} )"
+
+if [[ "${PV}" == *9999 ]] ; then
+       BDEPEND="${PYTHON_DEPS}
+               $(python_gen_any_dep '
+                       dev-python/commonmark[${PYTHON_USEDEP}]
+               ')"
+fi
+
+PATCHES=(
+       "${FILESDIR}/${P}-allow_bwlimit_0.patch" #731306
+       "${FILESDIR}/${P}-zstd_see_token.patch" #733084
+)
+
+# Only required for live ebuild
+python_check_deps() {
+       has_version "dev-python/commonmark[${PYTHON_USEDEP}]"
+}
+
+src_prepare() {
+       default
+       if [[ "${PV}" == *9999 ]] ; then
+               eaclocal -I m4
+               eautoconf -o configure.sh
+               eautoheader && touch config.h.in
+       fi
+}
+
+src_configure() {
+       use static && append-ldflags -static
+       local myeconfargs=(
+               --with-rsyncd-conf="${EPREFIX}"/etc/rsyncd.conf
+               --without-included-popt
+               $(use_enable acl acl-support)
+               $(use_enable iconv)
+               $(use_enable ipv6)
+               $(use_enable lz4)
+               $(use_enable ssl openssl)
+               $(use_with !system-zlib included-zlib)
+               $(use_enable xattr xattr-support)
+               $(use_enable xxhash)
+               $(use_enable zstd)
+       )
+
+       if use elibc_glibc && [[ "${ARCH}" == "amd64" ]] ; then
+               # SIMD is only available for x86_64 right now
+               # and only on glibc (#728868)
+               myeconfargs+=( $(use_enable cpu_flags_x86_sse2 simd) )
+       else
+               myeconfargs+=( --disable-simd )
+       fi
+
+       econf "${myeconfargs[@]}"
+       [[ "${PV}" == *9999 ]] || touch proto.h-tstamp #421625
+}
+
+src_install() {
+       emake DESTDIR="${D}" install
+
+       newconfd "${FILESDIR}"/rsyncd.conf.d rsyncd
+       newinitd "${FILESDIR}"/rsyncd.init.d-r1 rsyncd
+
+       dodoc NEWS.md README.md TODO tech_report.tex
+
+       insinto /etc
+       newins "${FILESDIR}"/rsyncd.conf-3.0.9-r1 rsyncd.conf
+
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}"/rsyncd.logrotate rsyncd
+
+       insinto /etc/xinetd.d
+       newins "${FILESDIR}"/rsyncd.xinetd-3.0.9-r1 rsyncd
+
+       # Install stunnel helpers
+       if use stunnel ; then
+               emake DESTDIR="${D}" install-ssl-daemon
+       fi
+
+       # Install the useful contrib scripts
+       if use examples ; then
+               exeinto /usr/share/rsync
+               doexe support/*
+               rm -f "${ED}"/usr/share/rsync/{Makefile*,*.c}
+       fi
+
+       eprefixify "${ED}"/etc/{,xinetd.d}/rsyncd*
+
+       systemd_dounit "${FILESDIR}/rsyncd.service"
+}
+
+pkg_postinst() {
+       if egrep -qis '^[[:space:]]use 
chroot[[:space:]]*=[[:space:]]*(no|0|false)' \
+               "${EROOT}"/etc/rsyncd.conf "${EROOT}"/etc/rsync/rsyncd.conf ; 
then
+               ewarn "You have disabled chroot support in your rsyncd.conf.  
This"
+               ewarn "is a security risk which you should fix.  Please check 
your"
+               ewarn "/etc/rsyncd.conf file and fix the setting 'use chroot'."
+       fi
+       if use stunnel ; then
+               einfo "Please install \">=net-misc/stunnel-4\" in order to use 
stunnel feature."
+               einfo
+               einfo "You maybe have to update the certificates configured in"
+               einfo "${EROOT}/etc/stunnel/rsync.conf"
+       fi
+       if use system-zlib ; then
+               ewarn "Using system-zlib is incompatible with <rsync-3.1.1 when"
+               ewarn "using the --compress option."
+               ewarn
+               ewarn "When syncing with >=rsync-3.1.1 built with bundled zlib,"
+               ewarn "and the --compress option, add --new-compress (-zz)."
+               ewarn
+               ewarn "For syncing the portage tree, add:"
+               ewarn "PORTAGE_RSYNC_EXTRA_OPTS=\"--new-compress\" to make.conf"
+       fi
+}

Reply via email to