git: 266f640b3896 - main - Makefile.inc1: Remove non-NO_ROOT cases from distributeworld

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 16 Dec 2024 21:46:18 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=266f640b38960653fcdbd1881e9dde0ce92a6c9d

commit 266f640b38960653fcdbd1881e9dde0ce92a6c9d
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-12-11 16:25:34 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-12-16 21:29:59 +0000

    Makefile.inc1: Remove non-NO_ROOT cases from distributeworld
    
    As of commit 41adc5f29ba6 ("release: Always use NO_ROOT for distribute*
    and package*") we pass -NO_ROOT for the release image artifact build
    targets.  For distributeworld, add a check that NO_ROOT and METALOG are
    set, and then remove tests for them being set.
    
    This is an incremental step towards the goal of having all targets in
    release/Makefile run without requiring root.
    
    Reviewed by:    brooks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D48095
---
 Makefile.inc1 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index bd0ed3ebfba8..8d47d8098ab8 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1004,6 +1004,9 @@ IMAKE_MTREE=	MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
 .if ${DISTDIR:U/} == /
 .error DISTDIR must be set for make distributeworld and may not be the root directory.
 .endif
+if !defined(NO_ROOT) || !defined(METALOG)
+.error NO_ROOT and METALOG must be set for make distributeworld.
+.endif
 CERTCTLDESTDIR=	${DESTDIR}/${DISTDIR}
 CERTCTLFLAGS+=	-d /base
 .else
@@ -1501,7 +1504,6 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
 	    -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null
 .endif
 .endif
-.if defined(NO_ROOT)
 	${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
 	    sed -e 's#^\./#./${dist}/#' >> ${METALOG}
 	${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
@@ -1515,7 +1517,6 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
 	${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
 	    sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
 .endfor
-.endif
 .endfor
 	-mkdir ${DESTDIR}/${DISTDIR}/base
 	${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH:Q} ${MAKE} \
@@ -1539,7 +1540,6 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
 .for dist in ${EXTRA_DISTRIBUTIONS}
 	find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete
 .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
@@ -1552,7 +1552,6 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
 	    ${DESTDIR}/${DISTDIR}/${dist}${suffix}
 .endfor
 .endfor
-.endif
 .endif # make(distributeworld)
 
 packageworld: .PHONY