commit: ed55f50d25cb1360318ce4b09dacb896f053c75b
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jun 8 17:04:04 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 9 02:51:10 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ed55f50d
ecompress: rename several variables in do_queue()
Rename the 'collisions' variable to 'collision_by' so as to emphasise
that it is a map and not a list. Also, have its values be the null
string rather than "1", thereby saving a little memory.
Rename the 'vpath' variable to 'uncompressed_path', and the 'comp'
variable to 'suffix'. These new names better convey their respective
purposes.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/ecompress | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/bin/ecompress b/bin/ecompress
index 9d8f8f3024..037e5b80df 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -54,9 +54,9 @@ do_ignore() {
}
do_queue() {
- local vpath comp path
+ local uncompressed_path suffix path
local -a find_args paths
- local -A collisions
+ local -A collision_by
for path; do
if [[ ${path} == *$'\n'* ]]; then
@@ -85,11 +85,11 @@ do_queue() {
# note: to save time, we need to do this only if there's
# at least one compressed file
if [[ ${path} == *.@(Z|gz|bz2|lzma|lz|lzo|lz4|xz|zst) ]]; then
- vpath=${path%.*}
- for comp in '' .{Z,gz,bz2,lzma,lz,lzo,lz4,xz,zst}; do
- if [[ ${vpath}${comp} != "${path}" && -e
${vpath}${comp} ]]; then
- collisions[$path]=1
- collisions[$vpath]=1
+ uncompressed_path=${path%.*}
+ for suffix in '' .{Z,gz,bz2,lzma,lz,lzo,lz4,xz,zst}; do
+ if [[ ${uncompressed_path}${suffix} !=
"${path}" && -e ${uncompressed_path}${suffix} ]]; then
+ collision_by[$path]=
+ collision_by[$uncompressed_path]=
# ignore compressed variants in that
case
continue 2
fi
@@ -105,10 +105,10 @@ do_queue() {
# Check whether the invocation of find(1) succeeded.
wait "$!" || die
- if (( ${#collisions[@]} )); then
+ if (( ${#collision_by[@]} )); then
eqawarn "QA Notice: Colliding files found by ecompress:"
eqawarn
- for path in "${!collisions[@]}"; do
+ for path in "${!collision_by[@]}"; do
eqawarn " ${path}"
done
eqawarn