Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] fakedbapi.cpv_exists: handle KeyError from _instance_key
Date: Thu, 24 Sep 2015 20:30:25
Message-Id: 20150924132922.5e074735.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] fakedbapi.cpv_exists: handle KeyError from _instance_key by Zac Medico
1 On Thu, 24 Sep 2015 13:27:46 -0700
2 Zac Medico <zmedico@g.o> wrote:
3
4 > Since commit 7921e61065502fd0bb08d9dfef6a4493657961bf, cpv_exists
5 > needs to handle KeyError from _instance_key_multi_instance.
6 >
7 > Fixes: 7921e6106550 ("binpkg-multi-instance 2 of 7")
8 > ---
9 > pym/portage/dbapi/virtual.py | 8 ++++++--
10 > 1 file changed, 6 insertions(+), 2 deletions(-)
11 >
12 > diff --git a/pym/portage/dbapi/virtual.py
13 > b/pym/portage/dbapi/virtual.py index a59c3b5..f2e841f 100644
14 > --- a/pym/portage/dbapi/virtual.py
15 > +++ b/pym/portage/dbapi/virtual.py
16 > @@ -98,8 +98,12 @@ class fakedbapi(dbapi):
17 > return result[:]
18 >
19 > def cpv_exists(self, mycpv, myrepo=None):
20 > - return self._instance_key(mycpv,
21 > - support_string=True) in self.cpvdict
22 > + try:
23 > + return self._instance_key(mycpv,
24 > + support_string=True) in self.cpvdict
25 > + except KeyError:
26 > + # _instance_key failure
27 > + return False
28 >
29 > def cp_list(self, mycp, use_cache=1, myrepo=None):
30 > # NOTE: Cache can be safely shared with the match
31 > cache, since the
32
33
34 Thanks Zac. push please.
35 --
36 Brian Dolbec <dolsen>