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