Fix the pre-compressed file warning to be reported only once, now that
files are processed in parallel.

Signed-off-by: Michał Górny <[email protected]>
---
 bin/ecompress      |  7 +++++++
 bin/ecompress-file | 16 +++-------------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index d5ff3796c..f927a336f 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -53,6 +53,7 @@ while [[ $# -gt 0 ]] ; do
                                # skip the compressed variants (bug #667072)
                                case ${path} in
                                        *.Z|*.gz|*.bz2|*.lzma|*.xz)
+                                               >> 
"${T}"/.ecompress_had_precompressed
                                                [[ -s ${path%.*} ]] && continue
                                                ;;
                                esac
@@ -150,6 +151,12 @@ find "${ED}" -name '*.ecompress' -delete -print0 |
        ___parallel_xargs -0 "${PORTAGE_BIN_PATH}"/ecompress-file
 ret=${?}
 
+if [[ -f ${T}/.ecompress_had_precompressed ]]; then
+       eqawarn "One or more compressed files were found in docompress-ed 
directories."
+       eqawarn "Please fix the ebuild not to install compressed files 
(manpages,"
+       eqawarn "documentation) when automatic compression is used."
+fi
+
 fix_symlinks
 : $(( ret |= ${?} ))
 [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
diff --git a/bin/ecompress-file b/bin/ecompress-file
index 18269c91b..bc8fe5451 100755
--- a/bin/ecompress-file
+++ b/bin/ecompress-file
@@ -14,7 +14,6 @@ compress_file() {
        set +f
        mask_ext_re="^(${mask_ext_re:1})\$"
        local filtered_args=()
-       local had_precompressed=
        for x in "$@" ; do
                [[ ${x##*.} =~ $mask_ext_re ]] && continue
                [[ -s ${x} ]] || continue
@@ -23,16 +22,13 @@ compress_file() {
                case ${x} in
                        *.gz|*.Z)
                                gunzip -f "${x}" || __helpers_die "gunzip 
failed"
-                               x=${x%.*}
-                               had_precompressed=1;;
+                               x=${x%.*};;
                        *.bz2)
                                bunzip2 -f "${x}" || __helpers_die "bunzip2 
failed"
-                               x=${x%.bz2}
-                               had_precompressed=1;;
+                               x=${x%.bz2};;
                        *.lzma|*.xz)
                                unxz -f "${x}" || __helpers_die "unxz failed"
-                               x=${x%.*}
-                               had_precompressed=1;;
+                               x=${x%.*};;
                esac
 
                filtered_args+=( "$x" )
@@ -40,12 +36,6 @@ compress_file() {
        [[ ${#filtered_args[@]} -eq 0 ]] && return 0
        set -- "${filtered_args[@]}"
 
-       if [[ ${had_precompressed} ]]; then
-               eqawarn "One or more compressed files were found in 
docompress-ed directories."
-               eqawarn "Please fix the ebuild not to install compressed files 
(manpages,"
-               eqawarn "documentation) when automatic compression is used."
-       fi
-
        # If a compressed version of the file already exists, simply
        # delete it so that the compressor doesn't whine (bzip2 will
        # complain and skip, gzip will prompt for input)
-- 
2.19.0


Reply via email to