Add experimental EAPI 5-hdepend support.
authorAmbroz Bizjak <ambrop7@gmail.com>
Mon, 24 Sep 2012 20:13:46 +0000 (13:13 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 24 Sep 2012 20:13:46 +0000 (13:13 -0700)
18 files changed:
bin/ebuild.sh
bin/phase-functions.sh
pym/_emerge/FakeVartree.py
pym/_emerge/Package.py
pym/_emerge/actions.py
pym/_emerge/depgraph.py
pym/_emerge/main.py
pym/portage/__init__.py
pym/portage/dbapi/__init__.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/porttree.py
pym/portage/dbapi/vartree.py
pym/portage/dep/_slot_operator.py
pym/portage/eapi.py
pym/portage/emaint/modules/move/move.py
pym/portage/package/ebuild/_config/special_env_vars.py
pym/portage/package/ebuild/config.py
pym/portage/package/ebuild/doebuild.py

index 79da2b518cb5ae73e8c99cfbd796e022b22c0ef7..06e2c66f622406beaa6ea04986222191496c3e8a 100755 (executable)
@@ -215,6 +215,7 @@ inherit() {
        local B_DEPEND
        local B_RDEPEND
        local B_PDEPEND
+       local B_HDEPEND
        while [ "$1" ]; do
                location="${ECLASSDIR}/${1}.eclass"
                olocation=""
@@ -257,20 +258,21 @@ inherit() {
                                EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
                fi
 
-               #We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_RDEPEND
+               #We need to back up the values of *DEPEND to B_*DEPEND
                #(if set).. and then restore them after the inherit call.
 
                #turn off glob expansion
                set -f
 
                # Retain the old data and restore it later.
-               unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND
+               unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND B_HDEPEND
                [ "${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}"
-               unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND
+               [ "${HDEPEND+set}"    = set ] && B_HDEPEND="${HDEPEND}"
+               unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND HDEPEND
                #turn on glob expansion
                set +f
 
@@ -286,6 +288,7 @@ inherit() {
                [ "${DEPEND+set}"       = set ] && E_DEPEND+="${E_DEPEND:+ }${DEPEND}"
                [ "${RDEPEND+set}"      = set ] && E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}"
                [ "${PDEPEND+set}"      = set ] && E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}"
+               [ "${HDEPEND+set}"      = set ] && E_HDEPEND+="${E_HDEPEND:+ }${HDEPEND}"
 
                [ "${B_IUSE+set}"     = set ] && IUSE="${B_IUSE}"
                [ "${B_IUSE+set}"     = set ] || unset IUSE
@@ -302,6 +305,9 @@ inherit() {
                [ "${B_PDEPEND+set}"  = set ] && PDEPEND="${B_PDEPEND}"
                [ "${B_PDEPEND+set}"  = set ] || unset PDEPEND
 
+               [ "${B_HDEPEND+set}"  = set ] && HDEPEND="${B_HDEPEND}"
+               [ "${B_HDEPEND+set}"  = set ] || unset HDEPEND
+
                #turn on glob expansion
                set +f
 
@@ -528,8 +534,9 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
                # In order to ensure correct interaction between ebuilds and
                # eclasses, they need to be unset before this process of
                # interaction begins.
-               unset EAPI DEPEND RDEPEND PDEPEND INHERITED IUSE REQUIRED_USE \
-                       ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND
+               unset EAPI DEPEND RDEPEND PDEPEND HDEPEND INHERITED IUSE REQUIRED_USE \
+                       ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \
+                       E_HDEPEND
 
                if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then
                        source "$EBUILD" || die "error sourcing ebuild"
@@ -560,13 +567,14 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
                DEPEND+="${DEPEND:+ }${E_DEPEND}"
                RDEPEND+="${RDEPEND:+ }${E_RDEPEND}"
                PDEPEND+="${PDEPEND:+ }${E_PDEPEND}"
+               HDEPEND+="${HDEPEND:+ }${E_HDEPEND}"
                REQUIRED_USE+="${REQUIRED_USE:+ }${E_REQUIRED_USE}"
                
-               unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \
+               unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND E_HDEPEND \
                        __INHERITED_QA_CACHE
 
                # alphabetically ordered by $EBUILD_PHASE value
-               case "$EAPI" in
+               case ${EAPI} in
                        0|1)
                                _valid_phases="src_compile pkg_config pkg_info src_install
                                        pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm
@@ -664,9 +672,17 @@ if [[ $EBUILD_PHASE = depend ]] ; then
 
        auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
                DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI
-               PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
+               PROPERTIES DEFINED_PHASES HDEPEND UNUSED_04
                UNUSED_03 UNUSED_02 UNUSED_01"
 
+       case ${EAPI} in
+               5-hdepend)
+                       ;;
+               *)
+                       unset HDEPEND
+                       ;;
+       esac
+
        # The extra $(echo) commands remove newlines.
        if [ -n "${dbkey}" ] ; then
                > "${dbkey}"
@@ -684,7 +700,7 @@ else
        # Note: readonly variables interfere with __preprocess_ebuild_env(), so
        # declare them only after it has already run.
        declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
-       case "$EAPI" in
+       case ${EAPI} in
                0|1|2)
                        [[ " ${FEATURES} " == *" force-prefix "* ]] && \
                                declare -r ED EPREFIX EROOT
index 2b932314751a64a71126ba86bee1929b49594386..97e762a39f53032a1b5067c1a45192969867b949 100644 (file)
@@ -8,7 +8,7 @@
 # when portage is upgrading itself.
 
 PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION
-       EAPI HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE
+       EAPI HDEPEND HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE
        PDEPEND PROVIDE RDEPEND REPOSITORY RESTRICT SLOT SRC_URI"
 
 PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
index fb1281c298c452429bc9bdf409a7279e88c01542..b3c913348a1a341dab2a6c52cd06f622ad03cee8 100644 (file)
@@ -75,7 +75,8 @@ class FakeVartree(vartree):
                        self.dbapi.aux_get = self._aux_get_wrapper
                        self.dbapi.match = self._match_wrapper
                self._aux_get_history = set()
-               self._portdb_keys = ["EAPI", "KEYWORDS", "DEPEND", "RDEPEND", "PDEPEND"]
+               self._portdb_keys = ["EAPI", "DEPEND", "HDEPEND",
+                       "KEYWORDS", "PDEPEND", "RDEPEND"]
                self._portdb = portdb
                self._global_updates = None
 
@@ -286,7 +287,8 @@ def grab_global_updates(portdb):
        return retupdates
 
 def perform_global_updates(mycpv, mydb, myupdates):
-       aux_keys = ["DEPEND", "EAPI", "RDEPEND", "PDEPEND", 'repository']
+       aux_keys = ["DEPEND", "EAPI", "HDEPEND",
+               "RDEPEND", "PDEPEND", 'repository']
        aux_dict = dict(zip(aux_keys, mydb.aux_get(mycpv, aux_keys)))
        eapi = aux_dict.pop('EAPI')
        repository = aux_dict.pop('repository')
index e10140f5c6e330b96ce4106b518a5fa35d00906a..af329a12879e4d9aad0ada8523c6b0389b260c24 100644 (file)
@@ -36,12 +36,12 @@ class Package(Task):
 
        metadata_keys = [
                "BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "EAPI",
-               "INHERITED", "IUSE", "KEYWORDS",
+               "HDEPEND", "INHERITED", "IUSE", "KEYWORDS",
                "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND",
                "repository", "PROPERTIES", "RESTRICT", "SLOT", "USE",
                "_mtime_", "DEFINED_PHASES", "REQUIRED_USE"]
 
-       _dep_keys = ('DEPEND', 'PDEPEND', 'RDEPEND',)
+       _dep_keys = ('DEPEND', 'HDEPEND' 'PDEPEND', 'RDEPEND',)
        _use_conditional_misc_keys = ('LICENSE', 'PROPERTIES', 'RESTRICT')
        UNKNOWN_REPO = _unknown_repo
 
index 4b16dc9dc330ae36b11ea3ef86641abffcb73923..af7ae8f7e17e427176ebbf1655d8aaa937c38da2 100644 (file)
@@ -1147,13 +1147,14 @@ def calc_depclean(settings, trees, ldpath_mtimes,
                graph = digraph()
                del cleanlist[:]
 
-               dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
+               dep_keys = ["DEPEND", "HDEPEND", "RDEPEND", "PDEPEND"]
                runtime = UnmergeDepPriority(runtime=True)
                runtime_post = UnmergeDepPriority(runtime_post=True)
                buildtime = UnmergeDepPriority(buildtime=True)
                priority_map = {
                        "RDEPEND": runtime,
                        "PDEPEND": runtime_post,
+                       "HDEPEND": buildtime,
                        "DEPEND": buildtime,
                }
 
index 9da202c62f97e038758bed17b6330cf106478c43..d228694ba834a1c5dc5ebe11248f1c9fe0131a17 100644 (file)
@@ -24,7 +24,7 @@ from portage.dep import Atom, best_match_to_list, extract_affecting_use, \
        _repo_separator
 from portage.dep._slot_operator import ignore_built_slot_operator_deps
 from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use, \
-       _get_eapi_attrs
+       _get_eapi_attrs, eapi_has_hdepend
 from portage.exception import (InvalidAtom, InvalidDependString,
        PackageNotFound, PortageException)
 from portage.output import colorize, create_color_func, \
@@ -504,7 +504,7 @@ class depgraph(object):
 
        pkg_tree_map = RootConfig.pkg_tree_map
 
-       _dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
+       _dep_keys = ["DEPEND", "RDEPEND", "PDEPEND", "HDEPEND"]
        
        def __init__(self, settings, trees, myopts, myparams, spinner,
                frozen_config=None, backtrack_parameters=BacktrackParameter(), allow_backtracking=False):
@@ -537,10 +537,6 @@ class depgraph(object):
                        preload_installed_pkgs = \
                                "--nodeps" not in self._frozen_config.myopts
 
-                       if self._frozen_config.myopts.get("--root-deps") is not None and \
-                               myroot != self._frozen_config.target_root:
-                               continue
-
                        fake_vartree = self._frozen_config.trees[myroot]["vartree"]
                        if not fake_vartree.dbapi:
                                # This needs to be called for the first depgraph, but not for
@@ -1685,7 +1681,7 @@ class depgraph(object):
                removal_action = "remove" in self._dynamic_config.myparams
 
                edepend={}
-               depkeys = ["DEPEND","RDEPEND","PDEPEND"]
+               depkeys = ["DEPEND","RDEPEND","PDEPEND","HDEPEND"]
                for k in depkeys:
                        edepend[k] = metadata[k]
 
@@ -1713,31 +1709,44 @@ class depgraph(object):
                        # Removal actions never traverse ignored buildtime
                        # dependencies, so it's safe to discard them early.
                        edepend["DEPEND"] = ""
+                       edepend["HDEPEND"] = ""
                        ignore_build_time_deps = True
 
+               ignore_depend_deps = ignore_build_time_deps
+               ignore_hdepend_deps = ignore_build_time_deps
+
                if removal_action:
                        depend_root = myroot
                else:
-                       depend_root = self._frozen_config._running_root.root
-                       root_deps = self._frozen_config.myopts.get("--root-deps")
-                       if root_deps is not None:
-                               if root_deps is True:
-                                       depend_root = myroot
-                               elif root_deps == "rdeps":
-                                       ignore_build_time_deps = True
+                       if eapi_has_hdepend(pkg.metadata['EAPI']):
+                               depend_root = myroot
+                       else:
+                               depend_root = self._frozen_config._running_root.root
+                               root_deps = self._frozen_config.myopts.get("--root-deps")
+                               if root_deps is not None:
+                                       if root_deps is True:
+                                               depend_root = myroot
+                                       elif root_deps == "rdeps":
+                                               ignore_depend_deps = True
 
                # If rebuild mode is not enabled, it's safe to discard ignored
                # build-time dependencies. If you want these deps to be traversed
                # in "complete" mode then you need to specify --with-bdeps=y.
-               if ignore_build_time_deps and \
-                       not self._rebuild.rebuild:
-                       edepend["DEPEND"] = ""
+               if not self._rebuild.rebuild:
+                       if ignore_depend_deps:
+                               edepend["DEPEND"] = ""
+                       if ignore_hdepend_deps:
+                               edepend["HDEPEND"] = ""
 
                deps = (
                        (depend_root, edepend["DEPEND"],
                                self._priority(buildtime=True,
-                               optional=(pkg.built or ignore_build_time_deps),
-                               ignored=ignore_build_time_deps)),
+                               optional=(pkg.built or ignore_depend_deps),
+                               ignored=ignore_depend_deps)),
+                       (self._frozen_config._running_root.root, edepend["HDEPEND"],
+                               self._priority(buildtime=True,
+                               optional=(pkg.built or ignore_hdepend_deps),
+                               ignored=ignore_hdepend_deps)),
                        (myroot, edepend["RDEPEND"],
                                self._priority(runtime=True)),
                        (myroot, edepend["PDEPEND"],
@@ -2838,7 +2847,7 @@ class depgraph(object):
                        return [pkg.slot_atom for pkg in greedy_pkgs]
 
                blockers = {}
-               blocker_dep_keys = ["DEPEND", "PDEPEND", "RDEPEND"]
+               blocker_dep_keys = ["DEPEND", "PDEPEND", "RDEPEND", "HDEPEND"]
                for pkg in greedy_pkgs + [highest_pkg]:
                        dep_str = " ".join(pkg.metadata[k] for k in blocker_dep_keys)
                        try:
@@ -3099,7 +3108,7 @@ class depgraph(object):
 
                if target_atom is not None and isinstance(node, Package):
                        affecting_use = set()
-                       for dep_str in "DEPEND", "RDEPEND", "PDEPEND":
+                       for dep_str in "DEPEND", "RDEPEND", "PDEPEND", "HDEPEND":
                                try:
                                        affecting_use.update(extract_affecting_use(
                                                node.metadata[dep_str], target_atom,
@@ -3183,10 +3192,12 @@ class depgraph(object):
                                        dep_strings.add(node.metadata["DEPEND"])
                                        dep_strings.add(node.metadata["RDEPEND"])
                                        dep_strings.add(node.metadata["PDEPEND"])
+                                       dep_strings.add(node.metadata["HDEPEND"])
                                else:
                                        for priority in priorities:
                                                if priority.buildtime:
                                                        dep_strings.add(node.metadata["DEPEND"])
+                                                       dep_strings.add(node.metadata["HDEPEND"])
                                                if priority.runtime:
                                                        dep_strings.add(node.metadata["RDEPEND"])
                                                if priority.runtime_post:
@@ -4129,7 +4140,7 @@ class depgraph(object):
                        if pkg not in self._dynamic_config.digraph.nodes:
                                return False
 
-                       for key in "DEPEND", "RDEPEND", "PDEPEND", "LICENSE":
+                       for key in "DEPEND", "RDEPEND", "PDEPEND", "HDEPEND", "LICENSE":
                                dep = pkg.metadata[key]
                                old_val = set(portage.dep.use_reduce(dep, pkg.use.enabled, is_valid_flag=pkg.iuse.is_valid_flag, flat=True))
                                new_val = set(portage.dep.use_reduce(dep, new_use, is_valid_flag=pkg.iuse.is_valid_flag, flat=True))
index d19b7950fd65db47ea4f4e9619b4893d64b9be52..c3e96465d8409b50612f65288ae15622aa782025 100644 (file)
@@ -977,7 +977,6 @@ def parse_opts(tmpcmdline, silent=False):
                        "type"     : "choice",
                        "choices"  : true_y_or_n
                },
-
        }
 
        from optparse import OptionParser
index 30c7e726a184b60bc99f289d117c39d78186110d..695f1ea0a2f4d9d29dd662cbbc45ae545d777794 100644 (file)
@@ -414,7 +414,7 @@ def abssymlink(symlink, target=None):
 
 _doebuild_manifest_exempt_depend = 0
 
-_testing_eapis = frozenset(["4-python", "4-slot-abi", "5-progress"])
+_testing_eapis = frozenset(["4-python", "4-slot-abi", "5-progress", "5-hdepend"])
 _deprecated_eapis = frozenset(["4_pre1", "3_pre2", "3_pre1", "5_pre1", "5_pre2"])
 
 def _eapi_is_deprecated(eapi):
@@ -472,7 +472,7 @@ auxdbkeys = (
        'RESTRICT',  'HOMEPAGE',  'LICENSE',   'DESCRIPTION',
        'KEYWORDS',  'INHERITED', 'IUSE', 'REQUIRED_USE',
        'PDEPEND',   'PROVIDE', 'EAPI',
-       'PROPERTIES', 'DEFINED_PHASES', 'UNUSED_05', 'UNUSED_04',
+       'PROPERTIES', 'DEFINED_PHASES', 'HDEPEND', 'UNUSED_04',
        'UNUSED_03', 'UNUSED_02', 'UNUSED_01',
 )
 auxdbkeylen=len(auxdbkeys)
index fc7c7eb3bcab32ada739974a08943b4fef1e570c..b7c0c7b0d9ca222b4603b5a3233a3714c6d22668 100644 (file)
@@ -290,7 +290,8 @@ class dbapi(object):
                maxval = len(cpv_all)
                aux_get = self.aux_get
                aux_update = self.aux_update
-               meta_keys = ["DEPEND", "EAPI", "RDEPEND", "PDEPEND", "PROVIDE", 'repository']
+               meta_keys = ["DEPEND", "EAPI", "HDEPEND",
+                       "PDEPEND", "PROVIDE", "RDEPEND", 'repository']
                repo_dict = None
                if isinstance(updates, dict):
                        repo_dict = updates
index 7f0943607444011b82caec30005bb9dd2eb59076..cbcfa728f6936f9ffa5c1eae587bb949802a7717 100644 (file)
@@ -72,9 +72,10 @@ class bindbapi(fakedbapi):
                self.cpdict={}
                # Selectively cache metadata in order to optimize dep matching.
                self._aux_cache_keys = set(
-                       ["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS",
+                       ["BUILD_TIME", "CHOST", "DEPEND", "EAPI",
+                       "HDEPEND", "IUSE", "KEYWORDS",
                        "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE",
-                       "RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES",
+                       "RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES"
                        ])
                self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys)
                self._aux_cache = {}
@@ -302,12 +303,12 @@ class binarytree(object):
                        self._pkgindex_keys.update(["CPV", "MTIME", "SIZE"])
                        self._pkgindex_aux_keys = \
                                ["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI",
-                               "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES",
+                               "HDEPEND", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES",
                                "PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES",
                                "BASE_URI"]
                        self._pkgindex_aux_keys = list(self._pkgindex_aux_keys)
                        self._pkgindex_use_evaluated_keys = \
-                               ("LICENSE", "RDEPEND", "DEPEND",
+                               ("DEPEND", "HDEPEND", "LICENSE", "RDEPEND",
                                "PDEPEND", "PROPERTIES", "PROVIDE")
                        self._pkgindex_header_keys = set([
                                "ACCEPT_KEYWORDS", "ACCEPT_LICENSE",
@@ -316,8 +317,10 @@ class binarytree(object):
                                "GENTOO_MIRRORS", "INSTALL_MASK", "SYNC", "USE"])
                        self._pkgindex_default_pkg_data = {
                                "BUILD_TIME"         : "",
+                               "DEFINED_PHASES"     : "",
                                "DEPEND"  : "",
                                "EAPI"    : "0",
+                               "HDEPEND" : "",
                                "IUSE"    : "",
                                "KEYWORDS": "",
                                "LICENSE" : "",
@@ -329,7 +332,6 @@ class binarytree(object):
                                "RESTRICT": "",
                                "SLOT"    : "0",
                                "USE"     : "",
-                               "DEFINED_PHASES" : "",
                        }
                        self._pkgindex_inherited_keys = ["CHOST", "repository"]
 
index 0cb290fb4a22fbaa921c88d7b6e6b9693328ffd6..b1a81b271cea1a1ab3525c6a8958c851e66e9078 100644 (file)
@@ -187,7 +187,8 @@ class portdbapi(dbapi):
                                        self._pregen_auxdb[x] = cache
                # Selectively cache metadata in order to optimize dep matching.
                self._aux_cache_keys = set(
-                       ["DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS", "LICENSE",
+                       ["DEPEND", "EAPI", "HDEPEND",
+                       "INHERITED", "IUSE", "KEYWORDS", "LICENSE",
                        "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository",
                        "RESTRICT", "SLOT", "DEFINED_PHASES", "REQUIRED_USE"])
 
index 7d6d6a8f1f22ecbb0ad14889a4e3de0fa67989b9..f8980f7a0abd4a324e10b8a91744788fa61dcce6 100644 (file)
@@ -161,7 +161,7 @@ class vardbapi(dbapi):
                self.vartree = vartree
                self._aux_cache_keys = set(
                        ["BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "DESCRIPTION",
-                       "EAPI", "HOMEPAGE", "IUSE", "KEYWORDS",
+                       "EAPI", "HDEPEND", "HOMEPAGE", "IUSE", "KEYWORDS",
                        "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND",
                        "repository", "RESTRICT" , "SLOT", "USE", "DEFINED_PHASES",
                        ])
index 8a2b774a8f1e1de2f69ee739867e76636ce8ac9a..9fe19fc5984999ed44a312cc4bba0f3a890a0d6c 100644 (file)
@@ -4,7 +4,7 @@
 from portage.dep import Atom, paren_enclose, use_reduce
 from portage.exception import InvalidData
 
-_dep_keys = ('DEPEND', 'PDEPEND', 'RDEPEND')
+_dep_keys = ('DEPEND', 'HDEPEND', 'PDEPEND', 'RDEPEND')
 _runtime_keys = ('PDEPEND', 'RDEPEND')
 
 def find_built_slot_operator_atoms(pkg):
index b12d81de71b65535ce68da6ed4ab9f1e6b7a5ad7..7c4584382267e2dc6a3dde3536af8fe9a5615549 100644 (file)
@@ -83,9 +83,15 @@ def eapi_supports_stable_use_forcing_and_masking(eapi):
 def eapi_allows_directories_on_profile_level_and_repository_level(eapi):
        return eapi in ("4-python", "5-progress")
 
+def eapi_has_hdepend(eapi):
+       return eapi in ("5-hdepend",)
+
+def eapi_has_targetroot(eapi):
+       return eapi in ("5-hdepend",)
+
 _eapi_attrs = collections.namedtuple('_eapi_attrs',
        'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
-       'feature_flag_test iuse_defaults iuse_effective '
+       'feature_flag_test feature_flag_targetroot iuse_defaults iuse_effective '
        'repo_deps required_use required_use_at_most_one_of slot_operator slot_deps '
        'src_uri_arrows strong_blocks use_deps use_dep_defaults')
 
@@ -112,6 +118,7 @@ def _get_eapi_attrs(eapi):
                dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)),
                exports_EBUILD_PHASE_FUNC = (eapi is None or eapi_exports_EBUILD_PHASE_FUNC(eapi)),
                feature_flag_test = True,
+               feature_flag_targetroot = eapi_has_targetroot(eapi),
                iuse_defaults = (eapi is None or eapi_has_iuse_defaults(eapi)),
                iuse_effective = (eapi is not None and eapi_has_iuse_effective(eapi)),
                repo_deps = (eapi is None or eapi_has_repo_deps(eapi)),
index 018e6cac1ac6cf63cc37b21fef415f0440ab9c5c..5e1d99492c5c0fc0fa369877280f8b9cd2df2266 100644 (file)
@@ -10,7 +10,7 @@ class MoveHandler(object):
        def __init__(self, tree, porttree):
                self._tree = tree
                self._portdb = porttree.dbapi
-               self._update_keys = ["DEPEND", "RDEPEND", "PDEPEND", "PROVIDE"]
+               self._update_keys = ["DEPEND", "HDEPEND", "RDEPEND", "PDEPEND", "PROVIDE"]
                self._master_repo = \
                        self._portdb.getRepositoryName(self._portdb.porttree_root)
 
index 1bcbbf7ef1f2bd72144b78ae609b511ac31ccf1e..a3a95404b35370f36d72a0d23cff3fcff16cbed9 100644 (file)
@@ -16,7 +16,8 @@ env_blacklist = frozenset((
        "EBUILD_FORCE_TEST", "EBUILD_PHASE",
        "EBUILD_PHASE_FUNC", "EBUILD_SKIP_MANIFEST",
        "ED", "EMERGE_FROM", "EPREFIX", "EROOT",
-       "GREP_OPTIONS", "HOMEPAGE", "INHERITED", "IUSE", "IUSE_EFFECTIVE",
+       "GREP_OPTIONS", "HDEPEND", "HOMEPAGE",
+       "INHERITED", "IUSE", "IUSE_EFFECTIVE",
        "KEYWORDS", "LICENSE", "MERGE_TYPE",
        "PDEPEND", "PF", "PKGUSE", "PORTAGE_BACKGROUND",
        "PORTAGE_BACKGROUND_UNMERGE", "PORTAGE_BUILDIR_LOCKED",
index 894d14cd380907dda32971e76f849d514048e8e9..164014fb3d556f491e07f5a74c7d296d487eb6b6 100644 (file)
@@ -63,7 +63,7 @@ if sys.hexversion >= 0x3000000:
 _feature_flags_cache = {}
 
 def _get_feature_flags(eapi_attrs):
-       cache_key = (eapi_attrs.feature_flag_test,)
+       cache_key = (eapi_attrs.feature_flag_test, eapi_attrs.feature_flag_targetroot)
        flags = _feature_flags_cache.get(cache_key)
        if flags is not None:
                return flags
@@ -71,6 +71,8 @@ def _get_feature_flags(eapi_attrs):
        flags = []
        if eapi_attrs.feature_flag_test:
                flags.append("test")
+       if eapi_attrs.feature_flag_targetroot:
+               flags.append("targetroot")
 
        flags = frozenset(flags)
        _feature_flags_cache[cache_key] = flags
@@ -142,7 +144,7 @@ class config(object):
        _constant_keys = frozenset(['PORTAGE_BIN_PATH', 'PORTAGE_GID',
                'PORTAGE_PYM_PATH'])
 
-       _setcpv_aux_keys = ('DEFINED_PHASES', 'DEPEND', 'EAPI',
+       _setcpv_aux_keys = ('DEFINED_PHASES', 'DEPEND', 'EAPI', 'HDEPEND',
                'INHERITED', 'IUSE', 'REQUIRED_USE', 'KEYWORDS', 'LICENSE', 'PDEPEND',
                'PROPERTIES', 'PROVIDE', 'RDEPEND', 'SLOT',
                'repository', 'RESTRICT', 'LICENSE',)
@@ -1503,6 +1505,13 @@ class config(object):
                                        self.usemask = \
                                                frozenset(x for x in self.usemask if x != "test")
 
+               if eapi_attrs.feature_flag_targetroot and \
+                       ("targetroot" in explicit_iuse or iuse_implicit_match("targetroot")):
+                       if self["ROOT"] != "/":
+                               use.add("targetroot")
+                       else:
+                               use.discard("targetroot")
+
                # Allow _* flags from USE_EXPAND wildcards to pass through here.
                use.difference_update([x for x in use \
                        if (x not in explicit_iuse and \
index e7a8983da50b009fa0ba85d6f784f7f886ab55d0..b50b452eaa241632964ce71da1735ff75cc22ed0 100644 (file)
@@ -1735,7 +1735,7 @@ def _post_src_install_write_metadata(settings):
                                errors='strict') as f:
                                f.write(_unicode_decode(v + '\n'))
 
-_vdb_use_conditional_keys = ('DEPEND', 'LICENSE', 'PDEPEND',
+_vdb_use_conditional_keys = ('DEPEND', 'HDEPEND', 'LICENSE', 'PDEPEND',
        'PROPERTIES', 'PROVIDE', 'RDEPEND', 'RESTRICT',)
 
 def _preinst_bsdflags(mysettings):