# HG changeset patch # User Aleksej Bobylev # Date 1467672508 -10800 # Node ID fc0c201c445ecfd7bfd932ae2c5c969342c816d6 # Parent 1becb339a0a14df4a193fa44a318770d3403c581 cook: add cook_pick_manpages(), remove cook_compress_manpages() - it is now done automatically diff -r 1becb339a0a1 -r fc0c201c445e cook --- a/cook Sun Jul 03 16:18:46 2016 +0300 +++ b/cook Tue Jul 05 01:48:28 2016 +0300 @@ -568,6 +568,36 @@ fi } +# Function to compress all man pages + +compress_manpages() { + local manpath="$install/usr/share/man" dest link + [ -d "$manpath" ] || return + action 'Compressing man pages...' + + # We'll use only Gzip compression, so decompress other formats first + find $manpath -type f -name '*.bz2' -exec bunzip2 \{\} \; + find $manpath -type f -name '*.xz' -exec unxz \{\} \; + + # Fast compress with gzip + find $manpath -type f -name '*.[1-9]' -exec gzip \{\} \; + + # Fix symlinks + for i in $(find $install/usr/share/man -type l); do + dest=$(readlink $i | sed 's|\.[gbx]z2*$||') + link=$(echo $i | sed 's|\.[gbx]z2*$||') + rm $i; ln -s $dest.gz $link.gz + done + + # Recompress with advdef (it can't compress, only recompress) + tazpkg -gi advancecomp --quiet + for i in $(find $install/usr/share/man -type f); do + advdef -z4q $i + done + + status +} + # The main cook function. @@ -781,6 +811,9 @@ # QA: no compile_rules so no error, valid. mkdir -p $install fi + + # Actions to do after compiling the package + compress_manpages footer # Execute testsuite. @@ -1178,26 +1211,18 @@ } -# Function to use in compile_rules() to compress all man pages +# Function to use in compile_rules() to copy man page from $src to $install -cook_compress_manpages() { - action 'Compressing man pages...' +cook_pick_manpages() { + local name section + action 'Copying man pages...' - # Fast compress with gzip - find $install/usr/share/man -type f -exec gzip \{\} \; - - # Fix symlinks - for i in $(find $install/usr/share/man -type l); do - dest=$(readlink $i) - rm $i; ln -s $dest.gz $i.gz + for i in $@; do + name=$(echo $i | sed 's|\.[gbx]z2*$||') + section=${name##*/}; section=${section##*.} + mkdir -p $install/usr/share/man/man$section + cp -a $i $install/usr/share/man/man$section done - - # Recompress with advdef (it can't compress, only recompress) - tazpkg -gi advancecomp --quiet - for i in $(find $install/usr/share/man -type f); do - advdef -z4q $i - done - status }