distributeworld: dedup dist(.debug).meta generation

Debug file distribution metadata generation was added in 2d0bcb76c8
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
This commit is contained in:
Brooks Davis 2024-12-12 16:14:14 +00:00
parent c9febea3dc
commit 7d0d52fc7c

View file

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