Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pms:master commit in: /
Date: Tue, 18 Feb 2020 10:18:54
Message-Id: 1581760615.0d4ffd51d3dc86782dae2db9fe632f45af7eec87.ulm@gentoo
1 commit: 0d4ffd51d3dc86782dae2db9fe632f45af7eec87
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 15 09:56:55 2020 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 15 09:56:55 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/pms.git/commit/?id=0d4ffd51
7
8 ebuild-functions.tex: Update array detection code.
9
10 Remove the space after "declare -a" for matching "declare -p" output.
11 With the update of the bash version to 4.2 in EAPI 6, variables can
12 have other attributes in addition, which would make the test fail.
13 For example, see https://bugs.gentoo.org/444832#c7. The implementation
14 in Portage already omits the space.
15
16 Replace grep by functionally equivalent code in bash. This is how the
17 test is implemented in package managers, and follows the principle
18 that external programs should not be called unnecessarily.
19
20 Redirect stderr for "declare -p", because it outputs an error message
21 if the PATCHES variable is not defined.
22
23 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
24
25 ebuild-functions.tex | 8 ++++----
26 1 file changed, 4 insertions(+), 4 deletions(-)
27
28 diff --git a/ebuild-functions.tex b/ebuild-functions.tex
29 index 33c003a..4a13db6 100644
30 --- a/ebuild-functions.tex
31 +++ b/ebuild-functions.tex
32 @@ -133,7 +133,7 @@ as:
33 \caption{\t{src_prepare}, format~6}
34 \begin{verbatim}
35 src_prepare() {
36 - if declare -p PATCHES | grep -q "^declare -a "; then
37 + if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
38 [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}"
39 else
40 [[ -n ${PATCHES} ]] && eapply ${PATCHES}
41 @@ -325,13 +325,13 @@ src_install() {
42 emake DESTDIR="${D}" install
43 fi
44
45 - if ! declare -p DOCS >/dev/null 2>&1 ; then
46 + if ! declare -p DOCS >/dev/null 2>&1; then
47 local d
48 for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \
49 - THANKS BUGS FAQ CREDITS CHANGELOG ; do
50 + THANKS BUGS FAQ CREDITS CHANGELOG; do
51 [[ -s "${d}" ]] && dodoc "${d}"
52 done
53 - elif declare -p DOCS | grep -q "^declare -a " ; then
54 + elif [[ $(declare -p DOCS) == "declare -a"* ]]; then
55 dodoc "${DOCS[@]}"
56 else
57 dodoc ${DOCS}