From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1049257-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id D2564138334
	for <garchives@archives.gentoo.org>; Fri, 28 Sep 2018 20:33:13 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 717E4E0971;
	Fri, 28 Sep 2018 20:33:11 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 36E9EE096B
	for <gentoo-commits@lists.gentoo.org>; Fri, 28 Sep 2018 20:33:11 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id ED212335C39
	for <gentoo-commits@lists.gentoo.org>; Fri, 28 Sep 2018 20:33:08 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 5C7483F9
	for <gentoo-commits@lists.gentoo.org>; Fri, 28 Sep 2018 20:33:07 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1538166760.fe4f9bd02f5085e631452d4b5617f5537c5d9b66.mgorny@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/ecompress bin/ecompress-file
X-VCS-Directories: bin/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: fe4f9bd02f5085e631452d4b5617f5537c5d9b66
X-VCS-Branch: master
Date: Fri, 28 Sep 2018 20:33:07 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 6cfb787a-617e-4829-bd03-084b64d2d96a
X-Archives-Hash: 56474bdacae613188218216a5ee44da8

commit:     fe4f9bd02f5085e631452d4b5617f5537c5d9b66
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 25 19:13:57 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep 28 20:32:40 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fe4f9bd0

ecompress: Fix duplicate pre-compressed file warning

Fix the pre-compressed file warning to be reported only once, now that
files are processed in parallel.  Also, print the list of precompressed
files verbosely.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/ecompress      | 16 ++++++++++++++++
 bin/ecompress-file | 16 +++-------------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index 635073b5f..dfa1a0b44 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -68,6 +68,7 @@ while [[ $# -gt 0 ]] ; do
 								continue 2
 							fi
 						done
+						echo "${path}" >> "${T}"/.ecompress_had_precompressed
 						;;
 				esac
 
@@ -175,6 +176,21 @@ 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:"
+	eqawarn
+	n=0
+	while read -r f; do
+		eqawarn "  ${f#${D%/}}"
+		if [[ $(( n++ )) -eq 10 ]]; then
+			eqawarn "  ..."
+			break
+		fi
+	done <"${T}"/.ecompress_had_precompressed
+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)