git: 0df8ed538c62 - main - Don't some prune empty dirs created by BSD.tests.dist

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Wed, 04 Nov 2026 18:54:02 UTC
The branch main has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=0df8ed538c620cf021f8dfa2c54892b5ef9620a5

commit 0df8ed538c620cf021f8dfa2c54892b5ef9620a5
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-11-04 18:53:01 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-11-04 18:53:51 +0000

    Don't some prune empty dirs created by BSD.tests.dist
    
    Before this change, directories needed when MK_DTRACE_TESTS != no and
    MK_ZFS_TESTS != no but not MK_TESTS != no, were being created via
    `BSD.tests.dist` as part of the standard build/install process with the
    top-level `hierarchy` target. This behavior resulted in `make check-old`
    flagging a lot of issues after 30c20ca26e105c, even after `make
    delete-old` was run and the directories were removed.
    
    Remove the logic which pruned these empty directories; this "fixes" the
    issue with `make check-old`, et al and allows a proper technical solution to
    `OptionalObsoleteFiles.inc` to be implemented by pkgbase in an unimpeded
    manner without introducing additional complexity.
    
    See the review for more details.
    
    PR:             299650
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D60928
---
 tools/build/mk/OptionalObsoleteFiles.inc | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index a0bf0defb19f..4cc2c2525117 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -1434,8 +1434,12 @@ OLD_FILES+=usr/share/man/man1/opt.1.gz
 CDDL_TEST_DIRS=	cddl
 . for d in ${CDDL_TEST_DIRS}
 .  if exists(${DESTDIR}${TESTSBASE}/${d}/)
-TESTS_DIRS!=find ${DESTDIR}${TESTSBASE}/${d}/ -type d | sed -e 's,^${DESTDIR}/,,'; echo
-OLD_DIRS+=${TESTS_DIRS}
+# Bug 299650: do not prune empty directories created by
+# `etc/mtree/BSD.tests.dist`.
+#
+# Read https://reviews.freebsd.org/D60928 for more details.
+#TESTS_DIRS!=find ${DESTDIR}${TESTSBASE}/${d}/ -type d | sed -e 's,^${DESTDIR}/,,'; echo
+#OLD_DIRS+=${TESTS_DIRS}
 TESTS_FILES!=find ${DESTDIR}${TESTSBASE}/${d}/ -type f | sed -e 's,^${DESTDIR}/,,'; echo
 OLD_FILES+=${TESTS_FILES}
 .  endif
@@ -1692,8 +1696,12 @@ OLD_FILES+=${TESTS_FILES}
 DTRACE_TEST_DIRS=	cddl/usr.sbin/dtrace
 . for d in ${DTRACE_TEST_DIRS}
 .  if exists(${DESTDIR}${TESTSBASE}/${d}/)
-TESTS_DIRS!=find ${DESTDIR}${TESTSBASE}/${d}/ -type d | sed -e 's,^${DESTDIR}/,,'; echo
-OLD_DIRS+=${TESTS_DIRS}
+# Bug 299650: do not prune empty directories created by
+# `etc/mtree/BSD.tests.dist`.
+#
+# Read https://reviews.freebsd.org/D60928 for more details.
+#TESTS_DIRS!=find ${DESTDIR}${TESTSBASE}/${d}/ -type d | sed -e 's,^${DESTDIR}/,,'; echo
+#OLD_DIRS+=${TESTS_DIRS}
 TESTS_FILES!=find ${DESTDIR}${TESTSBASE}/${d}/ -type f | sed -e 's,^${DESTDIR}/,,'; echo
 OLD_FILES+=${TESTS_FILES}
 .  endif
@@ -9471,8 +9479,12 @@ ZFS_TEST_DIRS=	cddl/usr.bin/ztest
 ZFS_TEST_DIRS+=	cddl/usr.sbin/zfsd
 . for d in ${ZFS_TEST_DIRS}
 .  if exists(${DESTDIR}${TESTSBASE}/${d}/)
-TESTS_DIRS!=find ${DESTDIR}${TESTSBASE}/${d}/ -type d | sed -e 's,^${DESTDIR}/,,'; echo
-OLD_DIRS+=${TESTS_DIRS}
+# Bug 299650: do not prune empty directories created by
+# `etc/mtree/BSD.tests.dist`.
+#
+# Read https://reviews.freebsd.org/D60928 for more details.
+#TESTS_DIRS!=find ${DESTDIR}${TESTSBASE}/${d}/ -type d | sed -e 's,^${DESTDIR}/,,'; echo
+#OLD_DIRS+=${TESTS_DIRS}
 TESTS_FILES!=find ${DESTDIR}${TESTSBASE}/${d}/ -type f | sed -e 's,^${DESTDIR}/,,'; echo
 OLD_FILES+=${TESTS_FILES}
 .  endif