1 |
If "sync-rsync-vcs-ignore = true" is set in repos.conf, then ignore |
2 |
any vcs directories that may be present. It is the user's responsibility |
3 |
to set sync-rsync-extra-opts to protect vcs directories if appropriate. |
4 |
|
5 |
X-Gentoo-Bug: 296085 |
6 |
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=296085 |
7 |
--- |
8 |
man/portage.5 | 6 ++++++ |
9 |
pym/portage/repository/config.py | 3 ++- |
10 |
pym/portage/sync/modules/rsync/__init__.py | 5 ++++- |
11 |
pym/portage/sync/modules/rsync/rsync.py | 11 ++++++++--- |
12 |
4 files changed, 20 insertions(+), 5 deletions(-) |
13 |
|
14 |
diff --git a/man/portage.5 b/man/portage.5 |
15 |
index e84142a..8e2be4f 100644 |
16 |
--- a/man/portage.5 |
17 |
+++ b/man/portage.5 |
18 |
@@ -1026,6 +1026,12 @@ is provided, Portage no longer uses owner of the directory. |
19 |
Extra options to give to rsync on repository synchronization. It takes |
20 |
precedence over a declaration in [DEFAULT] section, that takes |
21 |
precedence over PORTAGE_RSYNC_EXTRA_OPTS. |
22 |
+.TP |
23 |
+.B sync-rsync-vcs-ignore = true|false |
24 |
+Ignore vcs directories that may be present in the repository. It is the |
25 |
+user's responsibility to set sync-rsync-extra-opts to protect vcs |
26 |
+directories if appropriate. |
27 |
+ |
28 |
.RE |
29 |
|
30 |
.I Example: |
31 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
32 |
index a416882..f80bee6 100644 |
33 |
--- a/pym/portage/repository/config.py |
34 |
+++ b/pym/portage/repository/config.py |
35 |
@@ -601,7 +601,8 @@ class RepoConfigLoader(object): |
36 |
|
37 |
repo = RepoConfig(sname, optdict, local_config=local_config) |
38 |
for o in portage.sync.module_specific_options(repo): |
39 |
- repo.set_module_specific_opt(o, parser.get(sname, o)) |
40 |
+ if parser.has_option(sname, o): |
41 |
+ repo.set_module_specific_opt(o, parser.get(sname, o)) |
42 |
|
43 |
# Perform repos.conf sync variable validation |
44 |
portage.sync.validate_config(repo, logging) |
45 |
diff --git a/pym/portage/sync/modules/rsync/__init__.py b/pym/portage/sync/modules/rsync/__init__.py |
46 |
index f2bad09..b863463 100644 |
47 |
--- a/pym/portage/sync/modules/rsync/__init__.py |
48 |
+++ b/pym/portage/sync/modules/rsync/__init__.py |
49 |
@@ -23,7 +23,10 @@ module_spec = { |
50 |
'exists': 'Returns a boolean if the specified directory exists', |
51 |
}, |
52 |
'validate_config': CheckSyncConfig, |
53 |
- 'module_specific_options': ('sync-rsync-extra-opts',), |
54 |
+ 'module_specific_options': ( |
55 |
+ 'sync-rsync-extra-opts', |
56 |
+ 'sync-rsync-vcs-ignore', |
57 |
+ ), |
58 |
} |
59 |
} |
60 |
} |
61 |
diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py |
62 |
index f08bf5c..8ae8a5c 100644 |
63 |
--- a/pym/portage/sync/modules/rsync/rsync.py |
64 |
+++ b/pym/portage/sync/modules/rsync/rsync.py |
65 |
@@ -55,12 +55,17 @@ class RsyncSync(NewBase): |
66 |
enter_invalid = '--ask-enter-invalid' in opts |
67 |
out = portage.output.EOutput() |
68 |
syncuri = self.repo.sync_uri |
69 |
- vcs_dirs = frozenset(VCS_DIRS) |
70 |
- vcs_dirs = vcs_dirs.intersection(os.listdir(self.repo.location)) |
71 |
+ if self.repo.module_specific_options.get( |
72 |
+ 'sync-rsync-vcs-ignore', 'false').lower() == 'true': |
73 |
+ vcs_dirs = () |
74 |
+ else: |
75 |
+ vcs_dirs = frozenset(VCS_DIRS) |
76 |
+ vcs_dirs = vcs_dirs.intersection(os.listdir(self.repo.location)) |
77 |
|
78 |
for vcs_dir in vcs_dirs: |
79 |
writemsg_level(("!!! %s appears to be under revision " + \ |
80 |
- "control (contains %s).\n!!! Aborting rsync sync.\n") % \ |
81 |
+ "control (contains %s).\n!!! Aborting rsync sync " |
82 |
+ "(override with \"sync-rsync-vcs-ignore = true\" in repos.conf).\n") % \ |
83 |
(self.repo.location, vcs_dir), level=logging.ERROR, noiselevel=-1) |
84 |
return (1, False) |
85 |
self.timeout=180 |
86 |
-- |
87 |
2.4.6 |