cookutils diff modules/compressor @ rev 954
cook: remove package in taz/ is package not needed; modules/compressor: recompress *.zip files (for LibreOffice).
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Aug 02 18:44:51 2017 +0300 (2017-08-02) |
parents | 49ff02f8d304 |
children | ba9972ca7cae |
line diff
1.1 --- a/modules/compressor Mon Jun 19 15:59:48 2017 +0300 1.2 +++ b/modules/compressor Wed Aug 02 18:44:51 2017 +0300 1.3 @@ -82,6 +82,7 @@ 1.4 loc) find $install/usr/share/i18n/locales -type f -exec ls -l \{\} \; ;; 1.5 mo2) find $fs/usr/share/locale -type f -name '*.mo' -exec ls -l \{\} \; ;; 1.6 gz) find $install -type f -name '*.gz' ! -path '*/share/man/*' -exec ls -l \{\} \; ;; 1.7 + zip) find $install -type f -name '*.zip' -exec ls -l \{\} \; ;; 1.8 str) find $fs -type f \( -name '*.so*' -o -name '*.a' -o -name '*.pyc' -o -name '*.pyo' \ 1.9 -o -name '.packlist' -o -name '*.pm' -o -name '*.pl' -o -name '*.pod' \) -exec ls -l \{\} \; ;; 1.10 esac | awk '{s+=$5}END{print s}' 1.11 @@ -182,6 +183,31 @@ 1.12 } 1.13 1.14 1.15 +# Function to recompress all zip archives 1.16 +# Recompressing can be disabled with COOKOPTS="!zip" 1.17 + 1.18 +recompress_zip() { 1.19 + time0=$(get_time) 1.20 + [ "${COOKOPTS/!zip/}" != "$COOKOPTS" ] && return 1.21 + size0=$(sizes zip); [ -z "$size0" ] && return 1.22 + 1.23 + tpi advancecomp-static 1.24 + 1.25 + action 'Recompressing zip files...' 1.26 + 1.27 + # Recompress with advzip 1.28 + IFS=$'\n' 1.29 + for i in $(find $install -type f -name '*.zip'); do 1.30 + if ! cached_path=$(query_cache zip "$i"); then 1.31 + advzip -z3qk "$i" # -4 is more than 2 orders slower 1.32 + store_cache "$cached_path" "$i" 1.33 + fi 1.34 + done 1.35 + 1.36 + comp_summary "$time0" "$size0" "$(sizes zip)" 1.37 +} 1.38 + 1.39 + 1.40 # Function used after compile_rules() to compress all png images 1.41 # Compressing can be disabled with COOKOPTS="!pngz" 1.42 1.43 @@ -605,6 +631,7 @@ 1.44 arm*) ;; 1.45 *) 1.46 recompress_gz 1.47 + recompress_zip 1.48 compress_manpages 1.49 compress_png 1.50 compress_svg