From: Andreas Sturmlechner <asturm@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH 2/3] font.eclass: Add error handling where applicable
Date: Sun, 24 Mar 2019 21:52:22 +0100 [thread overview]
Message-ID: <1760897.CuJCMtYBCR@tuxk10> (raw)
---
eclass/font.eclass | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/eclass/font.eclass b/eclass/font.eclass
index 06736e5..fef6b79 100644
--- a/eclass/font.eclass
+++ b/eclass/font.eclass
@@ -66,17 +66,18 @@ font_xfont_config() {
local dir_name
if has X ${IUSE//+} && use X ; then
dir_name="${1:-${FONT_PN}}"
+ rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} \
+ || die "failed to prepare ${FONTDIR}/${1//${S}/}"
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}/}"
+ 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 ! eend $? ; then
+ die "failed to run mkfontscale or mkfontdir"
fi
+ [[ -e fonts.alias ]] && doins fonts.alias
fi
}
@@ -130,11 +131,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
@@ -159,7 +161,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
@@ -193,7 +197,9 @@ font_src_install() {
font_fontconfig
- [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
+ if [[ -n ${DOCS} ]] ; then
+ dodoc ${DOCS}
+ fi
# install common docs
for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
--
2.21.0
reply other threads:[~2019-03-24 20:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1760897.CuJCMtYBCR@tuxk10 \
--to=asturm@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox