api/update_repo(s): Update caches when index is really updated
This commit is contained in:
+10
-5
@@ -810,15 +810,18 @@ def remove_repo(name):
|
|||||||
@locked
|
@locked
|
||||||
def update_repos(repos, force=False):
|
def update_repos(repos, force=False):
|
||||||
pisi.db.historydb.HistoryDB().create_history("repoupdate")
|
pisi.db.historydb.HistoryDB().create_history("repoupdate")
|
||||||
|
updated = False
|
||||||
for repo in repos:
|
for repo in repos:
|
||||||
__update_repo(repo, force)
|
updated |= __update_repo(repo, force)
|
||||||
pisi.db.regenerate_caches()
|
if updated:
|
||||||
|
pisi.db.regenerate_caches()
|
||||||
|
|
||||||
@locked
|
@locked
|
||||||
def update_repo(repo, force=False):
|
def update_repo(repo, force=False):
|
||||||
pisi.db.historydb.HistoryDB().create_history("repoupdate")
|
pisi.db.historydb.HistoryDB().create_history("repoupdate")
|
||||||
__update_repo(repo, force)
|
updated = __update_repo(repo, force)
|
||||||
pisi.db.regenerate_caches()
|
if updated:
|
||||||
|
pisi.db.regenerate_caches()
|
||||||
|
|
||||||
def __update_repo(repo, force=False):
|
def __update_repo(repo, force=False):
|
||||||
ctx.ui.action(_('Updating repository: %s') % repo)
|
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'))
|
ctx.ui.info(_('Updating database at any rate as requested'))
|
||||||
index.read_uri_of_repo(repouri, repo, force = force)
|
index.read_uri_of_repo(repouri, repo, force = force)
|
||||||
else:
|
else:
|
||||||
return
|
return False
|
||||||
|
|
||||||
pisi.db.historydb.HistoryDB().update_repo(repo, repouri, "update")
|
pisi.db.historydb.HistoryDB().update_repo(repo, repouri, "update")
|
||||||
repodb.check_distribution(repo)
|
repodb.check_distribution(repo)
|
||||||
@@ -849,6 +852,8 @@ def __update_repo(repo, force=False):
|
|||||||
else:
|
else:
|
||||||
raise pisi.Error(_('No repository named %s found.') % repo)
|
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.
|
# FIXME: rebuild_db is only here for filesdb and it really is ugly. we should not need any rebuild.
|
||||||
@locked
|
@locked
|
||||||
def rebuild_db(files=False):
|
def rebuild_db(files=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user