Move the manpage compression code from tidy_install to create_package. Since
tidy_install could remove a backup file, it should go before check_package.
Alternatively, we could move all the code from tidy_install into create_package
since those two are always called together.  

Fixes FS#33318.

Signed-off-by: Chirantan Ekbote <[email protected]>
--- 
 scripts/makepkg.sh.in | 58 ++++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index ebc24f7..be433ad 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1497,34 +1497,6 @@ tidy_install() {
                done
        fi
 
-       if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then
-               msg2 "$(gettext "Compressing man and info pages...")"
-               local file files inode link
-               while read -rd ' ' inode; do
-                       read file
-                       find ${MAN_DIRS[@]} -type l 2>/dev/null |
-                       while read link ; do
-                               if [[ "${file}" -ef "${link}" ]] ; then
-                                       rm -f "$link" "${link}.gz"
-                                       if [[ ${file%/*} = ${link%/*} ]]; then
-                                               ln -s -- "${file##*/}.gz" 
"${link}.gz"
-                                       else
-                                               ln -s -- "/${file}.gz" 
"${link}.gz"
-                                       fi
-                               fi
-                       done
-                       if [[ -z ${files[$inode]} ]]; then
-                               files[$inode]=$file
-                               gzip -9 -n -f "$file"
-                       else
-                               rm -f "$file"
-                               ln "${files[$inode]}.gz" "${file}.gz"
-                               chmod 644 "${file}.gz"
-                       fi
-               done < <(find ${MAN_DIRS[@]} -type f \! -name "*.gz" \! -name 
"*.bz2" \
-                       -exec @INODECMD@ '{}' + 2>/dev/null)
-       fi
-
        if check_option "strip" "y"; then
                msg2 "$(gettext "Stripping unneeded symbols from binaries and 
libraries...")"
                # make sure library stripping variables are defined to prevent 
excess stripping
@@ -1786,6 +1758,36 @@ create_package() {
        check_package
 
        cd_safe "$pkgdir"
+       
+       # compress manpages
+       if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then
+               msg2 "$(gettext "Compressing man and info pages...")"
+               local file files inode link
+               while read -rd ' ' inode; do
+                       read file
+                       find ${MAN_DIRS[@]} -type l 2>/dev/null |
+                       while read link ; do
+                               if [[ "${file}" -ef "${link}" ]] ; then
+                                       rm -f "$link" "${link}.gz"
+                                       if [[ ${file%/*} = ${link%/*} ]]; then
+                                               ln -s -- "${file##*/}.gz" 
"${link}.gz"
+                                       else
+                                               ln -s -- "/${file}.gz" 
"${link}.gz"
+                                       fi
+                               fi
+                       done
+                       if [[ -z ${files[$inode]} ]]; then
+                               files[$inode]=$file
+                               gzip -9 -n -f "$file"
+                       else
+                               rm -f "$file"
+                               ln "${files[$inode]}.gz" "${file}.gz"
+                               chmod 644 "${file}.gz"
+                       fi
+               done < <(find ${MAN_DIRS[@]} -type f \! -name "*.gz" \! -name 
"*.bz2" \
+                       -exec @INODECMD@ '{}' + 2>/dev/null)
+       fi
+
        msg "$(gettext "Creating package \"%s\"...")" "$pkgname"
 
        pkgarch=$(get_pkg_arch)
-- 
1.8.1


Reply via email to