If "sync-rsync-vcs-ignore = true" is set in repos.conf, then ignore
any vcs directories that may be present. It is the user's responsibility
to set sync-rsync-extra-opts to protect vcs directories if appropriate.

X-Gentoo-Bug: 296085
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=296085
---
 man/portage.5                              |  6 ++++++
 pym/portage/repository/config.py           |  3 ++-
 pym/portage/sync/modules/rsync/__init__.py |  5 ++++-
 pym/portage/sync/modules/rsync/rsync.py    | 11 ++++++++---
 4 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/man/portage.5 b/man/portage.5
index e84142a..8e2be4f 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -1026,6 +1026,12 @@ is provided, Portage no longer uses owner of the 
directory.
 Extra options to give to rsync on repository synchronization. It takes
 precedence over a declaration in [DEFAULT] section, that takes
 precedence over PORTAGE_RSYNC_EXTRA_OPTS.
+.TP
+.B sync-rsync-vcs-ignore = true|false
+Ignore vcs directories that may be present in the repository. It is the
+user's responsibility to set sync-rsync-extra-opts to protect vcs
+directories if appropriate.
+
 .RE
 
 .I Example:
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index a416882..f80bee6 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -601,7 +601,8 @@ class RepoConfigLoader(object):
 
                        repo = RepoConfig(sname, optdict, 
local_config=local_config)
                        for o in portage.sync.module_specific_options(repo):
-                               repo.set_module_specific_opt(o, 
parser.get(sname, o))
+                               if parser.has_option(sname, o):
+                                       repo.set_module_specific_opt(o, 
parser.get(sname, o))
 
                        # Perform repos.conf sync variable validation
                        portage.sync.validate_config(repo, logging)
diff --git a/pym/portage/sync/modules/rsync/__init__.py 
b/pym/portage/sync/modules/rsync/__init__.py
index f2bad09..b863463 100644
--- a/pym/portage/sync/modules/rsync/__init__.py
+++ b/pym/portage/sync/modules/rsync/__init__.py
@@ -23,7 +23,10 @@ module_spec = {
                                'exists': 'Returns a boolean if the specified 
directory exists',
                                },
                        'validate_config': CheckSyncConfig,
-                       'module_specific_options': ('sync-rsync-extra-opts',),
+                       'module_specific_options': (
+                               'sync-rsync-extra-opts',
+                               'sync-rsync-vcs-ignore',
+                               ),
                        }
                }
        }
diff --git a/pym/portage/sync/modules/rsync/rsync.py 
b/pym/portage/sync/modules/rsync/rsync.py
index f08bf5c..8ae8a5c 100644
--- a/pym/portage/sync/modules/rsync/rsync.py
+++ b/pym/portage/sync/modules/rsync/rsync.py
@@ -55,12 +55,17 @@ class RsyncSync(NewBase):
                enter_invalid = '--ask-enter-invalid' in opts
                out = portage.output.EOutput()
                syncuri = self.repo.sync_uri
-               vcs_dirs = frozenset(VCS_DIRS)
-               vcs_dirs = vcs_dirs.intersection(os.listdir(self.repo.location))
+               if self.repo.module_specific_options.get(
+                       'sync-rsync-vcs-ignore', 'false').lower() == 'true':
+                       vcs_dirs = ()
+               else:
+                       vcs_dirs = frozenset(VCS_DIRS)
+                       vcs_dirs = 
vcs_dirs.intersection(os.listdir(self.repo.location))
 
                for vcs_dir in vcs_dirs:
                        writemsg_level(("!!! %s appears to be under revision " 
+ \
-                               "control (contains %s).\n!!! Aborting rsync 
sync.\n") % \
+                               "control (contains %s).\n!!! Aborting rsync 
sync "
+                               "(override with \"sync-rsync-vcs-ignore = 
true\" in repos.conf).\n") % \
                                (self.repo.location, vcs_dir), 
level=logging.ERROR, noiselevel=-1)
                        return (1, False)
                self.timeout=180
-- 
2.4.6


Reply via email to