docompress: add --limit support with newer EAPIs
authorMike Frysinger <vapier@gentoo.org>
Sun, 1 Dec 2013 07:21:00 +0000 (02:21 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sun, 1 Dec 2013 07:21:00 +0000 (02:21 -0500)
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

bin/misc-functions.sh
bin/phase-helpers.sh
bin/save-ebuild-env.sh

index 771bd0adbc97a13c6c70e57d9165e04c87d09a0a..bd99def327ad9d4753064aa82ed3473b7bdb40f2 100755 (executable)
@@ -156,7 +156,7 @@ prepcompress() {
 
        # 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
index d03a4d7f8ed06d84a65c846043339f873afcdc73..ec48c94eca8045f581c6071542ed06b6375032ee 100644 (file)
@@ -11,6 +11,8 @@ export EXEOPTIONS="-m0755"
 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 )
 
index 2a3d5eaa004d67a1431f4edd84e8779c679a9214..7a31b89d46314a8cdc68e18064e3cb0ed64e45df 100644 (file)
@@ -14,7 +14,8 @@ __save_ebuild_env() {
        (
        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