/[gentoo-x86]/eclass/font.eclass
Gentoo

Diff of /eclass/font.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.48 Revision 1.49
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.48 2010/02/09 17:15:08 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.49 2010/04/20 04:06:59 dirtyepic Exp $
4 4
5# @ECLASS: font.eclass 5# @ECLASS: font.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# fonts@gentoo.org 7# fonts@gentoo.org
8 8
83 [[ -e ${conffile} ]] && doins ${conffile} 83 [[ -e ${conffile} ]] && doins ${conffile}
84 done 84 done
85 fi 85 fi
86} 86}
87 87
88# @FUNCTION: font_cleanup_dirs
89# @DESCRIPTION:
90# Remove any font directories only containing generated files.
91# Runs in pkg_postrm.
92font_cleanup_dirs() {
93 local genfiles="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
94 local d f g generated candidate otherfile
95
96 ebegin "Purging empty font directories"
97 find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
98 candidate=false
99 otherfile=false
100 for f in "${d}"/*; do
101 generated=false
102 [[ -e ${f} || -L ${f} ]] || continue
103 for g in ${genfiles}; do
104 if [[ ${f##*/} == ${g} ]]; then
105 generated=true
106 break
107 fi
108 done
109 ${generated} && candidate=true || otherfile=true
110 [[ ${candidate} == ${otherfile} ]] && break # both are true, keep the dir
111 done
112 if [[ ${candidate} == true && ${otherfile} == false ]]; then
113 ebegin "Removing ${d}"
114 rm -rf "${d}"
115 eend $?
116 fi
117 done
118 eend 0
119}
120
88# @FUNCTION: font_src_install 121# @FUNCTION: font_src_install
89# @DESCRIPTION: 122# @DESCRIPTION:
90# The font src_install function. 123# The font src_install function.
91font_src_install() { 124font_src_install() {
92 local suffix commondoc 125 local suffix commondoc
170# @FUNCTION: font_pkg_postrm 203# @FUNCTION: font_pkg_postrm
171# @DESCRIPTION: 204# @DESCRIPTION:
172# The font pkg_postrm function. 205# The font pkg_postrm function.
173# Updates global font cache 206# Updates global font cache
174font_pkg_postrm() { 207font_pkg_postrm() {
208 font_cleanup_dirs
209
175 # unreadable font files = fontconfig segfaults 210 # unreadable font files = fontconfig segfaults
176 find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ 211 find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
177 | xargs -0 chmod -v 0644 2>/dev/null 212 | xargs -0 chmod -v 0644 2>/dev/null
178 213
179 if [[ ${ROOT} == / ]]; then 214 if [[ ${ROOT} == / ]]; then

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

  ViewVC Help
Powered by ViewVC 1.1.20