diff options
| author | Julian Andres Klode <jak@debian.org> | 2010-04-21 15:52:58 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2010-04-21 15:52:58 +0200 |
| commit | 497226deabdc9c4e797d7da86fe7b0ce6038bf75 (patch) | |
| tree | 3cafcb906160af4ad3cf608730c9e5192919d1fc /apt/cache.py | |
| parent | c997f18dbcbbe156aa34af408a62a4b74f58f41d (diff) | |
| download | python-apt-497226deabdc9c4e797d7da86fe7b0ce6038bf75.tar.gz | |
apt/cache.py: Make Cache.req_reinstall_pkgs much faster as well.
Diffstat (limited to 'apt/cache.py')
| -rw-r--r-- | apt/cache.py | 10 |
1 files changed, 6 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 |
