commit:     96f7e7870254d6f904d51a19e527541e6e3b6d61
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 26 14:12:27 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 24 05:43:36 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=96f7e787

Initial IDEPEND support (for EAPI 8)

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/eapi.sh                                            |  4 ++++
 bin/ebuild.sh                                          | 16 ++++++++++++----
 bin/phase-functions.sh                                 |  2 +-
 lib/_emerge/Package.py                                 |  8 ++++----
 lib/_emerge/actions.py                                 |  3 ++-
 lib/_emerge/depgraph.py                                |  7 ++++++-
 lib/portage/__init__.py                                |  2 +-
 lib/portage/cache/metadata.py                          |  4 ++--
 lib/portage/dbapi/bintree.py                           |  7 ++++---
 lib/portage/dbapi/porttree.py                          |  4 ++--
 lib/portage/dbapi/vartree.py                           |  2 +-
 lib/portage/eapi.py                                    |  7 ++++++-
 lib/portage/package/ebuild/_config/special_env_vars.py |  4 ++--
 lib/portage/package/ebuild/config.py                   |  2 +-
 man/ebuild.5                                           | 13 ++++++++++++-
 15 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index eea8d0d0f..80bade87e 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -42,6 +42,10 @@ ___eapi_has_BDEPEND() {
        [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6)$ 
]]
 }
 
