summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-04-21 15:52:58 +0200
committerJulian Andres Klode <jak@debian.org>2010-04-21 15:52:58 +0200
commit497226deabdc9c4e797d7da86fe7b0ce6038bf75 (patch)
tree3cafcb906160af4ad3cf608730c9e5192919d1fc
parentc997f18dbcbbe156aa34af408a62a4b74f58f41d (diff)
downloadpython-apt-497226deabdc9c4e797d7da86fe7b0ce6038bf75.tar.gz
apt/cache.py: Make Cache.req_reinstall_pkgs much faster as well.
-rw-r--r--apt/cache.py10
-rw-r--r--debian/changelog1
2 files changed, 7 insertions, 4 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 3b0c5f7e..5d76bca2 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -215,10 +215,12 @@ class Cache(object):
def req_reinstall_pkgs(self):
"""Return the packages not downloadable packages in reqreinst state."""
reqreinst = set()
- for pkg in self:
- if (not pkg.candidate.downloadable and
- (pkg._pkg.inst_state == apt_pkg.INSTSTATE_REINSTREQ or
- pkg._pkg.inst_state == apt_pkg.INSTSTATE_HOLD_REINSTREQ)):
+ get_candidate_ver = self._depcache.get_candidate_ver
+ states = frozenset((apt_pkg.INSTSTATE_REINSTREQ,
+ apt_pkg.INSTSTATE_HOLD_REINSTREQ))
+ for pkg in self._cache.packages:
+ cand = get_candidate_ver(pkg)
+ if cand and not cand.downloadable and pkg.inst_state in states:
reqreinst.add(pkg.name)
return reqreinst
diff --git a/debian/changelog b/debian/changelog
index c2c049c3..f3e33d7b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ python-apt (0.7.94.3) UNRELEASED; urgency=low
[ Julian Andres Klode ]
* apt/cache.py:
- Make Cache.get_changes() much (~35x) faster (Closes: #578074).
+ - Make Cache.req_reinstall_pkgs much faster as well.
* apt/package.py:
- Decode using utf-8 in installed_files (LP: #407953).
- Fix fetch_source() to work when source name = binary name (LP: #552400).