Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/package/ebuild/_config/, bin/, ...
Date: Wed, 29 Aug 2012 16:28:46
Message-Id: 1346257598.cbd3ea6cad4d7ef8103ddbb71245c1ea47fa49ed.zmedico@gentoo
1 commit: cbd3ea6cad4d7ef8103ddbb71245c1ea47fa49ed
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 29 16:26:38 2012 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 29 16:26:38 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=cbd3ea6c
7
8 EAPI 5: EBUILD_PHASE_FUNC variable
9
10 See bug #390765 and the PMS patch:
11 http://git.overlays.gentoo.org/gitweb/?p=proj/pms.git;a=commit;h=76ddca560da42fd968c53a2a0c38a6ac840a7ad4
12
13 ---
14 bin/phase-functions.sh | 2 +-
15 pym/portage/eapi.py | 7 ++++++-
16 .../package/ebuild/_config/special_env_vars.py | 5 +++--
17 pym/portage/package/ebuild/config.py | 7 +++++++
18 pym/portage/package/ebuild/doebuild.py | 18 ++++++++++++++++++
19 5 files changed, 35 insertions(+), 4 deletions(-)
20
21 diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
22 index 3520199..c23be74 100644
23 --- a/bin/phase-functions.sh
24 +++ b/bin/phase-functions.sh
25 @@ -11,7 +11,7 @@ PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION
26 EAPI HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE
27 PDEPEND PROVIDE RDEPEND REPOSITORY RESTRICT SLOT SRC_URI"
28
29 -PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE \
30 +PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
31 EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR MERGE_TYPE \
32 PM_EBUILD_HOOK_DIR \
33 PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \
34
35 diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
36 index 00ce2a5..1d8da39 100644
37 --- a/pym/portage/eapi.py
38 +++ b/pym/portage/eapi.py
39 @@ -44,6 +44,9 @@ def eapi_exports_merge_type(eapi):
40 def eapi_exports_replace_vars(eapi):
41 return eapi not in ("0", "1", "2", "3")
42
43 +def eapi_exports_EBUILD_PHASE_FUNC(eapi):
44 + return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi")
45 +
46 def eapi_exports_REPOSITORY(eapi):
47 return eapi in ("4-python",)
48
49 @@ -75,7 +78,8 @@ def eapi_allows_dots_in_use_flags(eapi):
50 return eapi in ("4-python",)
51
52 _eapi_attrs = collections.namedtuple('_eapi_attrs',
53 - 'dots_in_PN dots_in_use_flags iuse_defaults iuse_effective '
54 + 'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
55 + 'iuse_defaults iuse_effective '
56 'repo_deps required_use required_use_at_most_one_of slot_abi slot_deps '
57 'src_uri_arrows strong_blocks use_deps use_dep_defaults')
58
59 @@ -100,6 +104,7 @@ def _get_eapi_attrs(eapi):
60 eapi_attrs = _eapi_attrs(
61 dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi)),
62 dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)),
63 + exports_EBUILD_PHASE_FUNC = (eapi is None or eapi_exports_EBUILD_PHASE_FUNC(eapi)),
64 iuse_defaults = (eapi is None or eapi_has_iuse_defaults(eapi)),
65 iuse_effective = (eapi is not None and eapi_has_iuse_effective(eapi)),
66 repo_deps = (eapi is None or eapi_has_repo_deps(eapi)),
67
68 diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py
69 index 2505ce3..4d42537 100644
70 --- a/pym/portage/package/ebuild/_config/special_env_vars.py
71 +++ b/pym/portage/package/ebuild/_config/special_env_vars.py
72 @@ -13,7 +13,8 @@ import re
73 # configuration files.
74 env_blacklist = frozenset((
75 "A", "AA", "CATEGORY", "DEPEND", "DESCRIPTION", "EAPI",
76 - "EBUILD_FORCE_TEST", "EBUILD_PHASE", "EBUILD_SKIP_MANIFEST",
77 + "EBUILD_FORCE_TEST", "EBUILD_PHASE",
78 + "EBUILD_PHASE_FUNC", "EBUILD_SKIP_MANIFEST",
79 "ED", "EMERGE_FROM", "EPREFIX", "EROOT",
80 "GREP_OPTIONS", "HOMEPAGE", "INHERITED", "IUSE", "IUSE_EFFECTIVE",
81 "KEYWORDS", "LICENSE", "MERGE_TYPE",
82 @@ -39,7 +40,7 @@ environ_whitelist += [
83 "ACCEPT_LICENSE", "BASH_ENV", "BUILD_PREFIX", "COLUMNS", "D",
84 "DISTDIR", "DOC_SYMLINKS_DIR", "EAPI", "EBUILD",
85 "EBUILD_FORCE_TEST",
86 - "EBUILD_PHASE", "ECLASSDIR", "ECLASS_DEPTH", "ED",
87 + "EBUILD_PHASE", "EBUILD_PHASE_FUNC", "ECLASSDIR", "ECLASS_DEPTH", "ED",
88 "EMERGE_FROM", "EPREFIX", "EROOT",
89 "FEATURES", "FILESDIR", "HOME", "MERGE_TYPE", "NOCOLOR", "PATH",
90 "PKGDIR",
91
92 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
93 index 6a9ed08..e871382 100644
94 --- a/pym/portage/package/ebuild/config.py
95 +++ b/pym/portage/package/ebuild/config.py
96 @@ -19,6 +19,7 @@ from _emerge.Package import Package
97 import portage
98 portage.proxy.lazyimport.lazyimport(globals(),
99 'portage.data:portage_gid',
100 + 'portage.package.ebuild.doebuild:_phase_func_map',
101 )
102 from portage import bsd_chflags, \
103 load_mod, os, selinux, _unicode_decode
104 @@ -2402,6 +2403,7 @@ class config(object):
105 environ_filter = self._environ_filter
106
107 eapi = self.get('EAPI')
108 + eapi_attrs = _get_eapi_attrs(eapi)
109 phase = self.get('EBUILD_PHASE')
110 filter_calling_env = False
111 if self.mycpv is not None and \
112 @@ -2483,6 +2485,11 @@ class config(object):
113 not eapi_exports_replace_vars(eapi):
114 mydict.pop("REPLACED_BY_VERSION", None)
115
116 + if phase is not None and eapi_attrs.exports_EBUILD_PHASE_FUNC:
117 + phase_func = _phase_func_map.get(phase)
118 + if phase_func is not None:
119 + mydict["EBUILD_PHASE_FUNC"] = phase_func
120 +
121 return mydict
122
123 def thirdpartymirrors(self):
124
125 diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
126 index 3ba8ebd..5856f69 100644
127 --- a/pym/portage/package/ebuild/doebuild.py
128 +++ b/pym/portage/package/ebuild/doebuild.py
129 @@ -75,6 +75,24 @@ _unsandboxed_phases = frozenset([
130 "prerm", "setup"
131 ])
132
133 +_phase_func_map = {
134 + "config": "pkg_config",
135 + "setup": "pkg_setup",
136 + "nofetch": "pkg_nofetch",
137 + "unpack": "src_unpack",
138 + "prepare": "src_prepare",
139 + "configure": "src_configure",
140 + "compile": "src_compile",
141 + "test": "src_test",
142 + "install": "src_install",
143 + "preinst": "pkg_preinst",
144 + "postinst": "pkg_postinst",
145 + "prerm": "pkg_prerm",
146 + "postrm": "pkg_postrm",
147 + "info": "pkg_info",
148 + "pretend": "pkg_pretend",
149 +}
150 +
151 def _doebuild_spawn(phase, settings, actionmap=None, **kwargs):
152 """
153 All proper ebuild phases which execute ebuild.sh are spawned