Gentoo Archives: gentoo-commits

From: Arfrever Frehtes Taifersar Arahesis <arfrever@××××××.org>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Tue, 08 Dec 2015 10:32:45
Message-Id: 1449570500.9e104c424ef08d543546eb4ae54724af97d11c0e.arfrever@gentoo
1 commit: 9e104c424ef08d543546eb4ae54724af97d11c0e
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Tue Dec 8 10:28:20 2015 +0000
4 Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
5 CommitDate: Tue Dec 8 10:28:20 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9e104c42
7
8 ebuild: Set PORTAGE_REPOSITORIES instead of deprecated PORTDIR_OVERLAY.
9
10 bin/ebuild | 38 +++++++++++++++++---------------------
11 1 file changed, 17 insertions(+), 21 deletions(-)
12
13 diff --git a/bin/ebuild b/bin/ebuild
14 index 1f99177..2c42771 100755
15 --- a/bin/ebuild
16 +++ b/bin/ebuild
17 @@ -50,7 +50,7 @@ from portage import _encodings
18 from portage import _shell_quote
19 from portage import _unicode_decode
20 from portage import _unicode_encode
21 -from portage.const import VDB_PATH
22 +from portage.const import REPO_NAME_LOC, VDB_PATH
23 from portage.exception import PermissionDenied, PortageKeyError, \
24 PortagePackageException, UnsupportedAPIException
25 import portage.util
26 @@ -146,27 +146,23 @@ ebuild_portdir = os.path.realpath(
27 ebuild = os.path.join(ebuild_portdir, *ebuild.split(os.path.sep)[-3:])
28 vdb_path = os.path.realpath(os.path.join(portage.settings['EROOT'], VDB_PATH))
29
30 -# Make sure that portdb.findname() returns the correct ebuild.
31 -if ebuild_portdir != vdb_path and \
32 - ebuild_portdir not in portage.portdb.porttrees:
33 - portdir_overlay = portage.settings.get("PORTDIR_OVERLAY", "")
34 - if sys.hexversion >= 0x3000000:
35 - os.environ["PORTDIR_OVERLAY"] = \
36 - portdir_overlay + \
37 - " " + _shell_quote(ebuild_portdir)
38 - else:
39 - os.environ["PORTDIR_OVERLAY"] = \
40 - _unicode_encode(portdir_overlay,
41 - encoding=_encodings['content'], errors='strict') + \
42 - " " + _unicode_encode(_shell_quote(ebuild_portdir),
43 - encoding=_encodings['content'], errors='strict')
44 -
45 - print("Appending %s to PORTDIR_OVERLAY..." % ebuild_portdir)
46 - portage._reset_legacy_globals()
47 -
48 myrepo = None
49 if ebuild_portdir != vdb_path:
50 - myrepo = portage.portdb.getRepositoryName(ebuild_portdir)
51 + myrepo = portage.repository.config._read_repo_name(ebuild_portdir)
52 + if myrepo is None:
53 + err("Repository located in %r has no repository name set in %r or in 'repo-name' attribute in %r" %
54 + (ebuild_portdir, os.path.join(ebuild_portdir, REPO_NAME_LOC), os.path.join(ebuild_portdir, "metadata", "layout.conf")))
55 +
56 + # Make sure that portdb.findname() returns the correct ebuild.
57 + if ebuild_portdir not in portage.portdb.porttrees:
58 + print("Appending repository '%s' located in '%s' to configuration of repositories" % (myrepo, ebuild_portdir))
59 + tmp_conf_file = io.StringIO(textwrap.dedent("""
60 + [%s]
61 + location = %s
62 + """ % (myrepo, ebuild_portdir)))
63 + repositories = portage.repository.config.load_repository_config(portage.settings, extra_files=[tmp_conf_file])
64 + os.environ["PORTAGE_REPOSITORIES"] = repositories.config_string()
65 + portage._reset_legacy_globals()
66
67 if not os.path.exists(ebuild):
68 err('%s: does not exist' % (ebuild,))
69 @@ -198,7 +194,7 @@ else:
70 portage_ebuild = portage.portdb.findname(cpv, myrepo=myrepo)
71
72 if not portage_ebuild or portage_ebuild != ebuild:
73 - err('%s: does not seem to have a valid PORTDIR structure' % (ebuild,))
74 + err('%s: Invalid structure of repository' % (ebuild,))
75
76 if len(pargs) > 1 and "config" in pargs:
77 other_phases = set(pargs)