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 1QHiJi-0003c6-RG for garchives@archives.gentoo.org; Wed, 04 May 2011 20:05:03 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 01C181C091; Wed, 4 May 2011 20:03:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B2FF11C04A for ; Wed, 4 May 2011 20:03:35 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5BE962AC02E for ; Wed, 4 May 2011 20:03:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B965580505 for ; Wed, 4 May 2011 20:03:34 +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:2.1.9 commit in: man/, bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ebuild.sh man/portage.5 X-VCS-Directories: man/ bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: d78d81084de5fe974ecebf64a7080914428f5afc Date: Wed, 4 May 2011 20:03:34 +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: 6fc0dd23f4ff9d4f4932613adc895a32 commit: d78d81084de5fe974ecebf64a7080914428f5afc Author: Arfrever Frehtes Taifersar Arahesis Gentoo Org> AuthorDate: Sun May 1 14:50:30 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed May 4 19:49:03 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dd78d8108 Support multiple arguments in set_unless_changed() and unset_unless_chang= ed(). Use VARIABLE=3DVALUE syntax for arguments of set_unless_changed(). --- bin/ebuild.sh | 43 +++++++++++++++++++++++++------------------ man/portage.5 | 4 ++-- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index e652cb5..6593755 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1639,32 +1639,39 @@ _ebuild_phase_funcs() { esac } =20 -# Set given variable unless this variable has been already set (e.g. dur= ing emerge -# invocation) to a value different than value set in make.conf. +# Set given variables unless these variable have been already set (e.g. = during emerge +# invocation) to values different than values set in make.conf. set_unless_changed() { - if [[ $# -ne 2 ]]; then - die "${FUNCNAME}() requires 2 arguments: VARIABLE VALUE" + if [[ $# -lt 1 ]]; then + die "${FUNCNAME}() requires at least 1 argument: VARIABLE=3DVALUE" fi =20 - local variable=3D"$1" value=3D"$2" - - if eval "[[ \${${variable}} =3D=3D \$(env -u ${variable} portageq envva= r ${variable}) ]]"; then - eval "${variable}=3D\"${value}\"" - fi + local argument value variable + for argument in "$@"; do + if [[ ${argument} !=3D *=3D* ]]; then + die "${FUNCNAME}(): Argument '${argument}' has incorrect syntax" + fi + variable=3D"${argument%%=3D*}" + value=3D"${argument#*=3D}" + if eval "[[ \${${variable}} =3D=3D \$(env -u ${variable} portageq envv= ar ${variable}) ]]"; then + eval "${variable}=3D\"${value}\"" + fi + done } =20 -# Unset given variable unless this variable has been set (e.g. during em= erge -# invocation) to a value different than value set in make.conf. +# Unset given variables unless these variable have been set (e.g. during= emerge +# invocation) to values different than values set in make.conf. unset_unless_changed() { - if [[ $# -ne 1 ]]; then - die "${FUNCNAME}() requires 1 argument: VARIABLE" + if [[ $# -lt 1 ]]; then + die "${FUNCNAME}() requires at least 1 argument: VARIABLE" fi =20 - local variable=3D"$1" - - if eval "[[ \${${variable}} =3D=3D \$(env -u ${variable} portageq envva= r ${variable}) ]]"; then - unset ${variable} - fi + local variable + for variable in "$@"; do + if eval "[[ \${${variable}} =3D=3D \$(env -u ${variable} portageq envv= ar ${variable}) ]]"; then + unset ${variable} + fi + done } =20 PORTAGE_BASHRCS_SOURCED=3D0 diff --git a/man/portage.5 b/man/portage.5 index 90b1648..27c1d7c 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -678,12 +678,12 @@ set_unless_changed and unset_unless_changed functio= ns can be used to set or unset given variables only if these variable have not been set to values different than values set in make.conf. This functionality can be useful= for temporary overriding of these variables during emerge invocation. Variab= les -set in the usual VARIABLE=3DVALUE style will unconditionally override va= riables +set without using set_unless_changed will unconditionally override varia= bles set during emerge invocation. =20 .I Syntax: .nf -set_unless_changed VARIABLE VALUE +set_unless_changed VARIABLE=3DVALUE unset_unless_changed VALUE .fi =20