Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 2/3] ecompress: Fix duplicate pre-compressed file warning
Date: Tue, 25 Sep 2018 19:19:00
Message-Id: 20180925191845.30287-2-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 1/3] ecompress: Fix crash on duplicate compressed & uncompressed files by "Michał Górny"
1 Fix the pre-compressed file warning to be reported only once, now that
2 files are processed in parallel.
3
4 Signed-off-by: Michał Górny <mgorny@g.o>
5 ---
6 bin/ecompress | 6 ++++++
7 bin/ecompress-file | 13 +++----------
8 2 files changed, 9 insertions(+), 10 deletions(-)
9
10 diff --git a/bin/ecompress b/bin/ecompress
11 index d5ff3796c..e4fdc3934 100755
12 --- a/bin/ecompress
13 +++ b/bin/ecompress
14 @@ -150,6 +150,12 @@ find "${ED}" -name '*.ecompress' -delete -print0 |
15 ___parallel_xargs -0 "${PORTAGE_BIN_PATH}"/ecompress-file
16 ret=${?}
17
18 +if [[ -f ${T}/.ecompress_had_precompressed ]]; then
19 + eqawarn "One or more compressed files were found in docompress-ed directories."
20 + eqawarn "Please fix the ebuild not to install compressed files (manpages,"
21 + eqawarn "documentation) when automatic compression is used."
22 +fi
23 +
24 fix_symlinks
25 : $(( ret |= ${?} ))
26 [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
27 diff --git a/bin/ecompress-file b/bin/ecompress-file
28 index 18269c91b..27695da1b 100755
29 --- a/bin/ecompress-file
30 +++ b/bin/ecompress-file
31 @@ -14,7 +14,6 @@ compress_file() {
32 set +f
33 mask_ext_re="^(${mask_ext_re:1})\$"
34 local filtered_args=()
35 - local had_precompressed=
36 for x in "$@" ; do
37 [[ ${x##*.} =~ $mask_ext_re ]] && continue
38 [[ -s ${x} ]] || continue
39 @@ -24,15 +23,15 @@ compress_file() {
40 *.gz|*.Z)
41 gunzip -f "${x}" || __helpers_die "gunzip failed"
42 x=${x%.*}
43 - had_precompressed=1;;
44 + touch "${T}/.ecompress_had_precompressed";;
45 *.bz2)
46 bunzip2 -f "${x}" || __helpers_die "bunzip2 failed"
47 x=${x%.bz2}
48 - had_precompressed=1;;
49 + touch "${T}/.ecompress_had_precompressed";;
50 *.lzma|*.xz)
51 unxz -f "${x}" || __helpers_die "unxz failed"
52 x=${x%.*}
53 - had_precompressed=1;;
54 + touch "${T}/.ecompress_had_precompressed";;
55 esac
56
57 filtered_args+=( "$x" )
58 @@ -40,12 +39,6 @@ compress_file() {
59 [[ ${#filtered_args[@]} -eq 0 ]] && return 0
60 set -- "${filtered_args[@]}"
61
62 - if [[ ${had_precompressed} ]]; then
63 - eqawarn "One or more compressed files were found in docompress-ed directories."
64 - eqawarn "Please fix the ebuild not to install compressed files (manpages,"
65 - eqawarn "documentation) when automatic compression is used."
66 - fi
67 -
68 # If a compressed version of the file already exists, simply
69 # delete it so that the compressor doesn't whine (bzip2 will
70 # complain and skip, gzip will prompt for input)
71 --
72 2.19.0