From e40e2bce40464dace057d91f0a24ba682928814a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 11 Sep 2011 15:50:07 -0700 Subject: build.sh: has/best_version to phase-helpers.sh --- bin/ebuild.sh | 59 +++++------------------------------------------------------ 1 file changed, 5 insertions(+), 54 deletions(-) (limited to 'bin/ebuild.sh') diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 6bcc6b314..4dd29216a 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -127,30 +127,6 @@ esyslog() { return 0 } -# Return true if given package is installed. Otherwise return false. -# Takes single depend-type atoms. -has_version() { - if [ "${EBUILD_PHASE}" == "depend" ]; then - die "portageq calls (has_version calls portageq) are not allowed in the global scope" - fi - - if [[ -n $PORTAGE_IPC_DAEMON ]] ; then - "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" - else - PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1" - fi - local retval=$? - case "${retval}" in - 0|1) - return ${retval} - ;; - *) - die "unexpected portageq exit code: ${retval}" - ;; - esac -} - portageq() { if [ "${EBUILD_PHASE}" == "depend" ]; then die "portageq calls are not allowed in the global scope" @@ -160,36 +136,6 @@ portageq() { "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" "$@" } - -# ---------------------------------------------------------------------------- -# ---------------------------------------------------------------------------- -# ---------------------------------------------------------------------------- - - -# Returns the best/most-current match. -# Takes single depend-type atoms. -best_version() { - if [ "${EBUILD_PHASE}" == "depend" ]; then - die "portageq calls (best_version calls portageq) are not allowed in the global scope" - fi - - if [[ -n $PORTAGE_IPC_DAEMON ]] ; then - "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" - else - PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1" - fi - local retval=$? - case "${retval}" in - 0|1) - return ${retval} - ;; - *) - die "unexpected portageq exit code: ${retval}" - ;; - esac -} - register_die_hook() { local x for x in $* ; do @@ -793,6 +739,11 @@ else keepdir libopts use useq usev use_with use_enable ; do eval "${x}() { : ; }" done + # These functions die because calls to them during the "depend" phase + # are considered to be severe QA violations. + for x in best_version has_version ; do + eval "${x}() { die \"\${FUNCNAME} calls are not allowed in global scope\"; }" + done unset x fi -- cgit v1.2.3-1-g7c22