1 |
commit: 860b7f9d703c080451892f5d988636320bb11bc8 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Feb 1 09:27:22 2018 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 5 18:40:24 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=860b7f9d |
7 |
|
8 |
rsync: Verify the value of sync-rsync-verify-jobs |
9 |
|
10 |
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org> |
11 |
|
12 |
pym/portage/sync/modules/rsync/rsync.py | 11 ++++++++++- |
13 |
1 file changed, 10 insertions(+), 1 deletion(-) |
14 |
|
15 |
diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py |
16 |
index 4471f5bbe..ec28af366 100644 |
17 |
--- a/pym/portage/sync/modules/rsync/rsync.py |
18 |
+++ b/pym/portage/sync/modules/rsync/rsync.py |
19 |
@@ -92,6 +92,15 @@ class RsyncSync(NewBase): |
20 |
# Support overriding job count. |
21 |
self.verify_jobs = self.repo.module_specific_options.get( |
22 |
'sync-rsync-verify-jobs', None) |
23 |
+ if self.verify_jobs is not None: |
24 |
+ try: |
25 |
+ self.verify_jobs = int(self.verify_jobs) |
26 |
+ if self.verify_jobs <= 0: |
27 |
+ raise ValueError(self.verify_jobs) |
28 |
+ except ValueError: |
29 |
+ writemsg_level("!!! sync-rsync-verify-jobs not a positive integer: %s\n" % (self.verify_jobs,), |
30 |
+ level=logging.WARNING, noiselevel=-1) |
31 |
+ self.verify_jobs = None |
32 |
|
33 |
# Real local timestamp file. |
34 |
self.servertimestampfile = os.path.join( |
35 |
@@ -280,7 +289,7 @@ class RsyncSync(NewBase): |
36 |
if self.repo.sync_openpgp_key_path is not None: |
37 |
command += ['-K', self.repo.sync_openpgp_key_path] |
38 |
if self.verify_jobs is not None: |
39 |
- command += ['-j', self.verify_jobs] |
40 |
+ command += ['-j', str(self.verify_jobs)] |
41 |
try: |
42 |
exitcode = portage.process.spawn(command, **self.spawn_kwargs) |
43 |
except CommandNotFound as e: |