1 |
On Sonntag, 24. März 2019 19:41:24 CET Michał Górny wrote: |
2 |
> On Sun, 2019-03-24 at 18:17 +0100, Andreas Sturmlechner wrote: |
3 |
> |
4 |
> -U9999, please. This is a huge eclass and probably requires more work |
5 |
> than you're showing us ;-). |
6 |
|
7 |
I dreaded that reply already. Anyone here from fonts team to comment on non-EAPI-7 changes...? |
8 |
|
9 |
|
10 |
--- |
11 |
eclass/font.eclass | 73 +++++++++++++++++++++++----------------------- |
12 |
1 file changed, 36 insertions(+), 37 deletions(-) |
13 |
|
14 |
diff --git a/eclass/font.eclass b/eclass/font.eclass |
15 |
index 58ec9e3..06736e5 100644 |
16 |
--- a/eclass/font.eclass |
17 |
+++ b/eclass/font.eclass |
18 |
@@ -1,4 +1,4 @@ |
19 |
-# Copyright 1999-2015 Gentoo Foundation |
20 |
+# Copyright 1999-2019 Gentoo Foundation |
21 |
# Distributed under the terms of the GNU General Public License v2 |
22 |
|
23 |
# @ECLASS: font.eclass |
24 |
@@ -7,12 +7,11 @@ |
25 |
# @BLURB: Eclass to make font installation uniform |
26 |
|
27 |
case ${EAPI:-0} in |
28 |
- 0|1|2|3|4|5|6) ;; |
29 |
- *) die "EAPI ${EAPI} is not supported by font.eclass." ;; |
30 |
+ 0|1|2|3|4|5|6) inherit eutils ;; |
31 |
+ 7) ;; |
32 |
+ *) die "EAPI ${EAPI} is not supported by font.eclass." ;; |
33 |
esac |
34 |
|
35 |
-inherit eutils |
36 |
- |
37 |
EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm |
38 |
|
39 |
# @ECLASS-VARIABLE: FONT_SUFFIX |
40 |
@@ -68,12 +67,12 @@ font_xfont_config() { |
41 |
if has X ${IUSE//+} && use X ; then |
42 |
dir_name="${1:-${FONT_PN}}" |
43 |
ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}" |
44 |
- rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} |
45 |
- mkfontscale "${ED}${FONTDIR}/${1//${S}/}" |
46 |
+ rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} |
47 |
+ mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" |
48 |
mkfontdir \ |
49 |
-e ${EPREFIX}/usr/share/fonts/encodings \ |
50 |
-e ${EPREFIX}/usr/share/fonts/encodings/large \ |
51 |
- "${ED}${FONTDIR}/${1//${S}/}" |
52 |
+ "${ED%/}/${FONTDIR}/${1//${S}/}" |
53 |
eend $? |
54 |
if [[ -e fonts.alias ]] ; then |
55 |
doins fonts.alias |
56 |
@@ -103,7 +102,7 @@ font_cleanup_dirs() { |
57 |
local d f g generated candidate otherfile |
58 |
|
59 |
ebegin "Cleaning up font directories" |
60 |
- find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do |
61 |
+ find -L "${EROOT%/}"/usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do |
62 |
candidate=false |
63 |
otherfile=false |
64 |
for f in "${d}"/*; do |
65 |
@@ -160,7 +159,7 @@ font_pkg_setup() { |
66 |
|
67 |
# make sure we get no collisions |
68 |
# setup is not the nicest place, but preinst doesn't cut it |
69 |
- [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1" |
70 |
+ [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT%/}/${FONTDIR}/fonts.cache-1" |
71 |
} |
72 |
|
73 |
# @FUNCTION: font_src_install |
74 |
@@ -202,36 +201,47 @@ font_src_install() { |
75 |
done |
76 |
} |
77 |
|
78 |
+# @FUNCTION: _update_fontcache |
79 |
+# @DESCRIPTION: |
80 |
+# Updates fontcache if !prefix and media-libs/fontconfig installed |
81 |
+_update_fontcache() { |
82 |
+ # unreadable font files = fontconfig segfaults |
83 |
+ find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 \ |
84 |
+ -exec chmod -v 0644 2>/dev/null {} + || die "failed to fix font files perms" |
85 |
+ |
86 |
+ if [[ -z ${ROOT%/} ]] ; then |
87 |
+ if has_version media-libs/fontconfig ; then |
88 |
+ ebegin "Updating global fontcache" |
89 |
+ fc-cache -fs |
90 |
+ if ! eend $? ; then |
91 |
+ die "failed to update global fontcache" |
92 |
+ fi |
93 |
+ else |
94 |
+ einfo "Skipping fontcache update (media-libs/fontconfig not installed)" |
95 |
+ fi |
96 |
+ else |
97 |
+ einfo "Skipping fontcache update (ROOT != /)" |
98 |
+ fi |
99 |
+} |
100 |
+ |
101 |
# @FUNCTION: font_pkg_postinst |
102 |
# @DESCRIPTION: |
103 |
# The font pkg_postinst function. |
104 |
font_pkg_postinst() { |
105 |
- # unreadable font files = fontconfig segfaults |
106 |
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ |
107 |
- | xargs -0 chmod -v 0644 2>/dev/null |
108 |
- |
109 |
if [[ -n ${FONT_CONF[@]} ]]; then |
110 |
local conffile |
111 |
- echo |
112 |
elog "The following fontconfig configuration files have been installed:" |
113 |
elog |
114 |
for conffile in "${FONT_CONF[@]}"; do |
115 |
- if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then |
116 |
- elog " $(basename ${conffile})" |
117 |
+ if [[ -e "${EROOT%/}"/etc/fonts/conf.avail/${conffile##*/} ]]; then |
118 |
+ elog " ${conffile##*/}" |
119 |
fi |
120 |
done |
121 |
elog |
122 |
elog "Use \`eselect fontconfig\` to enable/disable them." |
123 |
- echo |
124 |
fi |
125 |
|
126 |
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then |
127 |
- ebegin "Updating global fontcache" |
128 |
- fc-cache -fs |
129 |
- eend $? |
130 |
- else |
131 |
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)" |
132 |
- fi |
133 |
+ _update_fontcache |
134 |
} |
135 |
|
136 |
# @FUNCTION: font_pkg_postrm |
137 |
@@ -239,16 +249,5 @@ font_pkg_postinst() { |
138 |
# The font pkg_postrm function. |
139 |
font_pkg_postrm() { |
140 |
font_cleanup_dirs |
141 |
- |
142 |
- # unreadable font files = fontconfig segfaults |
143 |
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ |
144 |
- | xargs -0 chmod -v 0644 2>/dev/null |
145 |
- |
146 |
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then |
147 |
- ebegin "Updating global fontcache" |
148 |
- fc-cache -fs |
149 |
- eend $? |
150 |
- else |
151 |
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)" |
152 |
- fi |
153 |
+ _update_fontcache |
154 |
} |
155 |
-- |
156 |
2.21.0 |