On my server (which of course runs Gentoo) it isn't possible to sync via 'emerge rsync' due to the firewall. So I have to use emerge-webrsync. But this tool didn't use the --exclude-from option of rsync. I use this feature a lot because on a server you don't need the whole x11 stuff etc. So I added this feature to emerge-webrsync. I also fixed the option handling of the script, added absolute paths everywhere in the script (I think this is better for security, you never know) and added a check if there is already a snapshot present on the system (if you sync more than once a day, which you shouldn't ;) I hope that this fix will be applied. This also fixes Bug #44281 (incorrect output of date format)
Created attachment 32159 [details, diff] Patch for emerge-webrsync
Forgot to add my emerge info: Gentoo Base System version 1.4.10 Portage 2.0.50-r6 (default-x86-2004.0, gcc-3.3.2, glibc-2.3.2-r9, 2.6.5-gentoo-r1) ================================================================= System uname: 2.6.5-gentoo-r1 i686 Intel(R) Pentium(R) III Mobile CPU 1066MHz distcc 2.13 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] Autoconf: sys-devel/autoconf-2.58-r1 Automake: sys-devel/automake-1.8.3 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O2 -march=pentium3 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=pentium3 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache distcc sandbox" GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/ ftp://ftp.solnet.ch/mirror/Gentoo" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X acpi alsa apm arts avi berkdb crypt cups dvd encode foomaticdb gdbm gif gpm gtk gtk2 imagemagick imlib ipv6 jabber jpeg kde libg++ libwww linguas_de linguas_en mad mbox mikmod motif mpeg ncurses nls oggvorbis opengl oss pam pcmcia pdflib perl png pnp python qt quicktime readline sdl slang spell ssl svga tcpd truetype unicode x86 xml2 xmms xv xvid zlib"
Created attachment 38085 [details, diff] New patch for emerge-wersync I added a function to delete all snapshots except the fetched one. So you always have only the most recent snapshot on your system.
Making your changes against 2.0.51_rc7 or later would be best.
Is there a way to get the value of RSYNC_EXCLUDEFROM out of /etc/make.conf without sourcing the make.conf file (as I do in the posted patch)? I don0t think thats the proper way, since the whole /etc/make.conf gets evaluated then (possible security risc).
Putting a hold on feature requests for portage as they are drowning out the bugs. Most of these features should be available in the next major version of portage. But for the time being, they are just drowning out the major bugs and delaying the next version's progress. Any bugs that contain patches and any bugs for etc-update or dispatch-conf can be reopened. Sorry, I'm just not good enough with bugzilla. ;)
Reopening for consideration.
Added support for PORTAGE_RSYNC_EXTRA_OPTS to emerge-webrsync
Created attachment 138032 [details, diff] patch to quote variable contents properly I wanted to use a full rsync --filter (as opposed to just an --exclude-from file) in PORTAGE_RSYNC_EXTRA_OPTS, but rsync filters contain whitespace (e.g. --filter="hide games-*") this broke emerge-webrsync because it does not handle the quoting properly. I got this to work by using the eval function rather than calling rsync directly from the script. eval "rsync [...] ${PORTAGE_RSYNC_EXTRA_OPTS} . ${PORTDIR}" If I have understood bash's variable expansion correctly (which is unlikely), the current emerge-webrsync will also break if there is a space in $PORTDIR - this patch will fix this problem too.
(In reply to comment #9) > Created an attachment (id=138032) [edit] > patch to quote variable contents properly I don't think there's any need to use eval. I will add quoting for PORTDIR, like "${PORTDIR%%/}". For PORTAGE_RSYNC_EXTRA_OPTS, you can quote parts of it yourself as necessary. Portage uses python's shlex module to split PORTAGE_RSYNC_EXTRA_OPTS using posix compatible shell rules (essentially the same as bash). Either of the following should work for you (among other possibilities): PORTAGE_RSYNC_EXTRA_OPTS="--filter=\"hide games-*\"" PORTAGE_RSYNC_EXTRA_OPTS="--filter='hide games-*'"
(In reply to comment #8) > Added support for PORTAGE_RSYNC_EXTRA_OPTS to emerge-webrsync That was released in portage-2.1.3.