FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Portage Developer

 
 
LinkBack Thread Tools
 
Old 09-24-2012, 02:06 AM
Ambroz Bizjak
 
Default Implement host dependencies (HDEPEND) and dependencies only in affect when ROOT != / (targetroot flag).

---
bin/ebuild.sh | 30 ++++++++++++++-----
pym/_emerge/depgraph.py | 57 +++++++++++++++++++++---------------
pym/_emerge/main.py | 1 -
pym/portage/__init__.py | 4 +--
pym/portage/dbapi/bintree.py | 6 ++--
pym/portage/dbapi/porttree.py | 2 +-
pym/portage/dbapi/vartree.py | 1 +
pym/portage/eapi.py | 9 +++++-
pym/portage/package/ebuild/config.py | 14 +++++++--
9 files changed, 85 insertions(+), 39 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 79da2b5..a376d2f 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,9 +567,10 @@ 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
@@ -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}"
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 9da202c..dca1a74 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 d19b795..c3e9646 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 30c7e72..695f1ea 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/bintree.py b/pym/portage/dbapi/bintree.py
index 7f09436..921f51d 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -75,6 +75,7 @@ class bindbapi(fakedbapi):
["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS",
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE",
"RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES",
+ "HDEPEND",
])
self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys)
self._aux_cache = {}
@@ -304,11 +305,11 @@ class binarytree(object):
["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI",
"IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES",
"PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES",
- "BASE_URI"]
+ "BASE_URI", "HDEPEND"]
self._pkgindex_aux_keys = list(self._pkgindex_aux_keys)
self._pkgindex_use_evaluated_keys =
("LICENSE", "RDEPEND", "DEPEND",
- "PDEPEND", "PROPERTIES", "PROVIDE")
+ "PDEPEND", "PROPERTIES", "PROVIDE", "HDEPEND")
self._pkgindex_header_keys = set([
"ACCEPT_KEYWORDS", "ACCEPT_LICENSE",
"ACCEPT_PROPERTIES", "CBUILD",
@@ -330,6 +331,7 @@ class binarytree(object):
"SLOT" : "0",
"USE" : "",
"DEFINED_PHASES" : "",
+ "HDEPEND" : "",
}
self._pkgindex_inherited_keys = ["CHOST", "repository"]

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 0cb290f..b6b3d00 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -189,7 +189,7 @@ class portdbapi(dbapi):
self._aux_cache_keys = set(
["DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS", "LICENSE",
"PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository",
- "RESTRICT", "SLOT", "DEFINED_PHASES", "REQUIRED_USE"])
+ "RESTRICT", "SLOT", "DEFINED_PHASES", "REQUIRED_USE", "HDEPEND"])

self._aux_cache = {}
self._broken_ebuilds = set()
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 7d6d6a8..0822883 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -164,6 +164,7 @@ class vardbapi(dbapi):
"EAPI", "HOMEPAGE", "IUSE", "KEYWORDS",
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND",
"repository", "RESTRICT" , "SLOT", "USE", "DEFINED_PHASES",
+ "HDEPEND",
])
self._aux_cache_obj = None
self._aux_cache_filename = os.path.join(self._eroot,
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index b12d81d..7c45843 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_repos itory_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/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 894d14c..4992292 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -33,7 +33,8 @@ from portage.dbapi.porttree import portdbapi
from portage.dbapi.vartree import vartree
from portage.dep import Atom, isvalidatom, match_from_list, use_reduce, _repo_separator, _slot_separator
from portage.eapi import eapi_exports_AA, eapi_exports_merge_type,
- eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs
+ eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs,
+ eapi_has_targetroot
from portage.env.loaders import KeyValuePairFileLoader
from portage.exception import InvalidDependString, PortageException
from portage.localization import _
@@ -63,7 +64,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 +72,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
@@ -1503,6 +1506,13 @@ class config(object):
self.usemask =
frozenset(x for x in self.usemask if x != "test")

+ if ("targetroot" in explicit_iuse or iuse_implicit_match("targetroot")) and
+ eapi_has_targetroot(eapi):
+ 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
--
1.7.12
 
Old 09-24-2012, 03:44 AM
Mike Frysinger
 
Default Implement host dependencies (HDEPEND) and dependencies only in affect when ROOT != / (targetroot flag).

On Sunday 23 September 2012 22:06:43 Ambroz Bizjak wrote:
> + case "$EAPI" in

case ${EAPI} in
-mike
 
Old 09-24-2012, 03:53 AM
Zac Medico
 
Default Implement host dependencies (HDEPEND) and dependencies only in affect when ROOT != / (targetroot flag).

On 09/23/2012 08:44 PM, Mike Frysinger wrote:
> On Sunday 23 September 2012 22:06:43 Ambroz Bizjak wrote:
>> + case "$EAPI" in
>
> case ${EAPI} in
> -mike

If somebody manages to corrupt the EAPI with an invalid value containing
space, then you can get a bash syntax error there if ${EAPI} is
unquoted. Yeah, it's a user error, but it could confuse them even more
than they are already if they see the syntax error and think that
portage is at fault. Also, we might consider that a corrupt EAPI can
come from a binary package (or /var/db/pkg) enviroment.bz2, and so it
may not even be the current user who is at fault.
--
Thanks,
Zac
 

Thread Tools




All times are GMT. The time now is 04:36 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org