diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-07-23 18:34:29 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-07-23 18:34:29 -0700 |
commit | 431d9054b74282e7d5d8b96d7eeaefaaab3f18a4 (patch) | |
tree | 5dd5fa796e6183a00d6e7477cc04ae0369b4e805 | |
parent | 87df7332c631b96a2d238abd2526eb5bb1a6e4f6 (diff) | |
download | portage-431d9054b74282e7d5d8b96d7eeaefaaab3f18a4.tar.gz portage-431d9054b74282e7d5d8b96d7eeaefaaab3f18a4.tar.bz2 portage-431d9054b74282e7d5d8b96d7eeaefaaab3f18a4.zip |
LibraryConsumerSet: handle KeyError from dbapi
-rw-r--r-- | pym/portage/_sets/libs.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/pym/portage/_sets/libs.py b/pym/portage/_sets/libs.py index 3543b8d15..6c5babc13 100644 --- a/pym/portage/_sets/libs.py +++ b/pym/portage/_sets/libs.py @@ -1,12 +1,12 @@ -# Copyright 2007 Gentoo Foundation +# Copyright 2007-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function from portage.localization import _ from portage._sets.base import PackageSet -from portage._sets import get_boolean -from portage.versions import catpkgsplit +from portage._sets import get_boolean, SetConfigError +from portage.versions import cpv_getkey import portage class LibraryConsumerSet(PackageSet): @@ -20,11 +20,16 @@ class LibraryConsumerSet(PackageSet): def mapPathsToAtoms(self, paths): rValue = set() for p in paths: - owners = self.dbapi._linkmap.getOwners(p) - for cpv in owners: - cat, pn = catpkgsplit(cpv)[:2] - slot, = self.dbapi.aux_get(cpv, ["SLOT"]) - rValue.add("%s/%s:%s" % (cat, pn, slot)) + for cpv in self.dbapi._linkmap.getOwners(p): + try: + slot, = self.dbapi.aux_get(cpv, ["SLOT"]) + except KeyError: + # This is expected for preserved libraries + # of packages that have been uninstalled + # without replacement. + pass + else: + rValue.add("%s:%s" % (cpv_getkey(cpv), slot)) return rValue class LibraryFileConsumerSet(LibraryConsumerSet): |