Gentoo Archives: gentoo-dev

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH 2/3] font.eclass: Add error handling where applicable
Date: Sun, 24 Mar 2019 20:52:47
Message-Id: 1760897.CuJCMtYBCR@tuxk10
1 ---
2 eclass/font.eclass | 28 +++++++++++++++++-----------
3 1 file changed, 17 insertions(+), 11 deletions(-)
4
5 diff --git a/eclass/font.eclass b/eclass/font.eclass
6 index 06736e5..fef6b79 100644
7 --- a/eclass/font.eclass
8 +++ b/eclass/font.eclass
9 @@ -66,17 +66,18 @@ font_xfont_config() {
10 local dir_name
11 if has X ${IUSE//+} && use X ; then
12 dir_name="${1:-${FONT_PN}}"
13 + rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} \
14 + || die "failed to prepare ${FONTDIR}/${1//${S}/}"
15 ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
16 - rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
17 - mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}"
18 + mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.scale"
19 mkfontdir \
20 -e ${EPREFIX}/usr/share/fonts/encodings \
21 -e ${EPREFIX}/usr/share/fonts/encodings/large \
22 - "${ED%/}/${FONTDIR}/${1//${S}/}"
23 - eend $?
24 - if [[ -e fonts.alias ]] ; then
25 - doins fonts.alias
26 + "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.dir"
27 + if ! eend $? ; then
28 + die "failed to run mkfontscale or mkfontdir"
29 fi
30 + [[ -e fonts.alias ]] && doins fonts.alias
31 fi
32 }
33
34 @@ -130,11 +131,12 @@ font_cleanup_dirs() {
35 # media-fonts/font-alias. any other fonts.alias files will have
36 # already been unmerged with their packages.
37 for g in ${genfiles}; do
38 - [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] \
39 - && rm "${d}"/${g}
40 + if [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] ; then
41 + rm "${d}"/${g} || eerror "failed to remove ${d}/${g}"
42 + fi
43 done
44 # if there's nothing left remove the directory
45 - find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \;
46 + find "${d}" -maxdepth 0 -type d -empty -delete || eerror "failed to purge ${d}"
47 fi
48 done
49 eend 0
50 @@ -159,7 +161,9 @@ font_pkg_setup() {
51
52 # make sure we get no collisions
53 # setup is not the nicest place, but preinst doesn't cut it
54 - [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT%/}/${FONTDIR}/fonts.cache-1"
55 + if [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] ; then
56 + rm "${EROOT%/}/${FONTDIR}/fonts.cache-1" || die "failed to remove fonts.cache-1"
57 + fi
58 }
59
60 # @FUNCTION: font_src_install
61 @@ -193,7 +197,9 @@ font_src_install() {
62
63 font_fontconfig
64
65 - [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
66 + if [[ -n ${DOCS} ]] ; then
67 + dodoc ${DOCS}
68 + fi
69
70 # install common docs
71 for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
72 --
73 2.21.0