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