1 |
dirtyepic 10/07/09 03:44:19 |
2 |
|
3 |
Modified: font.eclass |
4 |
Log: |
5 |
When cleaning up generated files leave any fonts.alias from media-fonts/font-alias alone. Add documentation. (bug #315369) |
6 |
|
7 |
Revision Changes Path |
8 |
1.51 eclass/font.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/font.eclass?rev=1.51&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/font.eclass?rev=1.51&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/font.eclass?r1=1.50&r2=1.51 |
13 |
|
14 |
Index: font.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/font.eclass,v |
17 |
retrieving revision 1.50 |
18 |
retrieving revision 1.51 |
19 |
diff -u -r1.50 -r1.51 |
20 |
--- font.eclass 15 May 2010 05:25:32 -0000 1.50 |
21 |
+++ font.eclass 9 Jul 2010 03:44:19 -0000 1.51 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2010 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.50 2010/05/15 05:25:32 dirtyepic Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.51 2010/07/09 03:44:19 dirtyepic Exp $ |
27 |
|
28 |
# @ECLASS: font.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -86,28 +86,43 @@ |
31 |
# Remove font directories containing only generated files. |
32 |
font_cleanup_dirs() { |
33 |
local genfiles="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale" |
34 |
+ # fonts.alias isn't generated but it's a special case (see below). |
35 |
local d f g generated candidate otherfile |
36 |
|
37 |
- ebegin "Purging empty font directories" |
38 |
+ ebegin "Cleaning up font directories" |
39 |
find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do |
40 |
candidate=false |
41 |
otherfile=false |
42 |
for f in "${d}"/*; do |
43 |
generated=false |
44 |
+ # make sure this is a file and not a subdir |
45 |
[[ -e ${f} || -L ${f} ]] || continue |
46 |
for g in ${genfiles}; do |
47 |
if [[ ${f##*/} == ${g} ]]; then |
48 |
+ # this is a generated file |
49 |
generated=true |
50 |
break |
51 |
fi |
52 |
done |
53 |
+ # if the file is a generated file then we know this is a font dir (as |
54 |
+ # opposed to something like encodings or util) and a candidate for |
55 |
+ # removal. if it's not generated then it's an "otherfile". |
56 |
${generated} && candidate=true || otherfile=true |
57 |
- [[ ${candidate} == ${otherfile} ]] && break # both are true, keep the dir |
58 |
+ # if the directory is both a candidate for removal and contains at |
59 |
+ # least one "otherfile" then don't remove it. |
60 |
+ [[ ${candidate} == ${otherfile} ]] && break |
61 |
done |
62 |
+ # if we only have generated files, purge the directory. |
63 |
if [[ ${candidate} == true && ${otherfile} == false ]]; then |
64 |
- ebegin "Removing ${d}" |
65 |
- rm -rf "${d}" |
66 |
- eend $? |
67 |
+ # we don't want to remove fonts.alias files that were installed by |
68 |
+ # media-fonts/font-alias. any other fonts.alias files will have |
69 |
+ # already been unmerged with their packages. |
70 |
+ for g in ${genfiles}; do |
71 |
+ [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] \ |
72 |
+ && rm "${d}"/${g} |
73 |
+ done |
74 |
+ # if there's nothing left remove the directory |
75 |
+ find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \; |
76 |
fi |
77 |
done |
78 |
eend 0 |