Makefile.inc1: Fix distributeworld mtree mangling for dist root dir

The trailing slash means that ./base itself doesn't get mangled and
remains as-is in the output, leading to a stray /base in base.txz for
NO_ROOT builds and thus in the installed system. Since this action is
running on a line whose file matches one listed by find (and we're
printing all of these as part of that distribution), we don't need to
care about the possibility of a path like ./basefoo/bar where the path
prefix isn't ./base, and can thus just drop the slash rather than
needing something more complicated like "slash or whitespace or EOL" as
one might first think.
This commit is contained in:
Jessica Clarke 2023-06-08 18:35:23 +01:00
parent 469727c966
commit 2e0d99a953

View File

@ -1482,7 +1482,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
@# 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 } }' > \
awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \
${DESTDIR}/${DISTDIR}/${dist}.meta
.endfor
.for dist in ${DEBUG_DISTRIBUTIONS}
@ -1492,7 +1492,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
@# 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 } }' > \
awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \
${DESTDIR}/${DISTDIR}/${dist}.debug.meta
.endfor
.endif