From 006846f7aef82515ca8b76aa79e8ad35b4ea6f77 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Sat, 12 Nov 2005 19:31:30 +0000 Subject: [PATCH] Speed up stale catpages hunting by not running sed(1) for every catpage. --- Makefile.inc1 | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index e3cb6f423972..e35e3c4b67b0 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1096,15 +1096,14 @@ delete-old-files: && rm ${RM_I} "${DESTDIR}/${file}")) .endfor # Remove catpages without corresponding manpages. - @for dir in ${DESTDIR}/usr/share/man/cat*; do \ - for catpage in $${dir}/*; do \ - manpage=$$(echo $${catpage} \ - | sed 's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:') \ - check_empty=$$(echo $${catpage} \ - | sed 's:.*\*:empty:'); \ - [ "$${check_empty}" != "empty" -a ! -e "$${manpage}" ] \ - && rm ${RM_I} $${catpage} || true; \ - done; \ + @3<&0; \ + find ${DESTDIR}/usr/share/man/cat* ! -type d | \ + sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ + while read catpage; do \ + read manpage; \ + if [ ! -e "$${manpage}" ]; then \ + rm ${RM_I} $${catpage} <&3 ; \ + fi; \ done @echo ">>> Old files removed" @@ -1114,15 +1113,13 @@ check-old-files: @[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}" .endfor # Check for catpages without corresponding manpages. - @for dir in ${DESTDIR}/usr/share/man/cat*; do \ - for catpage in $${dir}/*; do \ - manpage=$$(echo $${catpage} \ - | sed 's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:'); \ - check_empty=$$(echo $${catpage} \ - | sed 's:.*\*:empty:'); \ - [ "$${check_empty}" != "empty" -a ! -e "$${manpage}" ] \ - && echo $${catpage} || true; \ - done; \ + @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ + sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ + while read catpage; do \ + read manpage; \ + if [ ! -e "$${manpage}" ]; then \ + echo $${catpage} ; \ + fi; \ done delete-old-libs: