1 |
Accessing ${S} in global scope is not allowed by PMS, therefore remove |
2 |
the global variable assignment of FONT_S which uses it. Add a fallback |
3 |
to ${S} in font_src_install() instead. |
4 |
|
5 |
Allow FONT_S to be an array, if there are multiple directories. |
6 |
Support for whitespace-separated lists will be kept for some time, |
7 |
and a QA warning will be shown. |
8 |
|
9 |
Die if pushd or popd fails. |
10 |
|
11 |
Closes: https://bugs.gentoo.org/613108 |
12 |
Closes: https://bugs.gentoo.org/709578 |
13 |
Signed-off-by: Ulrich Müller <ulm@g.o> |
14 |
--- |
15 |
v2: Quote pattern substitution, fix die message |
16 |
|
17 |
eclass/font.eclass | 36 ++++++++++++++++++++++++------------ |
18 |
1 file changed, 24 insertions(+), 12 deletions(-) |
19 |
|
20 |
diff --git a/eclass/font.eclass b/eclass/font.eclass |
21 |
index 1287f2273454..6b50c28890a1 100644 |
22 |
--- a/eclass/font.eclass |
23 |
+++ b/eclass/font.eclass |
24 |
@@ -1,4 +1,4 @@ |
25 |
-# Copyright 1999-2019 Gentoo Authors |
26 |
+# Copyright 1999-2020 Gentoo Authors |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
|
29 |
# @ECLASS: font.eclass |
30 |
@@ -25,10 +25,10 @@ EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm |
31 |
FONT_SUFFIX=${FONT_SUFFIX:-} |
32 |
|
33 |
# @ECLASS-VARIABLE: FONT_S |
34 |
-# @REQUIRED |
35 |
+# @DEFAULT_UNSET |
36 |
# @DESCRIPTION: |
37 |
-# Space delimited list of directories containing the fonts. |
38 |
-FONT_S=${FONT_S:-${S}} |
39 |
+# Directory containing the fonts. If unset, ${S} is used instead. |
40 |
+# Can also be an array of several directories. |
41 |
|
42 |
# @ECLASS-VARIABLE: FONT_PN |
43 |
# @DESCRIPTION: |
44 |
@@ -159,27 +159,39 @@ font_pkg_setup() { |
45 |
font_src_install() { |
46 |
local dir suffix commondoc |
47 |
|
48 |
- set -- ${FONT_S:-${S}} |
49 |
- if [[ $# -gt 1 ]]; then |
50 |
- # if we have multiple FONT_S elements then we want to recreate the dir |
51 |
- # structure |
52 |
+ if [[ $(declare -p FONT_S) == "declare -a "* ]]; then |
53 |
+ # recreate the directory structure if FONT_S is an array |
54 |
+ for dir in "${FONT_S[@]}"; do |
55 |
+ pushd "${dir}" > /dev/null || die "pushd ${dir} failed" |
56 |
+ insinto "${FONTDIR}/${dir#"${S}"}" |
57 |
+ for suffix in ${FONT_SUFFIX}; do |
58 |
+ doins *.${suffix} |
59 |
+ done |
60 |
+ font_xfont_config "${dir}" |
61 |
+ popd > /dev/null || die |
62 |
+ done |
63 |
+ elif [[ ${FONT_S/ } != "${FONT_S}" ]]; then |
64 |
+ # backwards compatibility code, can be removed after 2021-02-14 |
65 |
+ eqawarn "Using a space-separated list for FONT_S is deprecated." |
66 |
+ eqawarn "Use a bash array instead if there are multiple directories." |
67 |
for dir in ${FONT_S}; do |
68 |
- pushd "${dir}" > /dev/null |
69 |
+ pushd "${dir}" > /dev/null || die "pushd ${dir} failed" |
70 |
insinto "${FONTDIR}/${dir//${S}/}" |
71 |
for suffix in ${FONT_SUFFIX}; do |
72 |
doins *.${suffix} |
73 |
done |
74 |
font_xfont_config "${dir}" |
75 |
- popd > /dev/null |
76 |
+ popd > /dev/null || die |
77 |
done |
78 |
else |
79 |
- pushd "${FONT_S}" > /dev/null |
80 |
+ pushd "${FONT_S:-${S}}" > /dev/null \ |
81 |
+ || die "pushd ${FONT_S:-${S}} failed" |
82 |
insinto "${FONTDIR}" |
83 |
for suffix in ${FONT_SUFFIX}; do |
84 |
doins *.${suffix} |
85 |
done |
86 |
font_xfont_config |
87 |
- popd > /dev/null |
88 |
+ popd > /dev/null || die |
89 |
fi |
90 |
|
91 |
font_fontconfig |
92 |
-- |
93 |
2.25.0 |