From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R2srA-0007qS-FH for garchives@archives.gentoo.org; Sun, 11 Sep 2011 22:50:32 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 325F121C0DD; Sun, 11 Sep 2011 22:50:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id DC27721C0DD for ; Sun, 11 Sep 2011 22:50:23 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 465C91B4008 for ; Sun, 11 Sep 2011 22:50:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 7645280042 for ; Sun, 11 Sep 2011 22:50:22 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ebuild.sh bin/phase-helpers.sh X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: e40e2bce40464dace057d91f0a24ba682928814a Date: Sun, 11 Sep 2011 22:50:22 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: c8c9136405c9ea301cbb3d4698266798 commit: e40e2bce40464dace057d91f0a24ba682928814a Author: Zac Medico gentoo org> AuthorDate: Sun Sep 11 22:50:07 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Sep 11 22:50:07 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3De40e2bce build.sh: has/best_version to phase-helpers.sh --- bin/ebuild.sh | 59 ++++----------------------------------------= ----- bin/phase-helpers.sh | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 54 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 6bcc6b3..4dd2921 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -127,30 +127,6 @@ esyslog() { return 0 } =20 -# Return true if given package is installed. Otherwise return false. -# Takes single depend-type atoms. -has_version() { - if [ "${EBUILD_PHASE}" =3D=3D "depend" ]; then - die "portageq calls (has_version calls portageq) are not allowed in th= e global scope" - fi - - if [[ -n $PORTAGE_IPC_DAEMON ]] ; then - "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" - else - PYTHONPATH=3D${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" ha= s_version "${ROOT}" "$1" - fi - local retval=3D$? - case "${retval}" in - 0|1) - return ${retval} - ;; - *) - die "unexpected portageq exit code: ${retval}" - ;; - esac -} - portageq() { if [ "${EBUILD_PHASE}" =3D=3D "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" "$@= " } =20 - -# ----------------------------------------------------------------------= ------ -# ----------------------------------------------------------------------= ------ -# ----------------------------------------------------------------------= ------ - - -# Returns the best/most-current match. -# Takes single depend-type atoms. -best_version() { - if [ "${EBUILD_PHASE}" =3D=3D "depend" ]; then - die "portageq calls (best_version calls portageq) are not allowed in t= he global scope" - fi - - if [[ -n $PORTAGE_IPC_DAEMON ]] ; then - "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" - else - PYTHONPATH=3D${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" 'b= est_version' "${ROOT}" "$1" - fi - local retval=3D$? - 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 scop= e\"; }" + done unset x fi =20 diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 6064346..1f39c75 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -571,3 +571,45 @@ _eapi4_src_install() { dodoc ${DOCS} fi } + +# Return true if given package is installed. Otherwise return false. +# Takes single depend-type atoms. +has_version() { + + if [[ -n $PORTAGE_IPC_DAEMON ]] ; then + "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" + else + PYTHONPATH=3D${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ + "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" ha= s_version "${ROOT}" "$1" + fi + local retval=3D$? + case "${retval}" in + 0|1) + return ${retval} + ;; + *) + die "unexpected portageq exit code: ${retval}" + ;; + esac +} + +# Returns the best/most-current match. +# Takes single depend-type atoms. +best_version() { + + if [[ -n $PORTAGE_IPC_DAEMON ]] ; then + "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" + else + PYTHONPATH=3D${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ + "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" be= st_version "${ROOT}" "$1" + fi + local retval=3D$? + case "${retval}" in + 0|1) + return ${retval} + ;; + *) + die "unexpected portageq exit code: ${retval}" + ;; + esac +}