From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] RsyncSync: add sync-rsync-vcs-ignore option (bug 296085)
Date: Sat, 29 Aug 2015 14:06:12 -0700 [thread overview]
Message-ID: <1440882372-7236-1-git-send-email-zmedico@gentoo.org> (raw)
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
next reply other threads:[~2015-08-29 21:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-29 21:06 Zac Medico [this message]
2015-08-30 20:05 ` [gentoo-portage-dev] [PATCH] RsyncSync: add sync-rsync-vcs-ignore option (bug 296085) Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440882372-7236-1-git-send-email-zmedico@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox