From 814e82f24afc221eee72f2b53a3fb7587605cbf9 Mon Sep 17 00:00:00 2001 From: Ambroz Bizjak Date: Mon, 24 Sep 2012 13:13:46 -0700 Subject: Add experimental EAPI 5-hdepend support. --- bin/ebuild.sh | 34 +++++++++---- bin/phase-functions.sh | 2 +- pym/_emerge/FakeVartree.py | 6 ++- pym/_emerge/Package.py | 4 +- pym/_emerge/actions.py | 3 +- pym/_emerge/depgraph.py | 55 +++++++++++++--------- pym/_emerge/main.py | 1 - pym/portage/__init__.py | 4 +- pym/portage/dbapi/__init__.py | 3 +- pym/portage/dbapi/bintree.py | 12 +++-- pym/portage/dbapi/porttree.py | 3 +- pym/portage/dbapi/vartree.py | 2 +- pym/portage/dep/_slot_operator.py | 2 +- pym/portage/eapi.py | 9 +++- pym/portage/emaint/modules/move/move.py | 2 +- .../package/ebuild/_config/special_env_vars.py | 3 +- pym/portage/package/ebuild/config.py | 13 ++++- pym/portage/package/ebuild/doebuild.py | 2 +- 18 files changed, 105 insertions(+), 55 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 79da2b518..06e2c66f6 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -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 diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 2b9323147..97e762a39 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -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 \ diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py index fb1281c29..b3c913348 100644 --- a/pym/_emerge/FakeVartree.py +++ b/pym/_emerge/FakeVartree.py @@ -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') diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index e10140f5c..af329a128 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -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 diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 4b16dc9dc..af7ae8f7e 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -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, } diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 9da202c62..d228694ba 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -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)) diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index d19b7950f..c3e96465d 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -977,7 +977,6 @@ def parse_opts(tmpcmdline, silent=False): "type" : "choice", "choices" : true_y_or_n }, - } from optparse import OptionParser diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 30c7e726a..695f1ea0a 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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) diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index fc7c7eb3b..b7c0c7b0d 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -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 diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 7f0943607..cbcfa728f 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -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"] diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 0cb290fb4..b1a81b271 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -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"]) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 7d6d6a8f1..f8980f7a0 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -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", ]) diff --git a/pym/portage/dep/_slot_operator.py b/pym/portage/dep/_slot_operator.py index 8a2b774a8..9fe19fc59 100644 --- a/pym/portage/dep/_slot_operator.py +++ b/pym/portage/dep/_slot_operator.py @@ -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): diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py index b12d81de7..7c4584382 100644 --- a/pym/portage/eapi.py +++ b/pym/portage/eapi.py @@ -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)), diff --git a/pym/portage/emaint/modules/move/move.py b/pym/portage/emaint/modules/move/move.py index 018e6cac1..5e1d99492 100644 --- a/pym/portage/emaint/modules/move/move.py +++ b/pym/portage/emaint/modules/move/move.py @@ -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) diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py index 1bcbbf7ef..a3a95404b 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -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", diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 894d14cd3..164014fb3 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -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 \ diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index e7a8983da..b50b452ea 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -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): -- cgit v1.2.3-1-g7c22