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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2023-03-19 14:28:10 +00:00
commit 32450c47bf

View file

@ -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