public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] ecompress: ignore docompress -x files in precompressed QA check (bug 721516)
@ 2020-05-24 21:32 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2020-05-24 21:32 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Ignore files passed to docompress -x in the QA check for
precompressed files.

Bug: https://bugs.gentoo.org/721516
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
 bin/ecompress | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index dfa1a0b44..2d74ed07a 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -19,16 +19,28 @@ while [[ $# -gt 0 ]] ; do
 		shift
 
 		skip_dirs=()
+		skip_files=()
 		for skip; do
 			if [[ -d ${ED%/}/${skip#/} ]]; then
 				skip_dirs+=( "${ED%/}/${skip#/}" )
 			else
 				rm -f "${ED%/}/${skip#/}.ecompress" || die
+				skip_files+=("${ED%/}/${skip#/}")
 			fi
 		done
 
 		if [[ ${#skip_dirs[@]} -gt 0 ]]; then
-			find "${skip_dirs[@]}" -name '*.ecompress' -delete || die
+			while read -r -d ''; do
+				skip_files+=(${REPLY#.ecompress})
+			done < <(find "${skip_dirs[@]}" -name '*.ecompress' -print0 -delete || die)
+		fi
+
+		if [[ ${#skip_files[@]} -gt 0 && -s ${T}/.ecompress_had_precompressed ]]; then
+			sed_args=()
+			for f in "${skip_files[@]}"; do
+				sed_args+=(-e "s|^${f}\$||")
+			done
+			sed "${sed_args[@]}" -e '/^$/d' -i "${T}/.ecompress_had_precompressed" || die
 		fi
 
 		exit 0
@@ -176,7 +188,7 @@ find "${ED}" -name '*.ecompress' -delete -print0 |
 	___parallel_xargs -0 "${PORTAGE_BIN_PATH}"/ecompress-file
 ret=${?}
 
-if [[ -f ${T}/.ecompress_had_precompressed ]]; then
+if [[ -s ${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:"
-- 
2.25.3



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-24 21:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-24 21:32 [gentoo-portage-dev] [PATCH] ecompress: ignore docompress -x files in precompressed QA check (bug 721516) Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox