Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Fri, 28 Sep 2018 20:33:13
Message-Id: 1538166760.fe4f9bd02f5085e631452d4b5617f5537c5d9b66.mgorny@gentoo
1 commit: fe4f9bd02f5085e631452d4b5617f5537c5d9b66
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 25 19:13:57 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 28 20:32:40 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=fe4f9bd0
7
8 ecompress: Fix duplicate pre-compressed file warning
9
10 Fix the pre-compressed file warning to be reported only once, now that
11 files are processed in parallel. Also, print the list of precompressed
12 files verbosely.
13
14 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
15 Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
16
17 bin/ecompress | 16 ++++++++++++++++
18 bin/ecompress-file | 16 +++-------------
19 2 files changed, 19 insertions(+), 13 deletions(-)
20
21 diff --git a/bin/ecompress b/bin/ecompress
22 index 635073b5f..dfa1a0b44 100755
23 --- a/bin/ecompress
24 +++ b/bin/ecompress
25 @@ -68,6 +68,7 @@ while [[ $# -gt 0 ]] ; do
26 continue 2
27 fi
28 done
29 + echo "${path}" >> "${T}"/.ecompress_had_precompressed
30 ;;
31 esac
32
33 @@ -175,6 +176,21 @@ find "${ED}" -name '*.ecompress' -delete -print0 |
34 ___parallel_xargs -0 "${PORTAGE_BIN_PATH}"/ecompress-file
35 ret=${?}
36
37 +if [[ -f ${T}/.ecompress_had_precompressed ]]; then
38 + eqawarn "One or more compressed files were found in docompress-ed directories."
39 + eqawarn "Please fix the ebuild not to install compressed files (manpages,"
40 + eqawarn "documentation) when automatic compression is used:"
41 + eqawarn
42 + n=0
43 + while read -r f; do
44 + eqawarn " ${f#${D%/}}"
45 + if [[ $(( n++ )) -eq 10 ]]; then
46 + eqawarn " ..."
47 + break
48 + fi
49 + done <"${T}"/.ecompress_had_precompressed
50 +fi
51 +
52 fix_symlinks
53 : $(( ret |= ${?} ))
54 [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
55
56 diff --git a/bin/ecompress-file b/bin/ecompress-file
57 index 18269c91b..bc8fe5451 100755
58 --- a/bin/ecompress-file
59 +++ b/bin/ecompress-file
60 @@ -14,7 +14,6 @@ compress_file() {
61 set +f
62 mask_ext_re="^(${mask_ext_re:1})\$"
63 local filtered_args=()
64 - local had_precompressed=
65 for x in "$@" ; do
66 [[ ${x##*.} =~ $mask_ext_re ]] && continue
67 [[ -s ${x} ]] || continue
68 @@ -23,16 +22,13 @@ compress_file() {
69 case ${x} in
70 *.gz|*.Z)
71 gunzip -f "${x}" || __helpers_die "gunzip failed"
72 - x=${x%.*}
73 - had_precompressed=1;;
74 + x=${x%.*};;
75 *.bz2)
76 bunzip2 -f "${x}" || __helpers_die "bunzip2 failed"
77 - x=${x%.bz2}
78 - had_precompressed=1;;
79 + x=${x%.bz2};;
80 *.lzma|*.xz)
81 unxz -f "${x}" || __helpers_die "unxz failed"
82 - x=${x%.*}
83 - had_precompressed=1;;
84 + x=${x%.*};;
85 esac
86
87 filtered_args+=( "$x" )
88 @@ -40,12 +36,6 @@ compress_file() {
89 [[ ${#filtered_args[@]} -eq 0 ]] && return 0
90 set -- "${filtered_args[@]}"
91
92 - if [[ ${had_precompressed} ]]; then
93 - eqawarn "One or more compressed files were found in docompress-ed directories."
94 - eqawarn "Please fix the ebuild not to install compressed files (manpages,"
95 - eqawarn "documentation) when automatic compression is used."
96 - fi
97 -
98 # If a compressed version of the file already exists, simply
99 # delete it so that the compressor doesn't whine (bzip2 will
100 # complain and skip, gzip will prompt for input)