+___eapi_has_IDEPEND() {
+       [[ ! ${1-${EAPI-0}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6|7)$ ]]
+}
+
 ___eapi_has_RDEPEND_DEPEND_fallback() {
        [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 72990edc5..c8fe3d0f1 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -257,6 +257,7 @@ inherit() {
        local B_RDEPEND
        local B_PDEPEND
        local B_BDEPEND
+       local B_IDEPEND
        local B_PROPERTIES
        local B_RESTRICT
        while [ "$1" ]; do
@@ -303,14 +304,14 @@ inherit() {
 
                        # Retain the old data and restore it later.
                        unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND
-                       unset B_BDEPEND B_PROPERTIES B_RESTRICT
+                       unset B_BDEPEND B_IDEPEND B_PROPERTIES B_RESTRICT
                        [ "${IUSE+set}"       = set ] && B_IUSE="${IUSE}"
                        [ "${REQUIRED_USE+set}" = set ] && 
B_REQUIRED_USE="${REQUIRED_USE}"
                        [ "${DEPEND+set}"     = set ] && B_DEPEND="${DEPEND}"
                        [ "${RDEPEND+set}"    = set ] && B_RDEPEND="${RDEPEND}"
                        [ "${PDEPEND+set}"    = set ] && B_PDEPEND="${PDEPEND}"
                        [ "${BDEPEND+set}"    = set ] && B_BDEPEND="${BDEPEND}"
-                       unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND BDEPEND
+                       unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND BDEPEND 
IDEPEND
 
                        if ___eapi_has_accumulated_PROPERTIES; then
                                [[ ${PROPERTIES+set} == set ]] && 
B_PROPERTIES=${PROPERTIES}
@@ -339,6 +340,7 @@ inherit() {
                        [ "${RDEPEND+set}"      = set ] && 
E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}"
                        [ "${PDEPEND+set}"      = set ] && 
E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}"
                        [ "${BDEPEND+set}"      = set ] && 
E_BDEPEND+="${E_BDEPEND:+ }${BDEPEND}"
+                       [ "${IDEPEND+set}"      = set ] && 
E_IDEPEND+="${E_IDEPEND:+ }${IDEPEND}"
 
                        [ "${B_IUSE+set}"     = set ] && IUSE="${B_IUSE}"
                        [ "${B_IUSE+set}"     = set ] || unset IUSE
@@ -358,6 +360,9 @@ inherit() {
                        [ "${B_BDEPEND+set}"  = set ] && BDEPEND="${B_BDEPEND}"
                        [ "${B_BDEPEND+set}"  = set ] || unset BDEPEND
 
+                       [ "${B_IDEPEND+set}"  = set ] && IDEPEND="${B_IDEPEND}"
+                       [ "${B_IDEPEND+set}"  = set ] || unset IDEPEND
+
                        if ___eapi_has_accumulated_PROPERTIES; then
                                [[ ${PROPERTIES+set} == set ]] &&
                                        E_PROPERTIES+=${E_PROPERTIES:+ 
}${PROPERTIES}
@@ -633,7 +638,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
                # interaction begins.
                unset EAPI DEPEND RDEPEND PDEPEND BDEPEND PROPERTIES RESTRICT
                unset INHERITED IUSE REQUIRED_USE ECLASS E_IUSE E_REQUIRED_USE
-               unset E_DEPEND E_RDEPEND E_PDEPEND E_BDEPEND E_PROPERTIES
+               unset E_DEPEND E_RDEPEND E_PDEPEND E_BDEPEND E_IDEPEND 
E_PROPERTIES
                unset E_RESTRICT PROVIDES_EXCLUDE REQUIRES_EXCLUDE
 
                if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then
@@ -751,12 +756,15 @@ if [[ $EBUILD_PHASE = depend ]] ; then
 
        auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
                DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND BDEPEND
-               EAPI PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
+               EAPI PROPERTIES DEFINED_PHASES IDEPEND UNUSED_04
                UNUSED_03 UNUSED_02 UNUSED_01"
 
        if ! ___eapi_has_BDEPEND; then
                unset BDEPEND
        fi
+       if ! ___eapi_has_IDEPEND; then
+               unset IDEPEND
+       fi
 
        # The extra $(echo) commands remove newlines.
        if [ -n "${dbkey}" ] ; then

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index a6837390f..6a0300165 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -8,7 +8,7 @@
 # when portage is upgrading itself.
 
 PORTAGE_READONLY_METADATA="BDEPEND DEFINED_PHASES DEPEND DESCRIPTION
-       EAPI HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE
+       EAPI HOMEPAGE IDEPEND INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE
        PDEPEND RDEPEND REPOSITORY RESTRICT SLOT SRC_URI"
 
 PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \

diff --git a/lib/_emerge/Package.py b/lib/_emerge/Package.py
index 0ee25b90a..e8809a89d 100644
--- a/lib/_emerge/Package.py
+++ b/lib/_emerge/Package.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 from itertools import chain
@@ -32,15 +32,15 @@ class Package(Task):
        metadata_keys = [
                "BDEPEND",
                "BUILD_ID", "BUILD_TIME", "CHOST", "COUNTER", "DEFINED_PHASES",
-               "DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS",
+               "DEPEND", "EAPI", "IDEPEND", "INHERITED", "IUSE", "KEYWORDS",
                "LICENSE", "MD5", "PDEPEND", "PROVIDES",
                "RDEPEND", "repository", "REQUIRED_USE",
                "PROPERTIES", "REQUIRES", "RESTRICT", "SIZE",
                "SLOT", "USE", "_mtime_"]
 
-       _dep_keys = ('BDEPEND', 'DEPEND', 'PDEPEND', 'RDEPEND')
+       _dep_keys = ('BDEPEND', 'DEPEND', 'IDEPEND', 'PDEPEND', 'RDEPEND')
        _buildtime_keys = ('BDEPEND', 'DEPEND')
-       _runtime_keys = ('PDEPEND', 'RDEPEND')
+       _runtime_keys = ('IDEPEND', 'PDEPEND', 'RDEPEND')
        _use_conditional_misc_keys = ('LICENSE', 'PROPERTIES', 'RESTRICT')
        UNKNOWN_REPO = _unknown_repo
 

diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
index c078e1ab3..1946f49df 100644
--- a/lib/_emerge/actions.py
+++ b/lib/_emerge/actions.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import collections
@@ -1368,6 +1368,7 @@ def _calc_depclean(settings, trees, ldpath_mtimes,
                runtime_post = UnmergeDepPriority(runtime_post=True)
                buildtime = UnmergeDepPriority(buildtime=True)
                priority_map = {
+                       "IDEPEND": runtime,
                        "RDEPEND": runtime,
                        "PDEPEND": runtime_post,
                        "BDEPEND": buildtime,

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 2bf04406f..0f47f00a6 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
@@ -3392,11 +3392,13 @@ class depgraph:
                        "deep" not in self._dynamic_config.myparams:
                        edepend["RDEPEND"] = ""
                        edepend["PDEPEND"] = ""
+                       edepend["IDEPEND"] = ""
 
                if pkg.onlydeps and \
                        self._frozen_config.myopts.get("--onlydeps-with-rdeps") 
== 'n':
                        edepend["RDEPEND"] = ""
                        edepend["PDEPEND"] = ""
+                       edepend["IDEPEND"] = ""
 
                ignore_build_time_deps = False
                if pkg.built and not removal_action:
@@ -3452,6 +3454,8 @@ class depgraph:
                deps = (
                        (myroot, edepend["RDEPEND"],
                                self._priority(runtime=True)),
+                       (self._frozen_config._running_root.root, 
edepend["IDEPEND"],
+                               self._priority(runtime=True)),
                        (myroot, edepend["PDEPEND"],
                                self._priority(runtime_post=True)),
                        (depend_root, edepend["DEPEND"],
@@ -5156,6 +5160,7 @@ class depgraph:
                                                                
dep_strings.add(node._metadata[k])
                                                if priority.runtime:
                                                        
dep_strings.add(node._metadata["RDEPEND"])
+                                                       
dep_strings.add(node._metadata["IDEPEND"])
                                                if priority.runtime_post:
                                                        
dep_strings.add(node._metadata["PDEPEND"])
 

diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py
index 1d202f557..7659be995 100644
--- a/lib/portage/__init__.py
+++ b/lib/portage/__init__.py
@@ -519,7 +519,7 @@ auxdbkeys = (
        'RESTRICT',  'HOMEPAGE',  'LICENSE',   'DESCRIPTION',
        'KEYWORDS',  'INHERITED', 'IUSE', 'REQUIRED_USE',
        'PDEPEND',   'BDEPEND', 'EAPI',
-       'PROPERTIES', 'DEFINED_PHASES', 'UNUSED_05', 'UNUSED_04',
+       'PROPERTIES', 'DEFINED_PHASES', 'IDEPEND', 'UNUSED_04',
        'UNUSED_03', 'UNUSED_02', 'UNUSED_01',
 )
 auxdbkeylen = len(auxdbkeys)

diff --git a/lib/portage/cache/metadata.py b/lib/portage/cache/metadata.py
index bd1b70fa0..b3ba991f3 100644
--- a/lib/portage/cache/metadata.py
+++ b/lib/portage/cache/metadata.py
@@ -1,4 +1,4 @@
-# Copyright 2005-2020 Gentoo Authors
+# Copyright 2005-2021 Gentoo Authors
 # Author(s): Brian Harring ([email protected])
 # License: GPL2
 
@@ -25,7 +25,7 @@ class database(flat_hash.database):
        complete_eclass_entries = False
        auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
                'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
-               'KEYWORDS',  'INHERITED', 'IUSE', 'REQUIRED_USE',
+               'KEYWORDS',  'IDEPEND',   'INHERITED', 'IUSE', 'REQUIRED_USE',
                'PDEPEND',   'BDEPEND',   'EAPI', 'PROPERTIES',
                'DEFINED_PHASES')
 

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 429c8e64a..cb21a8ee5 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -83,7 +83,7 @@ class bindbapi(fakedbapi):
                # Selectively cache metadata in order to optimize dep matching.
                self._aux_cache_keys = set(
                        ["BDEPEND", "BUILD_ID", "BUILD_TIME", "CHOST", 
"DEFINED_PHASES",
-                       "DEPEND", "EAPI", "IUSE", "KEYWORDS",
+                       "DEPEND", "EAPI", "IDEPEND", "IUSE", "KEYWORDS",
                        "LICENSE", "MD5", "PDEPEND", "PROPERTIES",
                        "PROVIDES", "RDEPEND", "repository", "REQUIRES", 
"RESTRICT",
                        "SIZE", "SLOT", "USE", "_mtime_"
@@ -384,13 +384,13 @@ class binarytree:
                        self._pkgindex_aux_keys = \
                                ["BASE_URI", "BDEPEND", "BUILD_ID", 
"BUILD_TIME", "CHOST",
                                "DEFINED_PHASES", "DEPEND", "DESCRIPTION", 
"EAPI", "FETCHCOMMAND",
-                               "IUSE", "KEYWORDS", "LICENSE", "PDEPEND",
+                               "IDEPEND", "IUSE", "KEYWORDS", "LICENSE", 
"PDEPEND",
                                "PKGINDEX_URI", "PROPERTIES", "PROVIDES",
                                "RDEPEND", "repository", "REQUIRES", 
"RESTRICT", "RESUMECOMMAND",
                                "SIZE", "SLOT", "USE"]
                        self._pkgindex_aux_keys = list(self._pkgindex_aux_keys)
                        self._pkgindex_use_evaluated_keys = \
-                               ("BDEPEND", "DEPEND", "LICENSE", "RDEPEND",
+                               ("BDEPEND", "DEPEND", "IDEPEND", "LICENSE", 
"RDEPEND",
                                "PDEPEND", "PROPERTIES", "RESTRICT")
                        self._pkgindex_header = None
                        self._pkgindex_header_keys = set([
@@ -407,6 +407,7 @@ class binarytree:
                                "DEFINED_PHASES"     : "",
                                "DEPEND"  : "",
                                "EAPI"    : "0",
+                               "IDEPEND" : "",
                                "IUSE"    : "",
                                "KEYWORDS": "",
                                "LICENSE" : "",

diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py
index 0c2a4e2b3..99c36450c 100644
--- a/lib/portage/dbapi/porttree.py
+++ b/lib/portage/dbapi/porttree.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2020 Gentoo Authors
+# Copyright 1998-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = [
@@ -309,7 +309,7 @@ class portdbapi(dbapi):
                                        self._pregen_auxdb[x] = cache
                # Selectively cache metadata in order to optimize dep matching.
                self._aux_cache_keys = set(
-                       ["BDEPEND", "DEPEND", "EAPI",
+                       ["BDEPEND", "DEPEND", "EAPI", "IDEPEND",
                        "INHERITED", "IUSE", "KEYWORDS", "LICENSE",
                        "PDEPEND", "PROPERTIES", "RDEPEND", "repository",
                        "RESTRICT", "SLOT", "DEFINED_PHASES", "REQUIRED_USE"])

diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index 5ae035baf..ee54ed7cb 100644
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@ -172,7 +172,7 @@ class vardbapi(dbapi):
                self._aux_cache_keys = set(
                        ["BDEPEND", "BUILD_TIME", "CHOST", "COUNTER", "DEPEND",
                        "DESCRIPTION", "EAPI", "HOMEPAGE",
-                       "BUILD_ID", "IUSE", "KEYWORDS",
+                       "BUILD_ID", "IDEPEND", "IUSE", "KEYWORDS",
                        "LICENSE", "PDEPEND", "PROPERTIES", "RDEPEND",
                        "repository", "RESTRICT" , "SLOT", "USE", 
"DEFINED_PHASES",
                        "PROVIDES", "REQUIRES"

diff --git a/lib/portage/eapi.py b/lib/portage/eapi.py
index 6a655aca2..23d64abb9 100644
--- a/lib/portage/eapi.py
+++ b/lib/portage/eapi.py
@@ -115,6 +115,10 @@ def eapi_has_bdepend(eapi):
        return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
                        "5", "5-progress", "6")
 
+def eapi_has_idepend(eapi):
+       return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
+                       "5", "5-progress", "6", "7")
+
 def eapi_empty_groups_always_true(eapi):
        return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
                        "5", "5-progress", "6")
@@ -144,7 +148,7 @@ _eapi_attrs = collections.namedtuple('_eapi_attrs',
        'exports_PORTDIR '
        'exports_replace_vars '
        'feature_flag_test '
-       'iuse_defaults iuse_effective posixish_locale '
+       'idepend iuse_defaults iuse_effective posixish_locale '
        'path_variables_end_with_trailing_slash '
        'prefix '
        'repo_deps required_use required_use_at_most_one_of '
@@ -224,6 +228,7 @@ def _get_eapi_attrs(eapi):
                exports_PORTDIR = (eapi is None or 
eapi_exports_PORTDIR.func(eapi)),
                exports_replace_vars = (eapi is None or 
eapi_exports_replace_vars.func(eapi)),
                feature_flag_test = False,
+               idepend = (eapi is not None and eapi_has_idepend.func(eapi)),
                iuse_defaults = (eapi is None or 
eapi_has_iuse_defaults.func(eapi)),
                iuse_effective = (eapi is not None and 
eapi_has_iuse_effective.func(eapi)),
                path_variables_end_with_trailing_slash = (eapi is not None and

diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py 
b/lib/portage/package/ebuild/_config/special_env_vars.py
index 72fc31401..456af1838 100644
--- a/lib/portage/package/ebuild/_config/special_env_vars.py
+++ b/lib/portage/package/ebuild/_config/special_env_vars.py
@@ -18,7 +18,7 @@ env_blacklist = frozenset((
        "EBUILD_PHASE_FUNC", "EBUILD_SKIP_MANIFEST",
        "ED", "EMERGE_FROM", "EPREFIX", "EROOT",
        "GREP_OPTIONS", "HOMEPAGE",
-       "INHERITED", "IUSE", "IUSE_EFFECTIVE",
+       "IDEPEND", "INHERITED", "IUSE", "IUSE_EFFECTIVE",
        "KEYWORDS", "LICENSE", "MERGE_TYPE",
        "PDEPEND", "PF", "PKGUSE", "PORTAGE_BACKGROUND",
        "PORTAGE_BACKGROUND_UNMERGE", "PORTAGE_BUILDDIR_LOCKED",
@@ -131,7 +131,7 @@ environ_filter = []
 # since that could cause execve() calls to fail with E2BIG errors. For
 # example, see bug #262647.
 environ_filter += [
-       'DEPEND', 'RDEPEND', 'PDEPEND', 'SRC_URI',
+       'DEPEND', 'RDEPEND', 'PDEPEND', 'SRC_URI', 'BDEPEND', 'IDEPEND',
 ]
 
 # misc variables inherited from the calling environment

diff --git a/lib/portage/package/ebuild/config.py 
b/lib/portage/package/ebuild/config.py
index 773135b3d..3b9b11c71 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -152,7 +152,7 @@ class config:
                'PORTAGE_LOGDIR_CLEAN': 'PORT_LOGDIR_CLEAN',
                'SIGNED_OFF_BY': 'DCO_SIGNED_OFF_BY'}
 
-       _setcpv_aux_keys = ('BDEPEND', 'DEFINED_PHASES', 'DEPEND', 'EAPI',
+       _setcpv_aux_keys = ('BDEPEND', 'DEFINED_PHASES', 'DEPEND', 'EAPI', 
'IDEPEND',
                'INHERITED', 'IUSE', 'REQUIRED_USE', 'KEYWORDS', 'LICENSE', 
'PDEPEND',
                'PROPERTIES', 'RDEPEND', 'SLOT',
                'repository', 'RESTRICT', 'LICENSE',)

diff --git a/man/ebuild.5 b/man/ebuild.5
index a113c1502..3a3982738 100644
--- a/man/ebuild.5
+++ b/man/ebuild.5
@@ -1,4 +1,4 @@
-.TH "EBUILD" "5" "Apr 2021" "Portage VERSION" "Portage"
+.TH "EBUILD" "5" "May 2021" "Portage VERSION" "Portage"
 
 .SH "NAME"
 ebuild \- the internal format, variables, and functions in an ebuild script
@@ -695,6 +695,17 @@ This variable was formally introduced in \fBEAPI 7\fR but 
was
 previously known as \fBHDEPEND\fR in the experimental
 \fBEAPI 5-hdepend\fR.
 
+You may use the syntax described above in the \fBDependencies\fR section.
+.TP
+.B IDEPEND
+This should contain a list of all packages that are required to be
+executable during merging of this package (aka \fInative install\-time\fR
+dependencies).  These are usually post\-install tooling, like cache
+generators.  They will be installed into the system performing
+the merge.
+
+This variable was introduced in \fBEAPI 8\fR.
+
 You may use the syntax described above in the \fBDependencies\fR section.
 .TP
 .B PDEPEND

Reply via email to