git: 7d0d52fc7c53 - main - distributeworld: dedup dist(.debug).meta generation

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 12 Dec 2024 16:30:29 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=7d0d52fc7c53bcb3c827fa6873baf583633ad183

commit 7d0d52fc7c53bcb3c827fa6873baf583633ad183
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-12-12 16:14:14 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-12-12 16:14:14 +0000

    distributeworld: dedup dist(.debug).meta generation
    
    Debug file distribution metadata generation was added in 2d0bcb76c8530
    as a near duplicate of the default distribution bits.  Add another loop
    instead of copying the code.  While here, improve indentation.
    
    Reviewed by:    emaste
    Sponsored by:   DARPA, AFRL
    Differential Revision:  https://reviews.freebsd.org/D48038
---
 Makefile.inc1 | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index ef63bfd52381..5cf431733f8e 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1538,24 +1538,16 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
 .endfor
 .if defined(NO_ROOT)
 .for dist in base ${EXTRA_DISTRIBUTIONS}
+.for path suffix in "" .meta /usr/lib/debug .debug.meta
 	@# For each file that exists in this dist, print the corresponding
 	@# line from the METALOG.  This relies on the fact that
 	@# a line containing only the filename will sort immediately before
 	@# the relevant mtree line.
 	cd ${DESTDIR}/${DISTDIR}; \
-	find ./${dist} | ${METALOG_SORT_CMD} -u ${METALOG} - | \
-	awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \
-	${DESTDIR}/${DISTDIR}/${dist}.meta
+	    find ./${dist}${path} | ${METALOG_SORT_CMD} -u ${METALOG} - | \
+	    awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \
+	    ${DESTDIR}/${DISTDIR}/${dist}${suffix}
 .endfor
-.for dist in ${DEBUG_DISTRIBUTIONS}
-	@# For each file that exists in this dist, print the corresponding
-	@# line from the METALOG.  This relies on the fact that
-	@# a line containing only the filename will sort immediately before
-	@# the relevant mtree line.
-	cd ${DESTDIR}/${DISTDIR}; \
-	find ./${dist}/usr/lib/debug | ${METALOG_SORT_CMD} -u ${METALOG} - | \
-	awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \
-	${DESTDIR}/${DISTDIR}/${dist}.debug.meta
 .endfor
 .endif
 .endif # make(distributeworld)