cookutils diff modules/compressor @ rev 872
modules/compressor: recompress *.gz files
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu Jan 26 18:10:16 2017 +0200 (2017-01-26) |
parents | 088359ca2353 |
children | f816ea3e8dcc |
line diff
1.1 --- a/modules/compressor Tue Jan 24 17:26:25 2017 +0000 1.2 +++ b/modules/compressor Thu Jan 26 18:10:16 2017 +0200 1.3 @@ -73,6 +73,7 @@ 1.4 mo1) find $install -type f -name '*.mo' -exec ls -l \{\} \; ;; 1.5 loc) find $install/usr/share/i18n/locales -type f -exec ls -l \{\} \; ;; 1.6 mo2) find $fs/usr/share/locale -type f -name '*.mo' -exec ls -l \{\} \; ;; 1.7 + gz) find $install -type f -name '*.gz' ! -path '*/share/man/*' -exec ls -l \{\} \; ;; 1.8 esac | awk '{s+=$5}END{print s}' 1.9 } 1.10 1.11 @@ -145,6 +146,30 @@ 1.12 } 1.13 1.14 1.15 +# Function to recompress all gzip archives 1.16 +# Recompressing can be disabled with COOKOPTS="!gz" 1.17 + 1.18 +recompress_gz() { 1.19 + time0=$(date +%s) 1.20 + [ "${COOKOPTS/!gz/}" != "$COOKOPTS" ] && return 1.21 + size0=$(sizes gz); [ -z "$size0" ] && return 1.22 + 1.23 + tazpkg -gi advancecomp --quiet --cookmode 1.24 + 1.25 + action 'Recompressing gzip files...' 1.26 + 1.27 + # Recompress with advdef 1.28 + for i in $(find $install -type f -name '*.gz' ! -path '*/share/man/*'); do 1.29 + if ! cached_path=$(query_cache gz "$i"); then 1.30 + advdef -z4q "$i" 1.31 + store_cache "$cached_path" "$i" 1.32 + fi 1.33 + done 1.34 + 1.35 + comp_summary "$time0" "$size0" "$(sizes gz)" 1.36 +} 1.37 + 1.38 + 1.39 # Function used after compile_rules() to compress all png images 1.40 # Compressing can be disabled with COOKOPTS="!pngz" 1.41 1.42 @@ -551,6 +576,7 @@ 1.43 case "$ARCH" in 1.44 arm*) ;; 1.45 *) 1.46 + recompress_gz 1.47 compress_manpages 1.48 compress_png 1.49 compress_svg