diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-06-22 02:53:00 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-06-22 02:53:00 +0000 |
commit | 29a10d78a8ebe8590d518574887ca1db168033f0 (patch) | |
tree | 1738ab5cfc829984550a8e259c81200bbcb4d6d0 /bin | |
parent | e5145157dbdb9c2683d1ab8176641f19d2dc5d4e (diff) | |
download | portage-29a10d78a8ebe8590d518574887ca1db168033f0.tar.gz portage-29a10d78a8ebe8590d518574887ca1db168033f0.tar.bz2 portage-29a10d78a8ebe8590d518574887ca1db168033f0.zip |
cache the result of --suffix to reduce testing overhead as suggested by Mr_Bones_ (trunk r6922)
svn path=/main/branches/2.1.2/; revision=6935
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ecompress | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/bin/ecompress b/bin/ecompress index 5e4f64573..6eb1d5df7 100755 --- a/bin/ecompress +++ b/bin/ecompress @@ -22,20 +22,23 @@ fi case $1 in --suffix) - set -e - tmpdir="${T}"/.ecompress$$.${RANDOM} - mkdir "${tmpdir}" - cd "${tmpdir}" - # we have to fill the file enough so that there is something - # to compress as some programs will refuse to do compression - # if it cannot actually compress the file - echo {0..1000} > compressme - ${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS} compressme > /dev/null - suffix=$(ls compressme*) - suffix=${suffix#compressme} - cd / - rm -rf "${tmpdir}" - echo "${suffix}" + if [[ ! -e ${T}/.ecompress.suffix ]] ; then + set -e + tmpdir="${T}"/.ecompress$$.${RANDOM} + mkdir "${tmpdir}" + cd "${tmpdir}" + # we have to fill the file enough so that there is something + # to compress as some programs will refuse to do compression + # if it cannot actually compress the file + echo {0..1000} > compressme + ${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS} compressme > /dev/null + suffix=$(ls compressme*) + suffix=${suffix#compressme} + cd / + rm -rf "${tmpdir}" + echo "${suffix}" > "${T}/.ecompress.suffix" + fi + cat "${T}/.ecompress.suffix" ;; --bin) echo "${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS}" |