From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 52E431384C0 for ; Sat, 29 Aug 2015 21:06:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2C7E614211; Sat, 29 Aug 2015 21:06:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9B80A1420E for ; Sat, 29 Aug 2015 21:06:36 +0000 (UTC) Received: from x202e.gaikai.biz, (ip174-67-205-96.oc.oc.cox.net [174.67.205.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 7AF6234086C; Sat, 29 Aug 2015 21:06:35 +0000 (UTC) From: Zac Medico To: gentoo-portage-dev@lists.gentoo.org Cc: Zac Medico Subject: [gentoo-portage-dev] [PATCH] RsyncSync: add sync-rsync-vcs-ignore option (bug 296085) Date: Sat, 29 Aug 2015 14:06:12 -0700 Message-Id: <1440882372-7236-1-git-send-email-zmedico@gentoo.org> X-Mailer: git-send-email 2.4.6 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: 46f69b77-1bc7-478a-9e64-0d655c910266 X-Archives-Hash: acf547718b7237c57803e66a529257d8 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