Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Sat, 10 Aug 2019 19:12:38
Message-Id: 1565463071.03b441713d299a04c6bdba10e0fbd5ba2340a68d.zmedico@gentoo
1 commit: 03b441713d299a04c6bdba10e0fbd5ba2340a68d
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 10 18:44:11 2019 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 10 18:51:11 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=03b44171
7
8 bin/ebuild: Fix to work with installed package
9
10 Fix the following AttributeError error:
11
12 # ebuild /var/db/pkg/sys-apps/portage-2.3.71/portage-2.3.71.ebuild clean pretend clean
13 Traceback (most recent call last):
14 File "/usr/lib/python-exec/python3.6/ebuild", line 318, in <module>
15 type_name=pkg_type)
16 File "/usr/lib64/python3.6/site-packages/_emerge/Package.py", line 72, in __init__
17 db = self.cpv._db
18 AttributeError: 'str' object has no attribute '_db'
19
20 Bug: https://bugs.gentoo.org/532674
21 Fixes: bfe7892202b8 ("_pkg_str: add _db attribute (bug 640318)")
22 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
23
24 bin/ebuild | 7 ++++++-
25 1 file changed, 6 insertions(+), 1 deletion(-)
26
27 diff --git a/bin/ebuild b/bin/ebuild
28 index baa842570..460aa0fd1 100755
29 --- a/bin/ebuild
30 +++ b/bin/ebuild
31 @@ -1,5 +1,5 @@
32 #!/usr/bin/python -b
33 -# Copyright 1999-2018 Gentoo Foundation
34 +# Copyright 1999-2019 Gentoo Authors
35 # Distributed under the terms of the GNU General Public License v2
36
37 from __future__ import print_function
38 @@ -312,6 +312,11 @@ except PortageKeyError:
39 root_config = RootConfig(portage.settings,
40 portage.db[portage.settings['EROOT']], None)
41
42 +cpv = portage.versions._pkg_str(cpv,
43 + metadata=metadata,
44 + settings=portage.settings,
45 + db=portage.db[portage.settings['EROOT']][mytree].dbapi)
46 +
47 pkg = Package(built=(pkg_type != "ebuild"), cpv=cpv,
48 installed=(pkg_type=="installed"),
49 metadata=metadata, root_config=root_config,