From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 18B1A138334 for ; Mon, 20 May 2019 00:35:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 34AC1E0843; Mon, 20 May 2019 00:35:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1277CE0843 for ; Mon, 20 May 2019 00:35:25 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5CEBA344241 for ; Mon, 20 May 2019 00:35:24 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6143957F for ; Mon, 20 May 2019 00:35:22 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1558310652.5473a2695aa3fb3a7cdee889fe8c861fcb274277.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/isolated-functions.sh bin/phase-helpers.sh X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 5473a2695aa3fb3a7cdee889fe8c861fcb274277 X-VCS-Branch: master Date: Mon, 20 May 2019 00:35: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 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5fb04ea1-9550-40c1-947d-a2579624ece4 X-Archives-Hash: d3e98deca3b70405a41d645273378b53 commit: 5473a2695aa3fb3a7cdee889fe8c861fcb274277 Author: Ross Konsolebox gmail com> AuthorDate: Wed Aug 1 14:40:59 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon May 20 00:04:12 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5473a269 Add bash ___is_indexed_array_var function (bug 662468) Closes: https://bugs.gentoo.org/662468 Signed-off-by: Zac Medico gentoo.org> bin/isolated-functions.sh | 10 ++++++++++ bin/phase-helpers.sh | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 22a6dbb0f..e4e769a04 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -593,4 +593,14 @@ __eqatag() { ) >> "${T}"/qa.log } +if [[ BASH_VERSINFO -gt 4 || (BASH_VERSINFO -eq 4 && BASH_VERSINFO[1] -ge 4) ]] ; then + ___is_indexed_array_var() { + [[ ${!1@a} == *a* ]] + } +else + ___is_indexed_array_var() { + [[ $(declare -p "$1" 2>/dev/null) == 'declare -a'* ]] + } +fi + true diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 64a82b4b7..02633125f 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -853,7 +853,7 @@ __eapi4_src_install() { THANKS BUGS FAQ CREDITS CHANGELOG ; do [[ -s "${d}" ]] && dodoc "${d}" done - elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then + elif ___is_indexed_array_var DOCS ; then dodoc "${DOCS[@]}" else dodoc ${DOCS} @@ -861,7 +861,7 @@ __eapi4_src_install() { } __eapi6_src_prepare() { - if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then + if ___is_indexed_array_var PATCHES ; then [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}" elif [[ -n ${PATCHES} ]]; then eapply ${PATCHES} @@ -996,7 +996,7 @@ if ___eapi_has_einstalldocs; then THANKS BUGS FAQ CREDITS CHANGELOG ; do [[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}" done - elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then + elif ___is_indexed_array_var DOCS ; then [[ ${#DOCS[@]} -gt 0 ]] && docinto / && dodoc -r "${DOCS[@]}" else [[ ${DOCS} ]] && docinto / && dodoc -r ${DOCS} @@ -1004,7 +1004,7 @@ if ___eapi_has_einstalldocs; then ) ( - if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then + if ___is_indexed_array_var HTML_DOCS ; then [[ ${#HTML_DOCS[@]} -gt 0 ]] && \ docinto html && dodoc -r "${HTML_DOCS[@]}" else