1 |
Fix flaws in logic involving the updatecache_flg variable, in order |
2 |
to skip metadata-transfer when sync fails (or the server timestamp |
3 |
has not changed). |
4 |
|
5 |
X-Gentoo-Bug: 564988 |
6 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=564988 |
7 |
--- |
8 |
pym/portage/sync/modules/rsync/rsync.py | 17 ++++++++++------- |
9 |
1 file changed, 10 insertions(+), 7 deletions(-) |
10 |
|
11 |
diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py |
12 |
index 8ae8a5c..e0f76b3 100644 |
13 |
--- a/pym/portage/sync/modules/rsync/rsync.py |
14 |
+++ b/pym/portage/sync/modules/rsync/rsync.py |
15 |
@@ -112,10 +112,10 @@ class RsyncSync(NewBase): |
16 |
if syncuri.startswith("file://"): |
17 |
self.proto = "file" |
18 |
dosyncuri = syncuri[6:] |
19 |
- is_synced, exitcode = self._do_rsync( |
20 |
+ is_synced, exitcode, updatecache_flg = self._do_rsync( |
21 |
dosyncuri, timestamp, opts) |
22 |
self._process_exitcode(exitcode, dosyncuri, out, 1) |
23 |
- return (exitcode, exitcode == os.EX_OK) |
24 |
+ return (exitcode, updatecache_flg) |
25 |
|
26 |
retries=0 |
27 |
try: |
28 |
@@ -138,7 +138,7 @@ class RsyncSync(NewBase): |
29 |
else: |
30 |
# getaddrinfo needs the brackets stripped |
31 |
getaddrinfo_host = hostname[1:-1] |
32 |
- updatecache_flg=True |
33 |
+ updatecache_flg = False |
34 |
all_rsync_opts = set(self.rsync_opts) |
35 |
all_rsync_opts.update(self.extra_rsync_opts) |
36 |
|
37 |
@@ -240,7 +240,8 @@ class RsyncSync(NewBase): |
38 |
if dosyncuri.startswith('ssh://'): |
39 |
dosyncuri = dosyncuri[6:].replace('/', ':/', 1) |
40 |
|
41 |
- is_synced, exitcode = self._do_rsync(dosyncuri, timestamp, opts) |
42 |
+ is_synced, exitcode, updatecache_flg = self._do_rsync( |
43 |
+ dosyncuri, timestamp, opts) |
44 |
if is_synced: |
45 |
break |
46 |
|
47 |
@@ -251,7 +252,6 @@ class RsyncSync(NewBase): |
48 |
else: |
49 |
# over retries |
50 |
# exit loop |
51 |
- updatecache_flg=False |
52 |
exitcode = EXCEEDED_MAX_RETRIES |
53 |
break |
54 |
self._process_exitcode(exitcode, dosyncuri, out, maxretries) |
55 |
@@ -382,6 +382,7 @@ class RsyncSync(NewBase): |
56 |
|
57 |
|
58 |
def _do_rsync(self, syncuri, timestamp, opts): |
59 |
+ updatecache_flg = False |
60 |
is_synced = False |
61 |
if timestamp != 0 and "--quiet" not in opts: |
62 |
print(">>> Checking server timestamp ...") |
63 |
@@ -489,7 +490,7 @@ class RsyncSync(NewBase): |
64 |
print(">>> In order to force sync, remove '%s'." % self.servertimestampfile) |
65 |
print(">>>") |
66 |
print() |
67 |
- return is_synced, exitcode |
68 |
+ return is_synced, exitcode, updatecache_flg |
69 |
elif (servertimestamp != 0) and (servertimestamp < timestamp): |
70 |
self.logger(self.xterm_titles, |
71 |
">>> Server out of date: %s" % syncuri) |
72 |
@@ -543,6 +544,8 @@ class RsyncSync(NewBase): |
73 |
os.unlink(self.servertimestampfile) |
74 |
except OSError: |
75 |
pass |
76 |
+ else: |
77 |
+ updatecache_flg = True |
78 |
|
79 |
if exitcode in [0,1,3,4,11,14,20,21]: |
80 |
is_synced = True |
81 |
@@ -554,4 +557,4 @@ class RsyncSync(NewBase): |
82 |
# --prune-empty-directories. Retry for a server that supports |
83 |
# at least rsync protocol version 29 (>=rsync-2.6.4). |
84 |
pass |
85 |
- return is_synced, exitcode |
86 |
+ return is_synced, exitcode, updatecache_flg |
87 |
-- |
88 |
2.4.9 |