From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2E7D1138334 for ; Sun, 24 Mar 2019 20:52:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C6383E0A9B; Sun, 24 Mar 2019 20:52:28 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 70730E0A98 for ; Sun, 24 Mar 2019 20:52:28 +0000 (UTC) Received: from tuxk10.localnet (91-119-19-8.dsl.dynamic.surfer.at [91.119.19.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: asturm@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 8D16B335D68 for ; Sun, 24 Mar 2019 20:52:26 +0000 (UTC) From: Andreas Sturmlechner 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 Message-ID: <1760897.CuJCMtYBCR@tuxk10> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Archives-Salt: f3509ac1-25c3-40d5-9db4-aafcedb10e74 X-Archives-Hash: 22b9938dc192cfc30450746fd6b0fb50 --- 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