reports.mk: use process substitution to dedup

The first half of both pipes was clearly a copy-pasted
initial logfile processing; the file can be of considerable
size (e.g. several megabytes) so it might be slightly more
efficient and cool (but a bit more arcane) to use bash(1)'s
process substitution along with good ol' tee(1) like this:

$ echo -e '1\n2\n3' |tee /dev/stderr 2> >(grep 2 >STDERR) |grep 1 >STDOUT
$ head STD*
==> STDERR <==
2

==> STDOUT <==
1
This commit is contained in:
Michael Shigorin 2021-04-28 15:06:57 +03:00 committed by Anton Midyukov
parent 4c701def7c
commit 6f584cdc52

View File

@ -78,11 +78,10 @@ reports/contents: reports/prep
esac
reports/packages: reports/prep
@grep -E 'chroot/.in/[^/]*.rpm' < $(BUILDLOG) | \
cut -d' ' -f 1 | tr -d "'"'`' | sed 's,^.*/,,' | \
sort -u > "$(REPORTDIR)/list-rpms.txt"
@grep -E 'chroot/.in/[^/]*.rpm' < $(BUILDLOG) | \
cut -d' ' -f 1 | tr -d "'"'`' | \
tee /dev/stderr 2> >(sed 's,^.*/,,' | \
sort -u > "$(REPORTDIR)/list-rpms.txt") | \
xargs rpm -qp --queryformat '%{sourcerpm}\n' | \
sort -u > "$(REPORTDIR)/list-srpms.txt"