Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "Ryan Hill (dirtyepic)" <dirtyepic@g.o>
Subject: gentoo-x86 commit in eclass: font.eclass
Date: Fri, 9 Jul 2010 03:44:19 +0000 (UTC)
dirtyepic    10/07/09 03:44:19

  Modified:             font.eclass
  Log:
  When cleaning up generated files leave any fonts.alias from media-fonts/font-alias alone.  Add documentation. (bug #315369)

Revision  Changes    Path
1.51                 eclass/font.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/font.eclass?rev=1.51&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/font.eclass?rev=1.51&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/font.eclass?r1=1.50&r2=1.51

Index: font.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/font.eclass,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- font.eclass	15 May 2010 05:25:32 -0000	1.50
+++ font.eclass	9 Jul 2010 03:44:19 -0000	1.51
@@ -1,6 +1,6 @@
 # Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.50 2010/05/15 05:25:32 dirtyepic Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.51 2010/07/09 03:44:19 dirtyepic Exp $
 
 # @ECLASS: font.eclass
 # @MAINTAINER:
@@ -86,28 +86,43 @@
 # Remove font directories containing only generated files.
 font_cleanup_dirs() {
 	local genfiles="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
+	# fonts.alias isn't generated but it's a special case (see below).
 	local d f g generated candidate otherfile
 
-	ebegin "Purging empty font directories"
+	ebegin "Cleaning up font directories"
 	find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
 		candidate=false
 		otherfile=false
 		for f in "${d}"/*; do
 			generated=false
+			# make sure this is a file and not a subdir
 			[[ -e ${f} || -L ${f} ]] || continue
 			for g in ${genfiles}; do
 				if [[ ${f##*/} == ${g} ]]; then
+					# this is a generated file
 					generated=true
 					break
 				fi
 			done
+			# if the file is a generated file then we know this is a font dir (as
+			# opposed to something like encodings or util) and  a candidate for
+			# removal.  if it's not generated then it's an "otherfile".
 			${generated} && candidate=true || otherfile=true
-			[[ ${candidate} == ${otherfile} ]] && break # both are true, keep the dir
+			# if the directory is both a candidate for removal and contains at
+			# least one "otherfile" then don't remove it.
+			[[ ${candidate} == ${otherfile} ]] && break
 		done
+		# if we only have generated files, purge the directory.
 		if [[ ${candidate} == true && ${otherfile} == false ]]; then
-			ebegin "Removing ${d}"
-			rm -rf "${d}"
-			eend $?
+			# we don't want to remove fonts.alias files that were installed by
+			# 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}
+			done
+			# if there's nothing left remove the directory
+			find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \;
 		fi
 	done
 	eend 0





Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
gentoo-x86 commit in eclass: font.eclass
Next by thread:
gentoo-x86 commit in dev-lang/tk: ChangeLog tk-8.4.15-r1.ebuild tk-8.5_alpha6-r1.ebuild tk-8.4.14.ebuild tk-8.4.14-r1.ebuild
Previous by date:
gentoo commit in xml/htdocs/main/en: mirrors3.xml
Next by date:
gentoo-x86 commit in net-print/gutenprint/files: gutenprint-5.2.5-Makefile.patch


Updated Jun 26, 2012

Summary: Archive of the gentoo-commits mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.