[sulfur] improve orphaned packages handling

This commit is contained in:
Fabio Erculiani
2010-02-03 09:00:53 +01:00
parent 6c82fa7977
commit fa0d76d1ad
3 changed files with 21 additions and 11 deletions
+9 -9
View File
@@ -1684,6 +1684,14 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
self.ui.rbUpdatesSimpleLabel.set_markup(txt_adv)
self.ui.rbUpdatesLabel.set_markup(txt_adv)
def _show_packages_group_caching(self):
for k in ("installed", "reinstallable", "masked",
"user_unmasked", "downgrade"):
try:
self.etpbase.get_groups(k)
except ProgrammingError:
continue
def show_packages(self, back_to_page = None, on_init = False):
action = self.lastPkgPB
@@ -1699,15 +1707,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
if action == "updates":
# speed up first queue taint iteration
self.etpbase.get_groups("available")
def do_more_caching():
for k in ("installed", "reinstallable", "masked",
"user_unmasked", "downgrade"):
try:
self.etpbase.get_groups(k)
except ProgrammingError:
continue
return False
gobject.idle_add(do_more_caching)
gobject.idle_add(self._show_packages_group_caching)
# set updates label
raw_updates = len(self.etpbase.get_raw_groups('updates'))
+7 -2
View File
@@ -156,8 +156,13 @@ class EntropyPackage:
def __str__(self):
if self.pkgset:
return self.matched_atom
return str(self.dbconn.retrieveAtom(self.matched_id) + "~" + \
str(self.dbconn.retrieveRevision(self.matched_id)))
return str(self.dbconn.retrieveAtom(self.matched_id) + \
etpConst['entropyrevisionprefix'] + \
str(self.dbconn.retrieveRevision(self.matched_id))) + \
etpConst['entropyrepoprefix'] + self.repoid_clean
def __repr__(self):
return "<EntropyPackage at %s @ %s>" % (id(self), str(self),)
def __cmp__(self, pkg):
if pkg.matched_atom == self.matched_atom:
+5
View File
@@ -690,6 +690,11 @@ class EntropyPackages:
return yp
def _pkg_get_orphans(self):
# make sure we have these configured
self.get_groups("installed")
self.get_groups("reinstallable")
updates, remove, fine, spm_fine = self.Entropy.calculate_updates(
critical_updates = False)
# Filter out packages installed from unavailable repositories, this is