docompress: add --limit support with newer EAPIs
We added support for not compressing files below a certain size (since the
speed/size/etc... tradeoffs didn't make sense), but it was only for man
pages and old EAPI's.
Add the logic to the newer EAPIs and apply to all compressed paths.
URL: http://bugs.gentoo.org/169260
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 771bd0a..bd99def 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -156,7 +156,7 @@
# Queue up for compression.
# ecompress{,dir} doesn't like to be called with empty argument lists.
- [[ ${#incl_d[@]} -gt 0 ]] && ecompressdir --queue "${incl_d[@]}"
+ [[ ${#incl_d[@]} -gt 0 ]] && ecompressdir --limit ${PORTAGE_DOCOMPRESS_SIZE_LIMIT:-0} --queue "${incl_d[@]}"
[[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${ED}}"
[[ ${#exclude[@]} -gt 0 ]] && ecompressdir --ignore "${exclude[@]}"
return 0
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index d03a4d7..ec48c94 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -11,6 +11,8 @@
export LIBOPTIONS="-m0644"
export DIROPTIONS="-m0755"
export MOPREFIX=${PN}
+# Do not compress files which are smaller than this (in bytes). #169260
+export PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
declare -a PORTAGE_DOCOMPRESS=( /usr/share/{doc,info,man} )
declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html )
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 2a3d5ea..7a31b89 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -14,7 +14,8 @@
(
if has --exclude-init-phases $* ; then
unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_ \
- PORTAGE_DOCOMPRESS PORTAGE_DOCOMPRESS_SKIP
+ PORTAGE_DOCOMPRESS_SIZE_LIMIT PORTAGE_DOCOMPRESS \
+ PORTAGE_DOCOMPRESS_SKIP
if [[ -n $PYTHONPATH &&
${PYTHONPATH%%:*} -ef $PORTAGE_PYM_PATH ]] ; then
if [[ $PYTHONPATH == *:* ]] ; then