public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] font.eclass: Ban EAPIs < 5
@ 2019-10-20 16:50 David Seifert
  2019-10-20 17:45 ` Ulrich Mueller
  0 siblings, 1 reply; 5+ messages in thread
From: David Seifert @ 2019-10-20 16:50 UTC (permalink / raw
  To: gentoo-dev; +Cc: David Seifert

* Add inherit guard like all modern eclasses

Closes: https://bugs.gentoo.org/679658
Signed-off-by: David Seifert <soap@gentoo.org>
---
 eclass/font.eclass | 43 +++++++++++++++----------------------------
 1 file changed, 15 insertions(+), 28 deletions(-)

diff --git a/eclass/font.eclass b/eclass/font.eclass
index 76c20549ea6..cdf3494a79c 100644
--- a/eclass/font.eclass
+++ b/eclass/font.eclass
@@ -4,15 +4,17 @@
 # @ECLASS: font.eclass
 # @MAINTAINER:
 # fonts@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: Eclass to make font installation uniform
 
 case ${EAPI:-0} in
-	0|1|2|3|4|5|6) inherit eutils ;;
+	[56]) inherit eutils ;;
 	7) ;;
 	*) die "EAPI ${EAPI} is not supported by font.eclass." ;;
 esac
 
+if [[ ! ${_FONT_ECLASS} ]]; then
+
 EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
 
 # @ECLASS-VARIABLE: FONT_SUFFIX
@@ -76,9 +78,7 @@ font_xfont_config() {
 			-e ${EPREFIX}/usr/share/fonts/encodings \
 			-e ${EPREFIX}/usr/share/fonts/encodings/large \
 			"${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
+		[[ -e fonts.alias ]] && doins fonts.alias
 	fi
 }
 
@@ -90,9 +90,7 @@ font_fontconfig() {
 	if [[ -n ${FONT_CONF[@]} ]]; then
 		insinto /etc/fonts/conf.avail/
 		for conffile in "${FONT_CONF[@]}"; do
-			if [[ -e  ${conffile} ]]; then
-				doins ${conffile} || die "failed to install conf file" # TODO old EAPI cleanup
-			fi
+			[[ -e ${conffile} ]] && doins "${conffile}"
 		done
 	fi
 }
@@ -146,20 +144,8 @@ font_cleanup_dirs() {
 # @FUNCTION: font_pkg_setup
 # @DESCRIPTION:
 # The font pkg_setup function.
-# Collision protection and Prefix compat for eapi < 3.
+# Collision protection
 font_pkg_setup() {
-	# Prefix compat
-	case ${EAPI:-0} in
-		0|1|2)
-			if ! use prefix; then
-				EPREFIX=
-				ED=${D}
-				EROOT=${ROOT}
-				[[ ${EROOT} = */ ]] || EROOT+="/"
-			fi
-			;;
-	esac
-
 	# make sure we get no collisions
 	# setup is not the nicest place, but preinst doesn't cut it
 	if [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] ; then
@@ -181,7 +167,7 @@ font_src_install() {
 			pushd "${dir}" > /dev/null
 			insinto "${FONTDIR}/${dir//${S}/}"
 			for suffix in ${FONT_SUFFIX}; do
-				doins *.${suffix} || die "font installation failed" # TODO old EAPI cleanup
+				doins *.${suffix}
 			done
 			font_xfont_config "${dir}"
 			popd > /dev/null
@@ -190,7 +176,7 @@ font_src_install() {
 		pushd "${FONT_S}" > /dev/null
 		insinto "${FONTDIR}"
 		for suffix in ${FONT_SUFFIX}; do
-			doins *.${suffix} || die "font installation failed" # TODO old EAPI cleanup
+			doins *.${suffix}
 		done
 		font_xfont_config
 		popd > /dev/null
@@ -198,10 +184,10 @@ font_src_install() {
 
 	font_fontconfig
 
-	[[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; } # TODO old EAPI cleanup
+	einstalldocs
 
 	# install common docs
-	for commondoc in COPYRIGHT README{,.md,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
+	for commondoc in COPYRIGHT FONTLOG.txt; do
 		[[ -s ${commondoc} ]] && dodoc ${commondoc}
 	done
 }
@@ -238,9 +224,7 @@ font_pkg_postinst() {
 		elog "The following fontconfig configuration files have been installed:"
 		elog
 		for conffile in "${FONT_CONF[@]}"; do
-			if [[ -e "${EROOT%/}"/etc/fonts/conf.avail/${conffile##*/} ]]; then
-				elog "  ${conffile##*/}"
-			fi
+			[[ -e "${EROOT%/}"/etc/fonts/conf.avail/${conffile##*/} ]] && elog "  ${conffile##*/}"
 		done
 		elog
 		elog "Use \`eselect fontconfig\` to enable/disable them."
@@ -256,3 +240,6 @@ font_pkg_postrm() {
 	font_cleanup_dirs
 	_update_fontcache
 }
+
+_FONT_ECLASS=1
+fi
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-20 19:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-20 16:50 [gentoo-dev] [PATCH] font.eclass: Ban EAPIs < 5 David Seifert
2019-10-20 17:45 ` Ulrich Mueller
2019-10-20 17:51   ` David Seifert
2019-10-20 18:57     ` Ulrich Mueller
2019-10-20 19:28       ` David Seifert

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