cookutils rev 809
cook: add cook_pick_manpages(), remove cook_compress_manpages() - it is now done automatically
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Jul 05 01:48:28 2016 +0300 (2016-07-05) |
parents | 1becb339a0a1 |
children | f6f8a4d07d48 |
files | cook |
line diff
1.1 --- a/cook Sun Jul 03 16:18:46 2016 +0300 1.2 +++ b/cook Tue Jul 05 01:48:28 2016 +0300 1.3 @@ -568,6 +568,36 @@ 1.4 fi 1.5 } 1.6 1.7 +# Function to compress all man pages 1.8 + 1.9 +compress_manpages() { 1.10 + local manpath="$install/usr/share/man" dest link 1.11 + [ -d "$manpath" ] || return 1.12 + action 'Compressing man pages...' 1.13 + 1.14 + # We'll use only Gzip compression, so decompress other formats first 1.15 + find $manpath -type f -name '*.bz2' -exec bunzip2 \{\} \; 1.16 + find $manpath -type f -name '*.xz' -exec unxz \{\} \; 1.17 + 1.18 + # Fast compress with gzip 1.19 + find $manpath -type f -name '*.[1-9]' -exec gzip \{\} \; 1.20 + 1.21 + # Fix symlinks 1.22 + for i in $(find $install/usr/share/man -type l); do 1.23 + dest=$(readlink $i | sed 's|\.[gbx]z2*$||') 1.24 + link=$(echo $i | sed 's|\.[gbx]z2*$||') 1.25 + rm $i; ln -s $dest.gz $link.gz 1.26 + done 1.27 + 1.28 + # Recompress with advdef (it can't compress, only recompress) 1.29 + tazpkg -gi advancecomp --quiet 1.30 + for i in $(find $install/usr/share/man -type f); do 1.31 + advdef -z4q $i 1.32 + done 1.33 + 1.34 + status 1.35 +} 1.36 + 1.37 1.38 # The main cook function. 1.39 1.40 @@ -781,6 +811,9 @@ 1.41 # QA: no compile_rules so no error, valid. 1.42 mkdir -p $install 1.43 fi 1.44 + 1.45 + # Actions to do after compiling the package 1.46 + compress_manpages 1.47 footer 1.48 1.49 # Execute testsuite. 1.50 @@ -1178,26 +1211,18 @@ 1.51 } 1.52 1.53 1.54 -# Function to use in compile_rules() to compress all man pages 1.55 +# Function to use in compile_rules() to copy man page from $src to $install 1.56 1.57 -cook_compress_manpages() { 1.58 - action 'Compressing man pages...' 1.59 +cook_pick_manpages() { 1.60 + local name section 1.61 + action 'Copying man pages...' 1.62 1.63 - # Fast compress with gzip 1.64 - find $install/usr/share/man -type f -exec gzip \{\} \; 1.65 - 1.66 - # Fix symlinks 1.67 - for i in $(find $install/usr/share/man -type l); do 1.68 - dest=$(readlink $i) 1.69 - rm $i; ln -s $dest.gz $i.gz 1.70 + for i in $@; do 1.71 + name=$(echo $i | sed 's|\.[gbx]z2*$||') 1.72 + section=${name##*/}; section=${section##*.} 1.73 + mkdir -p $install/usr/share/man/man$section 1.74 + cp -a $i $install/usr/share/man/man$section 1.75 done 1.76 - 1.77 - # Recompress with advdef (it can't compress, only recompress) 1.78 - tazpkg -gi advancecomp --quiet 1.79 - for i in $(find $install/usr/share/man -type f); do 1.80 - advdef -z4q $i 1.81 - done 1.82 - 1.83 status 1.84 } 1.85