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 B8BE0138350 for ; Tue, 18 Feb 2020 10:18:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F1C61E088F; Tue, 18 Feb 2020 10:18:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 CD490E088F for ; Tue, 18 Feb 2020 10:18:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 D50A734EE10 for ; Tue, 18 Feb 2020 10:18:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 78A939C for ; Tue, 18 Feb 2020 10:18:51 +0000 (UTC) From: "Ulrich Müller" 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 Müller" Message-ID: <1581760615.0d4ffd51d3dc86782dae2db9fe632f45af7eec87.ulm@gentoo> Subject: [gentoo-commits] proj/pms:master commit in: / X-VCS-Repository: proj/pms X-VCS-Files: ebuild-functions.tex X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 0d4ffd51d3dc86782dae2db9fe632f45af7eec87 X-VCS-Branch: master Date: Tue, 18 Feb 2020 10:18:51 +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: dfe5689f-7ed4-46a2-8bab-cc678413b53d X-Archives-Hash: 58d54a103d6bb127ba935f6b3424b9cb commit: 0d4ffd51d3dc86782dae2db9fe632f45af7eec87 Author: Ulrich Müller gentoo org> AuthorDate: Sat Feb 15 09:56:55 2020 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Sat Feb 15 09:56:55 2020 +0000 URL: https://gitweb.gentoo.org/proj/pms.git/commit/?id=0d4ffd51 ebuild-functions.tex: Update array detection code. Remove the space after "declare -a" for matching "declare -p" output. With the update of the bash version to 4.2 in EAPI 6, variables can have other attributes in addition, which would make the test fail. For example, see https://bugs.gentoo.org/444832#c7. The implementation in Portage already omits the space. Replace grep by functionally equivalent code in bash. This is how the test is implemented in package managers, and follows the principle that external programs should not be called unnecessarily. Redirect stderr for "declare -p", because it outputs an error message if the PATCHES variable is not defined. Signed-off-by: Ulrich Müller gentoo.org> ebuild-functions.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ebuild-functions.tex b/ebuild-functions.tex index 33c003a..4a13db6 100644 --- a/ebuild-functions.tex +++ b/ebuild-functions.tex @@ -133,7 +133,7 @@ as: \caption{\t{src_prepare}, format~6} \begin{verbatim} src_prepare() { - if declare -p PATCHES | grep -q "^declare -a "; then + if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}" else [[ -n ${PATCHES} ]] && eapply ${PATCHES} @@ -325,13 +325,13 @@ src_install() { emake DESTDIR="${D}" install fi - if ! declare -p DOCS >/dev/null 2>&1 ; then + if ! declare -p DOCS >/dev/null 2>&1; then local d for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \ - THANKS BUGS FAQ CREDITS CHANGELOG ; do + THANKS BUGS FAQ CREDITS CHANGELOG; do [[ -s "${d}" ]] && dodoc "${d}" done - elif declare -p DOCS | grep -q "^declare -a " ; then + elif [[ $(declare -p DOCS) == "declare -a"* ]]; then dodoc "${DOCS[@]}" else dodoc ${DOCS}