Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] omitting redirecting man pages from compression
Date: Mon, 20 Sep 2010 00:07:41
Message-Id: 201009191943.50988.vapier@gentoo.org
many man pages exist merely as a redirect to another man page:
$ xzcat /usr/share/man/man1/zcat.1.xz
.so man1/gzip.1

compressing these tiny (always?) results in a larger file.  that means we
arent saving space, and we're adding overhead at runtime.

two options which we can do transparently:
	- rewrite the .so man pages into symlinks
	- omit them from compression

the latter is pretty easy (see below).  any preferences on which route to take
though as the former shouldnt be too hard either ...

--- a/bin/ebuild-helpers/ecompressdir
+++ b/bin/ebuild-helpers/ecompressdir
@@ -13,6 +13,7 @@ case $1 in
 	--ignore)
 		shift
 		for skip in "$@" ; do
+			skip=${skip#${D}}
 			[[ -d ${D}${skip} || -f ${D}${skip} ]] \
 				&& touch "${D}${skip}.ecompress.skip"
 		done
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -27,6 +27,10 @@ for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do
 	[[ -d ${subdir} ]] && really_is_mandir=1 && break
 done
 
-[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${D}}"
+if [[ ${really_is_mandir} == 1 ]] ; then
+	ecompressdir --queue "${mandir#${D}}" || exit 1
+	# compressing small files just adds overhead
+	find "${mandir}" -type f '!' -size +100c -print0 | ${XARGS} -0 ecompressdir --ignore
+fi
 
 exit 0
-mike

Attachments

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

Replies