From 32450c47bf096d4cc19af1d1bdd7825512ff4ba0 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sun, 19 Mar 2023 14:28:10 +0000 Subject: [PATCH] jw-pckg: Fix duplicates in compile-templates Files were listed twice in compile-templates, because apparently, during postinstall, rpm -ql returns the list of a packages files twice. Signed-off-by: Jan Lindemann --- scripts/jw-pkg | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/jw-pkg b/scripts/jw-pkg index b85fd0d7..78a5ae9b 100644 --- a/scripts/jw-pkg +++ b/scripts/jw-pkg @@ -123,12 +123,18 @@ list_projects() sort -u } +list_files() +{ + # Need to sort -u, because apparently, during installation, rpm -ql + # returns every file in the package _twice_. Funny. + list_packages "$@" | sort -u | xargs -r rpm -ql +} + cmd_rpmnew() { local file - list_packages "$@" | - xargs -r rpm -ql | + list_files "$@" | while read file; do if [ -e "$file.rpmnew" ]; then if diff -q $file $file.rpmnew; then @@ -187,7 +193,8 @@ cmd_list_templates() local ext_from="$template_exts" # TODO: support more than one local ext_from_re=`echo $ext_from | sed 's/\./\\./g'` local f - list_packages "$@" | xargs -r rpm -ql | while read f; do + + list_files "$@" | while read f; do [ -f "$f" -o -L "$f" ] || continue echo $f | grep -q "$ext_from_re$" || continue echo $f @@ -198,7 +205,7 @@ cmd_list_template_tables() { local ext_from="$table_exts" local e f t - list_packages "$@" | xargs -r rpm -ql | while read f; do + list_files "$@" | while read f; do [ -f "$f" -o -L "$f" ] || continue for e in $ext_from; do t="${f%.*}$e" @@ -212,7 +219,7 @@ cmd_list_template_output() { local re=`echo $template_exts | sed 's/\./\\\\./g; s/^ *//; s/ *$//; s/ */$\\\\|/g; s/\(.*\)/\\\\(\1$\\\\)/'` local f - list_packages "$@" | xargs -r rpm -ql | sed "/$re/ !d; s/$re//" | while read f; do + list_files "$@" | sed "/$re/ !d; s/$re//" | while read f; do [ -f "$f" -o -L "$f" ] || continue echo $f done