From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E1AD31381F3 for ; Wed, 7 Aug 2013 16:10:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CCF01E0AA5; Wed, 7 Aug 2013 16:10:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 63C49E0AA5 for ; Wed, 7 Aug 2013 16:10:14 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 66DA633EB09 for ; Wed, 7 Aug 2013 16:10:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id DF0D1E5460 for ; Wed, 7 Aug 2013 16:10:11 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1375889866.2bca3d3b9c5e2acc9aa9915bf57ccb02f7716588.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/remote/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/remote/repolist.py X-VCS-Directories: roverlay/remote/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 2bca3d3b9c5e2acc9aa9915bf57ccb02f7716588 X-VCS-Branch: master Date: Wed, 7 Aug 2013 16:10:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d0936553-c4ef-4cb2-82c0-1639d251050f X-Archives-Hash: 86aeb7ead3030b00547920ea3b1dd7f0 commit: 2bca3d3b9c5e2acc9aa9915bf57ccb02f7716588 Author: André Erdmann mailerd de> AuthorDate: Wed Aug 7 15:37:46 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Aug 7 15:37:46 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=2bca3d3b roverlay/remote/repolist, sync(): greedy on demand RepoList.sync() returns success(True/False) now. Additionally, it accepts a fail_greedy arg, which causes sync to immediately abort on failure. This behavior is disabled by default (as it used to be prior to this commit). --- roverlay/remote/repolist.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/roverlay/remote/repolist.py b/roverlay/remote/repolist.py index fac2ea5..f2eb6e7 100644 --- a/roverlay/remote/repolist.py +++ b/roverlay/remote/repolist.py @@ -203,13 +203,30 @@ class RepoList ( object ): try_call ( when_all_done ) # --- end of _sync_all_repos_and_run (...) --- - def sync ( self ): - """Syncs all repos.""" + def sync ( self, fail_greedy=False ): + """Syncs all repos. + + Returns True if sync was successful for all repos, else False. + + arguments: + * fail_greedy -- abort on first sync failure (defaults to False) + "screws" up time stats since sync_time should + include all repos + """ + all_success = True self.logger.debug ( "Syncing repos ..." ) for repo in self.repos: self.repo_stats.sync_time.begin ( repo.name ) - repo.sync ( sync_enabled=self.sync_enabled ) - self.repo_stats.sync_time.end ( repo.name ) + if repo.sync ( sync_enabled=self.sync_enabled ): + self.repo_stats.sync_time.end ( repo.name ) + elif fail_greedy: + self.repo_stats.sync_time.end ( repo.name ) + return False + else: + self.repo_stats.sync_time.end ( repo.name ) + all_success = False + # -- end for + return all_success # --- end of sync_all (...) --- def sync_and_add ( self, add_method ):