From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-500456-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 809AA138010
	for <garchives@archives.gentoo.org>; Fri, 31 Aug 2012 14:47:35 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B4B3DE0511;
	Fri, 31 Aug 2012 14:47:17 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 7E34FE0511
	for <gentoo-commits@lists.gentoo.org>; Fri, 31 Aug 2012 14:47:17 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id A501D33D7E5
	for <gentoo-commits@lists.gentoo.org>; Fri, 31 Aug 2012 14:47:16 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 61B34E543C
	for <gentoo-commits@lists.gentoo.org>; Fri, 31 Aug 2012 14:47:15 +0000 (UTC)
From: "Ulrich Mueller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Mueller" <ulm@gentoo.org>
Message-ID: <1346424405.b9e2daded3663c59bf11b04e952bdfb4eb5deabf.ulm@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/ebuild.sh bin/phase-helpers.sh bin/save-ebuild-env.sh
X-VCS-Directories: bin/
X-VCS-Committer: ulm
X-VCS-Committer-Name: Ulrich Mueller
X-VCS-Revision: b9e2daded3663c59bf11b04e952bdfb4eb5deabf
X-VCS-Branch: master
Date: Fri, 31 Aug 2012 14:47:15 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: ab398faf-6e57-4a1a-81d1-4535674ea12f
X-Archives-Hash: 7da9e93e6915b852ecde521e82fccec7

commit:     b9e2daded3663c59bf11b04e952bdfb4eb5deabf
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 31 14:24:09 2012 +0000
Commit:     Ulrich Mueller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Aug 31 14:46:45 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b9e2dade

EAPI 5: usex helper function

See bug #382963.

---
 bin/ebuild.sh          |    2 +-
 bin/phase-helpers.sh   |   14 ++++++++++++++
 bin/save-ebuild-env.sh |    5 +++++
 3 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index d3ca9d9..51e90d7 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -33,7 +33,7 @@ else
 	done
 	# These dummy functions return false in older EAPIs, in order to ensure that
 	# `use multislot` is false for the "depend" phase.
-	for x in use useq usev ; do
+	for x in use useq usev usex ; do
 		eval "${x}() {
 			if has \"\${EAPI:-0}\" 4-python; then
 				die \"\${FUNCNAME}() calls are not allowed in global scope\"

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 6899488..5f170fc 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -174,6 +174,20 @@ usev() {
 	return 1
 }
 
+case ${EAPI} in
+	0|1|2|3|4) ;;
+	*)
+		usex() {
+			if use "$1"; then
+				echo "${2-yes}$4"
+			else
+				echo "${3-no}$5"
+			fi
+			return 0
+		}
+		;;
+esac
+
 use() {
 	local u=$1
 	local found=0

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 4bf6e4e..a6d1c61 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -73,6 +73,11 @@ save_ebuild_env() {
 		_hasg _hasgq _unpack_tar \
 		${QA_INTERCEPTORS}
 
+	case ${EAPI} in
+		0|1|2|3|4) ;;
+		*) unset -f usex ;;
+	esac
+
 	# portage config variables and variables set directly by portage
 	unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \
 		DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \