public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] [PATCH 2/3] font.eclass: Add error handling where applicable
@ 2019-03-24 20:52 99% Andreas Sturmlechner
  0 siblings, 0 replies; 1+ results
From: Andreas Sturmlechner @ 2019-03-24 20:52 UTC (permalink / raw
  To: gentoo-dev

---
 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





^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-03-24 20:52 99% [gentoo-dev] [PATCH 2/3] font.eclass: Add error handling where applicable Andreas Sturmlechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox