commit: 678696c203795311ce8756b04a2c1cbfefab49d9
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 7 06:27:31 2019 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Oct 16 08:44:26 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=678696c2
font.eclass: Add error handling where applicable
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/font.eclass | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/eclass/font.eclass b/eclass/font.eclass
index 18dcb3f14b4..f77f62291df 100644
--- a/eclass/font.eclass
+++ b/eclass/font.eclass
@@ -68,16 +68,16 @@ font_xfont_config() {
local dir_name
if in_iuse X && use X ; then
dir_name="${1:-${FONT_PN}}"
- ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
- rm -f
"${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
- mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}"
+ rm -f
"${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} \
+ || die "failed to prepare ${FONTDIR}/${1//${S}/}"
+ einfo "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
+ mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed
to create fonts.scale"
mkfontdir \
-e ${EPREFIX}/usr/share/fonts/encodings \
-e ${EPREFIX}/usr/share/fonts/encodings/large \
- "${ED%/}/${FONTDIR}/${1//${S}/}"
- eend $?
- if [[ -e fonts.alias ]] ; then
- doins fonts.alias
+ "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to
create fonts.dir"
+ if [[ -e fonts.alias ]]; then
+ doins fonts.alias || die "failed to install
fonts.alias" # TODO old EAPI cleanup
fi
fi
}
@@ -90,7 +90,9 @@ font_fontconfig() {
if [[ -n ${FONT_CONF[@]} ]]; then
insinto /etc/fonts/conf.avail/
for conffile in "${FONT_CONF[@]}"; do
- [[ -e ${conffile} ]] && doins ${conffile}
+ if [[ -e ${conffile} ]]; then
+ doins ${conffile} || die "failed to install
conf file" # TODO old EAPI cleanup
+ fi
done
fi
}
@@ -132,11 +134,12 @@ font_cleanup_dirs() {
# media-fonts/font-alias. any other fonts.alias files
will have
# already been unmerged with their packages.
for g in ${genfiles}; do
- [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L
${d}/${g} ) ]] \
- && rm "${d}"/${g}
+ if [[ ${g} != fonts.alias && ( -e ${d}/${g} ||
-L ${d}/${g} ) ]] ; then
+ rm "${d}"/${g} || eerror "failed to
remove ${d}/${g}"
+ fi
done
# if there's nothing left remove the directory
- find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}'
\;
+ find "${d}" -maxdepth 0 -type d -empty -delete ||
eerror "failed to purge ${d}"
fi
done
eend 0
@@ -161,7 +164,9 @@ font_pkg_setup() {
# make sure we get no collisions
# setup is not the nicest place, but preinst doesn't cut it
- [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] && rm -f
"${EROOT%/}/${FONTDIR}/fonts.cache-1"
+ if [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] ; then
+ rm "${EROOT%/}/${FONTDIR}/fonts.cache-1" || die "failed to
remove fonts.cache-1"
+ fi
}
# @FUNCTION: font_src_install
@@ -178,7 +183,7 @@ font_src_install() {
pushd "${dir}" > /dev/null
insinto "${FONTDIR}/${dir//${S}/}"
for suffix in ${FONT_SUFFIX}; do
- doins *.${suffix}
+ doins *.${suffix} || die "font installation
failed" # TODO old EAPI cleanup
done
font_xfont_config "${dir}"
popd > /dev/null
@@ -187,7 +192,7 @@ font_src_install() {
pushd "${FONT_S}" > /dev/null
insinto "${FONTDIR}"
for suffix in ${FONT_SUFFIX}; do
- doins *.${suffix}
+ doins *.${suffix} || die "font installation failed" #
TODO old EAPI cleanup
done
font_xfont_config
popd > /dev/null
@@ -195,7 +200,7 @@ font_src_install() {
font_fontconfig
- [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ;
}
+ [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ;
} # TODO old EAPI cleanup
# install common docs
for commondoc in COPYRIGHT README{,.md,.txt} NEWS AUTHORS BUGS
ChangeLog FONTLOG.txt; do