Current portage uses a hardcoded list of options supplemented by a few variable options based on make.conf settings and command line arguments for `emerge --sync`. While this is sufficient for most cases in some situations people want/need more control over the rsync commandline (e.g. some people don't like --delete or --wholefile as defaults, others want to sync against a local mirror via ssh). So instead of ading even more specific config vars for all rsync options the attached patch adds a new general variable PORTAGE_RSYNC_OPTS that defines the options used for rsync, with the default in make.globals resembling the current hardcoded list. Other existing RSYNC_* options will be still be used but deprecated. It also includes a sanity check to enforce vital options. This approach has one main problem: people who just want to add options have to also specify the whole default list from make.globals making it somewhat error-prone, though that could be solved by using two vars (_OPTS and _EXTRA_OPTS). I CC'ed infra to get a statement which options should be enforced for official mirrors, currently these are: --recursive (always enforced) --times (always enforced) --timeout (though people could still use --timeout=0, that's no regression however) --compress (enforced for .gentoo.org servers only) --whole-file (enforced for .gentoo.org servers only) --exclude='{distfiles,packages,local}' (enforced for .gentoo.org servers only) From the current hardcoded list the following options are not enforced: --links --safe-links --perms --force --delete --delete-after --stats I've assembled these lists more or less arbitrary, so don't hesitate to call me an idiot if I misassigned something ;)
Created attachment 79915 [details, diff] Patch to add PORTAGE_RSYNC_OPTS support
Looks good but please keep the --exclude= enforced all the time. I think the chances for mistakes to happen here to are to large. For example I use official mirrors to sync with but none of those are named *.gentoo.org. They come in the form of (IP addresses || FQDN's)
(In reply to comment #2) > Looks good but please keep the --exclude= enforced all the time. > > I think the chances for mistakes to happen here to are to large. > For example I use official mirrors to sync with but none of those > are named *.gentoo.org. They come in the form of (IP addresses || FQDN's) Hmm, might do that if --exclude can be overridden with a later --include, reason for not having done so yet is that I've seen at least one comment in the past where someone wanted to include packages and/or distfiles in --sync (local mirror). I agree that it would probably be one of the bigger sources for errors.
Created attachment 80151 [details, diff] Updated patch always appending --exclude stuff and adding PORTAGE_RSYNC_EXTRA_OPTS Ok, --exclude=foo can be overridden by clearing the exclude pattern list with --exclude=!, so --exclude=/{distfiles,local,packages} are now always enforced.
(In reply to comment #2) > Looks good but please keep the --exclude= enforced all the time. Btw, was that an official OK from infra or just your personal opinion?
Well I was commenting on the code as it looked rather interesting to me, and similer to hacks I've done in the past but yours is cleaner and more complete. I asked infra. Mainly the only one I could of seen having any effect infra wise would of been the --compress option. but... <cshields> solar: many rsync server have (or should have) compression turned off which would trump the client <solar> if that is the case then the patch seems good to me from all POVs <solar> anything you see there that would be a concern? <cshields> not right now, but I'm still waking up
sounds fine. </official infra stance>
*** Bug 128413 has been marked as a duplicate of this bug. ***
Released in 2.1_pre7.