From: Zac Medico Date: Sun, 24 Jul 2011 01:34:29 +0000 (-0700) Subject: LibraryConsumerSet: handle KeyError from dbapi X-Git-Tag: v2.2.0_alpha47~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=431d9054b74282e7d5d8b96d7eeaefaaab3f18a4;p=portage.git LibraryConsumerSet: handle KeyError from dbapi --- 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):