public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] RsyncSync: add sync-rsync-vcs-ignore option (bug 296085)
@ 2015-08-29 21:06 Zac Medico
  2015-08-30 20:05 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2015-08-29 21:06 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-30 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-29 21:06 [gentoo-portage-dev] [PATCH] RsyncSync: add sync-rsync-vcs-ignore option (bug 296085) Zac Medico
2015-08-30 20:05 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox