Gentoo Archives: gentoo-dev

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] font.eclass: Drop EAPI-5 and EAPI-6 support
Date: Fri, 26 Mar 2021 20:51:19
Message-Id: 2537287.vuYhMxLoTh@192.168.1.8
1 diff --git a/eclass/font.eclass b/eclass/font.eclass
2 index e9e448a8155..ec1b6ca9358 100644
3 --- a/eclass/font.eclass
4 +++ b/eclass/font.eclass
5 @@ -1,19 +1,19 @@
6 -# Copyright 1999-2020 Gentoo Authors
7 +# Copyright 1999-2021 Gentoo Authors
8 # Distributed under the terms of the GNU General Public License v2
9
10 # @ECLASS: font.eclass
11 # @MAINTAINER:
12 # fonts@g.o
13 -# @SUPPORTED_EAPIS: 5 6 7
14 +# @SUPPORTED_EAPIS: 7
15 # @BLURB: Eclass to make font installation uniform
16
17 case ${EAPI:-0} in
18 - [56]) inherit eutils ;;
19 7) ;;
20 *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
21 esac
22
23 if [[ ! ${_FONT_ECLASS} ]]; then
24 +_FONT_ECLASS=1
25
26 EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
27
28 @@ -46,21 +46,12 @@ FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
29 # Array containing fontconfig conf files to install.
30 FONT_CONF=( "" )
31
32 -# @ECLASS-VARIABLE: DOCS
33 -# @DEFAULT_UNSET
34 -# @DESCRIPTION:
35 -# Space delimited list of docs to install.
36 -# We always install these:
37 -# COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt
38 -DOCS=${DOCS:-}
39 -
40 if [[ ${CATEGORY}/${PN} != media-fonts/encodings ]]; then
41 IUSE="X"
42 - DEPEND="X? (
43 + BDEPEND="X? (
44 >=x11-apps/mkfontscale-1.2.0
45 media-fonts/encodings
46 )"
47 - RDEPEND=""
48 fi
49
50 # @FUNCTION: font_xfont_config
51 @@ -70,14 +61,14 @@ font_xfont_config() {
52 local dir_name
53 if in_iuse X && use X ; then
54 dir_name="${1:-${FONT_PN}}"
55 - rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} \
56 + rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} \
57 || die "failed to prepare ${FONTDIR}/${1//${S}/}"
58 einfo "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
59 - mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.scale"
60 + mkfontscale "${ED}${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.scale"
61 mkfontdir \
62 - -e ${EPREFIX}/usr/share/fonts/encodings \
63 - -e ${EPREFIX}/usr/share/fonts/encodings/large \
64 - "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.dir"
65 + -e "${EPREFIX}"/usr/share/fonts/encodings \
66 + -e "${EPREFIX}"/usr/share/fonts/encodings/large \
67 + "${ED}${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.dir"
68 [[ -e fonts.alias ]] && doins fonts.alias
69 fi
70 }
71 @@ -137,7 +128,7 @@ font_cleanup_dirs() {
72 # if there's nothing left remove the directory
73 find "${d}" -maxdepth 0 -type d -empty -delete || eerror "failed to purge ${d}"
74 fi
75 - done < <(find -L "${EROOT%/}"/usr/share/fonts/ -type d -print0)
76 + done < <(find -L "${EROOT}"/usr/share/fonts/ -type d -print0)
77 eend 0
78 }
79
80 @@ -148,8 +139,8 @@ font_cleanup_dirs() {
81 font_pkg_setup() {
82 # make sure we get no collisions
83 # setup is not the nicest place, but preinst doesn't cut it
84 - if [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] ; then
85 - rm "${EROOT%/}/${FONTDIR}/fonts.cache-1" || die "failed to remove fonts.cache-1"
86 + if [[ -e "${EROOT}${FONTDIR}/fonts.cache-1" ]] ; then
87 + rm "${EROOT}${FONTDIR}/fonts.cache-1" || die "failed to remove fonts.cache-1"
88 fi
89 }
90
91 @@ -170,19 +161,6 @@ font_src_install() {
92 font_xfont_config "${dir}"
93 popd > /dev/null || die
94 done
95 - elif [[ ${FONT_S/[[:space:]]} != "${FONT_S}" ]]; then
96 - # backwards compatibility code, can be removed after 2021-02-14
97 - eqawarn "Using a space-separated list for FONT_S is deprecated."
98 - eqawarn "Use a bash array instead if there are multiple directories."
99 - for dir in ${FONT_S}; do
100 - pushd "${dir}" > /dev/null || die "pushd ${dir} failed"
101 - insinto "${FONTDIR}/${dir//${S}/}"
102 - for suffix in ${FONT_SUFFIX}; do
103 - doins *.${suffix}
104 - done
105 - font_xfont_config "${dir}"
106 - popd > /dev/null || die
107 - done
108 else
109 pushd "${FONT_S:-${S}}" > /dev/null \
110 || die "pushd ${FONT_S:-${S}} failed"
111 @@ -209,10 +187,10 @@ font_src_install() {
112 # Updates fontcache if !prefix and media-libs/fontconfig installed
113 _update_fontcache() {
114 # unreadable font files = fontconfig segfaults
115 - find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 \
116 + find "${EROOT}"/usr/share/fonts/ -type f '!' -perm 0644 \
117 -exec chmod -v 0644 2>/dev/null {} + || die "failed to fix font files perms"
118
119 - if [[ -z ${ROOT%/} ]] ; then
120 + if [[ -z ${ROOT} ]] ; then
121 if has_version media-libs/fontconfig ; then
122 ebegin "Updating global fontcache"
123 fc-cache -fs
124 @@ -236,7 +214,7 @@ font_pkg_postinst() {
125 elog "The following fontconfig configuration files have been installed:"
126 elog
127 for conffile in "${FONT_CONF[@]}"; do
128 - [[ -e "${EROOT%/}"/etc/fonts/conf.avail/${conffile##*/} ]] &&
129 + [[ -e "${EROOT}"/etc/fonts/conf.avail/${conffile##*/} ]] &&
130 elog " ${conffile##*/}"
131 done
132 elog
133 @@ -254,5 +232,4 @@ font_pkg_postrm() {
134 _update_fontcache
135 }
136
137 -_FONT_ECLASS=1
138 fi

Attachments

File name MIME type
signature.asc application/pgp-signature