[entropy.client] move UGC information storage outside the main entropy lib

This commit is contained in:
Fabio Erculiani
2010-01-03 23:18:41 +01:00
parent df1829e076
commit 6d89177836
3 changed files with 14 additions and 20 deletions
+6
View File
@@ -179,8 +179,14 @@ def _do_sync(entropy_client, repo_identifiers = None, force = False):
rc = repo_intf.sync()
if not rc:
for reponame in repo_identifiers:
# inform UGC that we are syncing this repo
if entropy_client.UGC is not None:
entropy_client.UGC.add_download_stats(reponame, [reponame])
for reponame in repo_identifiers:
_show_notice_board_summary(entropy_client, reponame)
return rc
def _check_notice_board_availability(entropy_client, reponame):
@@ -1223,7 +1223,7 @@ class Repository:
return gpg_rc
def run_sync(self):
def _run_sync(self):
self.updated = False
repocount = 0
@@ -1448,10 +1448,6 @@ class Repository:
# database has been updated
self.updated = True
# inform UGC that we are syncing this repo
if self.Entropy.UGC is not None:
self.Entropy.UGC.add_download_stats(repo, [repo])
# remove garbage left around
for path in files_to_remove:
try:
@@ -2072,7 +2068,7 @@ class Repository:
if not acquired:
return 4 # app locked during lock acquire
try:
rc = self.run_sync()
rc = self._run_sync()
finally:
self.Entropy.resources_remove_lock()
if rc:
+6 -14
View File
@@ -1205,26 +1205,13 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
try:
repoConn = self.Equo.Repositories(repos, force = force)
except PermissionDenied:
self.progress_log(_('You must run this application as root'),
extra = "repositories")
self.disable_ugc = False
self.show_notebook_tabs_after_install()
return 1
except MissingParameter:
except AttributeError:
msg = "%s: %s" % (_('No repositories specified in'),
etpConst['repositoriesconf'],)
self.progress_log( msg, extra = "repositories")
self.disable_ugc = False
self.show_notebook_tabs_after_install()
return 127
except OnlineMirrorError:
self.progress_log(
_('You are not connected to the Internet. You should.'),
extra = "repositories")
self.disable_ugc = False
self.show_notebook_tabs_after_install()
return 126
except Exception as e:
msg = "%s: %s" % (_('Unhandled exception'), e,)
self.progress_log(msg, extra = "repositories")
@@ -1245,6 +1232,11 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
self.gtk_loop()
rc = self.__repo_update_rc
for repo in repos:
# inform UGC that we are syncing this repo
if self.Equo.UGC is not None:
self.Equo.UGC.add_download_stats(repo, [repo])
if repoConn.sync_errors or (rc != 0):
self.progress.set_mainLabel(_('Errors updating repositories.'))
self.progress.set_subLabel(