[PATCH 2/3] reports.mk: streamline basedir(1) equivalent

Michael Shigorin mike at altlinux.org
Wed Apr 28 14:50:06 MSK 2021


That "clever hack" with two rev(1) invocations
seems pretty stupid to me: too much processes
and processing instead of simple prefix removal.

One can also have that as ${var##*/} when dealing
with a shell variable and avoiding extra forks, BTW.
---
 reports.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/reports.mk b/reports.mk
index 0e44c4471..7b81e785a 100644
--- a/reports.mk
+++ b/reports.mk
@@ -79,8 +79,7 @@ reports/contents: reports/prep
 
 reports/packages: reports/prep
 	@grep -E 'chroot/.in/[^/]*.rpm' < $(BUILDLOG) | \
-		cut -d' ' -f 1 | tr -d "'"'`' | \
-		rev | cut -d'/' -f 1 | rev | \
+		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 "'"'`' | \
-- 
2.25.4


--vtzGhvizbBRQ85DL
Content-Type: text/x-patch; charset=us-ascii
Content-Disposition: attachment; filename="0003-reports.mk-use-process-substitution-to-dedup.patch"



More information about the devel-distro mailing list