1 |
commit: 5aa69880ca3665e633cb042d3e26f3a72536fc10 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 31 23:37:43 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 31 23:37:43 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5aa69880 |
7 |
|
8 |
rsync: if local state is unchanged then skip verification |
9 |
|
10 |
pym/portage/sync/modules/rsync/rsync.py | 15 ++++++++++----- |
11 |
1 file changed, 10 insertions(+), 5 deletions(-) |
12 |
|
13 |
diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py |
14 |
index 69e4be734..e2e6d0658 100644 |
15 |
--- a/pym/portage/sync/modules/rsync/rsync.py |
16 |
+++ b/pym/portage/sync/modules/rsync/rsync.py |
17 |
@@ -123,7 +123,7 @@ class RsyncSync(NewBase): |
18 |
if syncuri.startswith("file://"): |
19 |
self.proto = "file" |
20 |
dosyncuri = syncuri[7:] |
21 |
- is_synced, exitcode, updatecache_flg = self._do_rsync( |
22 |
+ unchanged, is_synced, exitcode, updatecache_flg = self._do_rsync( |
23 |
dosyncuri, timestamp, opts) |
24 |
self._process_exitcode(exitcode, dosyncuri, out, 1) |
25 |
return (exitcode, updatecache_flg) |
26 |
@@ -219,6 +219,7 @@ class RsyncSync(NewBase): |
27 |
if effective_maxretries < 0: |
28 |
effective_maxretries = len(uris) - 1 |
29 |
|
30 |
+ local_state_unchanged = True |
31 |
while (1): |
32 |
if uris: |
33 |
dosyncuri = uris.pop() |
34 |
@@ -255,8 +256,10 @@ class RsyncSync(NewBase): |
35 |
if dosyncuri.startswith('ssh://'): |
36 |
dosyncuri = dosyncuri[6:].replace('/', ':/', 1) |
37 |
|
38 |
- is_synced, exitcode, updatecache_flg = self._do_rsync( |
39 |
+ unchanged, is_synced, exitcode, updatecache_flg = self._do_rsync( |
40 |
dosyncuri, timestamp, opts) |
41 |
+ if not unchanged: |
42 |
+ local_state_unchanged = False |
43 |
if is_synced: |
44 |
break |
45 |
|
46 |
@@ -272,7 +275,7 @@ class RsyncSync(NewBase): |
47 |
self._process_exitcode(exitcode, dosyncuri, out, maxretries) |
48 |
|
49 |
# if synced successfully, verify now |
50 |
- if exitcode == 0 and self.verify_metamanifest: |
51 |
+ if exitcode == 0 and not local_state_unchanged and self.verify_metamanifest: |
52 |
command = ['gemato', 'verify', '-s', self.repo.location] |
53 |
if self.repo.openpgp_key_path is not None: |
54 |
command += ['-K', self.repo.openpgp_key_path] |
55 |
@@ -437,6 +440,7 @@ class RsyncSync(NewBase): |
56 |
if "--debug" in opts: |
57 |
print(rsynccommand) |
58 |
|
59 |
+ local_state_unchanged = False |
60 |
exitcode = os.EX_OK |
61 |
servertimestamp = 0 |
62 |
# Even if there's no timestamp available locally, fetch the |
63 |
@@ -521,6 +525,7 @@ class RsyncSync(NewBase): |
64 |
|
65 |
if exitcode == os.EX_OK: |
66 |
if (servertimestamp != 0) and (servertimestamp == timestamp): |
67 |
+ local_state_unchanged = True |
68 |
is_synced = True |
69 |
self.logger(self.xterm_titles, |
70 |
">>> Cancelling sync -- Already current.") |
71 |
@@ -532,7 +537,6 @@ class RsyncSync(NewBase): |
72 |
print(">>> In order to force sync, remove '%s'." % self.servertimestampfile) |
73 |
print(">>>") |
74 |
print() |
75 |
- return is_synced, exitcode, updatecache_flg |
76 |
elif (servertimestamp != 0) and (servertimestamp < timestamp): |
77 |
self.logger(self.xterm_titles, |
78 |
">>> Server out of date: %s" % syncuri) |
79 |
@@ -599,4 +603,5 @@ class RsyncSync(NewBase): |
80 |
# --prune-empty-directories. Retry for a server that supports |
81 |
# at least rsync protocol version 29 (>=rsync-2.6.4). |
82 |
pass |
83 |
- return is_synced, exitcode, updatecache_flg |
84 |
+ |
85 |
+ return local_state_unchanged, is_synced, exitcode, updatecache_flg |