1 |
commit: a8b4e77c50d8f943b2239ce51b5e86bd589f7f31 |
2 |
Author: André Erdmann <dywi <AT> mailerd <DOT> de> |
3 |
AuthorDate: Thu Aug 2 14:51:21 2012 +0000 |
4 |
Commit: André Erdmann <dywi <AT> mailerd <DOT> de> |
5 |
CommitDate: Thu Aug 2 14:51:21 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a8b4e77c |
7 |
|
8 |
rsync: remove --delete from default opts |
9 |
|
10 |
--- |
11 |
man/roverlay-repo.5 | 8 +++++--- |
12 |
roverlay/remote/rsync.py | 30 ++++++++++++------------------ |
13 |
2 files changed, 17 insertions(+), 21 deletions(-) |
14 |
|
15 |
diff --git a/man/roverlay-repo.5 b/man/roverlay-repo.5 |
16 |
index 212aae9..08a4b52 100644 |
17 |
--- a/man/roverlay-repo.5 |
18 |
+++ b/man/roverlay-repo.5 |
19 |
@@ -24,9 +24,11 @@ It behaves like a local repo if syncing is disabled. |
20 |
These rsync options are always passed to rsync: |
21 |
.br |
22 |
\fB |
23 |
-\-\-links, \-\-safe-links, \-\-times, \-\-compress, |
24 |
-\-\-dirs, \-\-prune-empty-dirs, \-\-force, \-\-delete, |
25 |
-\-\-human-readable, \-\-stats, \-\-chmod=ugo=r,u+w,Dugo+ |
26 |
+\-\-links, \-\-safe-links, |
27 |
+\-\-times, |
28 |
+\-\-dirs, \-\-prune-empty-dirs, |
29 |
+\-\-human-readable, \-\-stats, |
30 |
+\-\-chmod=ugo=r,u+w,Dugo+ |
31 |
\fR |
32 |
.IP "\(bu websync repositories (\&'websync_repo\&')" |
33 |
A \fBwebsync repo\fR fetches an R package list (deb-control file, typically named PACKAGES) |
34 |
|
35 |
diff --git a/roverlay/remote/rsync.py b/roverlay/remote/rsync.py |
36 |
index 90f21f5..f0ffb5c 100644 |
37 |
--- a/roverlay/remote/rsync.py |
38 |
+++ b/roverlay/remote/rsync.py |
39 |
@@ -23,11 +23,10 @@ RETRY_ON_RETCODE = frozenset (( |
40 |
24, # "Partial transfer due to vanished source files" |
41 |
)) |
42 |
|
43 |
-# TODO: |
44 |
# either reraise an KeyboardInterrupt while running rsync (which stops script |
45 |
# execution unless the interrupt is catched elsewhere) or just set a |
46 |
# non-zero return code (-> 'repo cannot be used') |
47 |
-RERAISE_INTERRUPT = False |
48 |
+RERAISE_INTERRUPT = True |
49 |
|
50 |
# --recursive is not in the default opts, subdirs in CRAN/contrib are |
51 |
# either R releases (2.xx.x[-patches]) or the package archive |
52 |
@@ -35,11 +34,12 @@ DEFAULT_RSYNC_OPTS = ( |
53 |
'--links', # copy symlinks as symlinks, |
54 |
'--safe-links', # but ignore links outside of tree |
55 |
'--times', # |
56 |
- '--compress', # FIXME: add lzo if necessary |
57 |
+# '--compress', # .tar.gz ("99%" of synced files) is excluded |
58 |
+ # from --compress anyway |
59 |
'--dirs', # |
60 |
'--prune-empty-dirs', # |
61 |
- '--force', # allow deletion of non-empty dirs |
62 |
- '--delete', # |
63 |
+# '--force', # allow deletion of non-empty dirs |
64 |
+# '--delete', # --delete is no longer a default opt |
65 |
'--human-readable', # |
66 |
'--stats', # |
67 |
'--chmod=ugo=r,u+w,Dugo+x', # 0755 for transferred dirs, 0644 for files |
68 |
@@ -96,7 +96,7 @@ class RsyncRepo ( BasicRepo ): |
69 |
|
70 |
max_bw = config.get ( 'RSYNC_BWLIMIT', None ) |
71 |
if max_bw is not None: |
72 |
- argv.append ( '--bwlimit=%i' % max_bw ) |
73 |
+ argv.append ( '--bwlimit=' + str ( max_bw ) ) |
74 |
|
75 |
if self.extra_opts: |
76 |
argv.extend ( self.extra_opts ) |
77 |
@@ -142,12 +142,11 @@ class RsyncRepo ( BasicRepo ): |
78 |
# this handles retcodes like |
79 |
# * 24: "Partial transfer due to vanished source files" |
80 |
|
81 |
- # FIXME replace loop condition "retcode != 0" |
82 |
retry_count += 1 |
83 |
|
84 |
self.logger.warning ( |
85 |
- "rsync returned {!r}, retrying ({}/{})".format ( |
86 |
- retcode, retry_count, MAX_RSYNC_RETRY |
87 |
+ "rsync returned {ret!r}, retrying ({now}/{_max})".format ( |
88 |
+ ret=retcode, now=retry_count, _max=MAX_RSYNC_RETRY |
89 |
) |
90 |
) |
91 |
|
92 |
@@ -175,18 +174,13 @@ class RsyncRepo ( BasicRepo ): |
93 |
|
94 |
except Exception as e: |
95 |
# catch exceptions, log them and return False |
96 |
- ## TODO: which exceptions to catch||pass? |
97 |
self.logger.exception ( e ) |
98 |
|
99 |
self.logger.error ( |
100 |
- 'Repo %s cannot be used for ebuild creation due to errors ' |
101 |
- 'while running rsync (return code was %s).' % ( self.name, retcode ) |
102 |
- ) |
103 |
+ 'Repo {name} cannot be used for ebuild creation due to errors ' |
104 |
+ 'while running rsync (return code was {ret}).'.format ( |
105 |
+ name=self.name, ret=retcode |
106 |
+ ) ) |
107 |
self._set_fail() |
108 |
return False |
109 |
# --- end of _dosync (...) --- |
110 |
- |
111 |
- def __str__ ( self ): |
112 |
- return "rsync repo '%s': DISTDIR '%s', SRC_URI '%s', RSYNC_URI '%s'" \ |
113 |
- % ( self.name, self.distdir, self.src_uri, self.remote_uri ) |
114 |
- # --- end of __str__ (...) --- |