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