From 097cc4dbfbe39eba8cf27e29cffdb0c9b44c7dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Sat, 22 May 2010 17:29:20 +0000 Subject: [PATCH] api/update_repo(s): Update caches when index is really updated --- pisi/api.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 7b5a645e..28687804 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -810,15 +810,18 @@ def remove_repo(name): @locked def update_repos(repos, force=False): pisi.db.historydb.HistoryDB().create_history("repoupdate") + updated = False for repo in repos: - __update_repo(repo, force) - pisi.db.regenerate_caches() + updated |= __update_repo(repo, force) + if updated: + pisi.db.regenerate_caches() @locked def update_repo(repo, force=False): pisi.db.historydb.HistoryDB().create_history("repoupdate") - __update_repo(repo, force) - pisi.db.regenerate_caches() + updated = __update_repo(repo, force) + if updated: + pisi.db.regenerate_caches() def __update_repo(repo, force=False): ctx.ui.action(_('Updating repository: %s') % repo) @@ -835,7 +838,7 @@ def __update_repo(repo, force=False): ctx.ui.info(_('Updating database at any rate as requested')) index.read_uri_of_repo(repouri, repo, force = force) else: - return + return False pisi.db.historydb.HistoryDB().update_repo(repo, repouri, "update") repodb.check_distribution(repo) @@ -849,6 +852,8 @@ def __update_repo(repo, force=False): else: raise pisi.Error(_('No repository named %s found.') % repo) + return True + # FIXME: rebuild_db is only here for filesdb and it really is ugly. we should not need any rebuild. @locked def rebuild_db(files=False):