From 497226deabdc9c4e797d7da86fe7b0ce6038bf75 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 21 Apr 2010 15:52:58 +0200 Subject: apt/cache.py: Make Cache.req_reinstall_pkgs much faster as well. --- apt/cache.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'apt/cache.py') 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 -- cgit v1.2.3