Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 122996

Summary: use new PORTAGE_RSYNC_OPTS variable instead of hardcoded defaults
Product: Portage Development Reporter: Marius Mauch (RETIRED) <genone>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: enhancement CC: gentoo, infra-bugs
Priority: High Keywords: InVCS
Version: 2.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 115839    
Attachments: Patch to add PORTAGE_RSYNC_OPTS support
Updated patch always appending --exclude stuff and adding PORTAGE_RSYNC_EXTRA_OPTS

Description Marius Mauch (RETIRED) gentoo-dev 2006-02-16 01:51:51 UTC
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 ;)
Comment 1 Marius Mauch (RETIRED) gentoo-dev 2006-02-16 01:53:26 UTC
Created attachment 79915 [details, diff]
Patch to add PORTAGE_RSYNC_OPTS support
Comment 2 solar (RETIRED) gentoo-dev 2006-02-16 05:05:38 UTC
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)
Comment 3 Marius Mauch (RETIRED) gentoo-dev 2006-02-16 10:09:56 UTC
(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.
Comment 4 Marius Mauch (RETIRED) gentoo-dev 2006-02-19 00:20:26 UTC
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.
Comment 5 Marius Mauch (RETIRED) gentoo-dev 2006-02-19 00:22:42 UTC
(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?
Comment 6 solar (RETIRED) gentoo-dev 2006-02-19 10:42:36 UTC
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

Comment 7 Kurt Lieber (RETIRED) gentoo-dev 2006-02-19 11:57:36 UTC
sounds fine.
</official infra stance>
Comment 8 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-04-01 10:43:40 UTC
*** Bug 128413 has been marked as a duplicate of this bug. ***
Comment 9 Zac Medico gentoo-dev 2006-04-01 11:03:14 UTC
Released in 2.1_pre7.