git: caddfcd546e0 - main - share/man: Move many manpages to more correct packages

From: Lexi Winter <ivy_at_FreeBSD.org>
Date: Fri, 25 Jul 2025 17:28:41 UTC
The branch main has been updated by ivy:

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

commit caddfcd546e020aec73b0a53d925460f10f7ae7d
Author:     Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-07-25 14:02:23 +0000
Commit:     Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-07-25 17:31:26 +0000

    share/man: Move many manpages to more correct packages
    
    At the moment, all the manpages in share/man are in the utilities-man
    package.  Move some of them to the package they should actually be in,
    using the new MANGROUPS feature.
    
    Move all of section 3 to clibs-man.  Although some of these are from
    /usr/include/sys rather than libc, you can't practically use them
    without libc, and clibs-man is where the libc manpages live already.
    
    Move all of sections 4 and 9 to a new kernel-man package, except for
    atf-test-case.4 which goes to tests-man.  atf-test-case.4 is in the
    wrong section, but this needs to be fixed upstream.
    
    kernel-man requires special handling in generate-ucl.lua since it's
    got a -man suffix but doesn't want the ' (manual pages)' automatic
    suffix.  For now, fix this by adding a list of packages that don't
    get automatic suffixes.
    
    Reviewed by:    ifreund_freebsdfoundation.org, manu, emaste
    Differential Revision:  https://reviews.freebsd.org/D51504
---
 release/packages/generate-ucl.lua   | 12 ++++-
 release/packages/ucl/kernel-man.ucl |  5 +++
 share/man/man1/Makefile             | 24 ++++++----
 share/man/man3/Makefile             |  2 +
 share/man/man4/Makefile             |  8 +++-
 share/man/man5/Makefile             | 90 +++++++++++++++++++++++++------------
 share/man/man8/Makefile             | 39 +++++++++-------
 share/man/man9/Makefile             |  2 +
 8 files changed, 126 insertions(+), 56 deletions(-)

diff --git a/release/packages/generate-ucl.lua b/release/packages/generate-ucl.lua
index 3d91d11bc42f..a243c6ea7ad0 100755
--- a/release/packages/generate-ucl.lua
+++ b/release/packages/generate-ucl.lua
@@ -54,8 +54,15 @@ pkg_suffixes = {
 	},
 }
 
+-- A list of packages which don't get the automatic suffix handling,
+-- e.g. -man packages with no corresponding base package.
+local no_suffix_pkgs = {
+	["kernel-man"] = true,
+}
+
 function add_suffixes(obj)
 	local pkgname = obj["name"]
+
 	for _,pattern in pairs(pkg_suffixes) do
 		if pkgname:match(pattern[1]) ~= nil then
 			obj["comment"] = obj["comment"] .. " " .. pattern[2]
@@ -76,6 +83,7 @@ local no_gen_deps = {
 	["libcompiler_rt-dev-lib32"] = true,
 	["liby-dev"] = true,
 	["liby-dev-lib32"] = true,
+	["kernel-man"] = true,
 }
 
 -- Return true if the package 'pkgname' should have a dependency on the package
@@ -163,7 +171,9 @@ if pkgprefix ~= nil and obj["deps"] ~= nil then
 end
 
 -- Add comment and desc suffix.
-add_suffixes(obj)
+if no_suffix_pkgs[pkgname] == nil then
+	add_suffixes(obj)
+end
 
 -- Write the output file.
 local f,err = io.open(arg[#arg], "w")
diff --git a/release/packages/ucl/kernel-man.ucl b/release/packages/ucl/kernel-man.ucl
new file mode 100644
index 000000000000..9d70baf2c3af
--- /dev/null
+++ b/release/packages/ucl/kernel-man.ucl
@@ -0,0 +1,5 @@
+comment = "Kernel manual pages"
+desc = <<EOD
+Manual pages for kernel interfaces and drivers (section 4) and the kernel
+developer manual pages (section 9).
+EOD
diff --git a/share/man/man1/Makefile b/share/man/man1/Makefile
index 5b1d3ac1091d..d3975c8e8084 100644
--- a/share/man/man1/Makefile
+++ b/share/man/man1/Makefile
@@ -1,16 +1,17 @@
 .include <src.opts.mk>
 
-MAN=	builtin.1 intro.1
+MANGROUPS=	MAN
 
-.if ${MK_TESTS} != "no"
-ATF=	${SRCTOP}/contrib/atf
-.PATH:	${ATF}/doc
-MAN+=	atf-test-program.1
-.endif
+MANLINKS=	intro.1 introduction.1
+
+MANGROUPS+=	RUNTIME
+RUNTIME=	builtin.1 intro.1
+RUNTIMEPACKAGE=	runtime
 
 # Create MLINKS for Shell built in commands for which there are no userland
 # utilities of the same name:
-MLINKS=	builtin.1 alias.1 \
+RUNTIMELINKS=\
+	builtin.1 alias.1 \
 	builtin.1 alloc.1 \
 	builtin.1 bg.1 \
 	builtin.1 bind.1 \
@@ -96,6 +97,13 @@ MLINKS=	builtin.1 alias.1 \
 	builtin.1 wait.1 \
 	builtin.1 where.1 \
 	builtin.1 while.1
-MLINKS+=intro.1 introduction.1
+
+.if ${MK_TESTS} != "no"
+MANGROUPS+=	TESTS
+ATF=		${SRCTOP}/contrib/atf
+.PATH:		${ATF}/doc
+TESTS=		atf-test-program.1
+TESTSPACKAGE=	tests
+.endif
 
 .include <bsd.prog.mk>
diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile
index 6cdd443ec067..3511acb254e1 100644
--- a/share/man/man3/Makefile
+++ b/share/man/man3/Makefile
@@ -1,5 +1,7 @@
 .include <src.opts.mk>
 
+PACKAGE=	clibs
+
 MAN=		alloca.3 \
 		arb.3 \
 		assert.3 \
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 505e83a67369..1ba1fe46523e 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -1,5 +1,8 @@
 .include <src.opts.mk>
 
+MANGROUPS=	MAN
+MANPACKAGE=	kernel
+
 # If you add a new file here, please consider adding an entry to the
 # hardware notes template (website/archetypes/release/hardware.adoc in
 # the doc repository); otherwise the automatically generated hardware
@@ -58,7 +61,6 @@ MAN=	aac.4 \
 	atkbdc.4 \
 	${_atopcase.4} \
 	atp.4 \
-	${_atf_test_case.4} \
 	${_atrtc.4} \
 	${_attimer.4} \
 	audit.4 \
@@ -1023,9 +1025,11 @@ MAN+=		mlx5io.4
 .endif
 
 .if ${MK_TESTS} != "no"
+MANGROUPS+=	TESTS
 ATF=            ${SRCTOP}/contrib/atf
 .PATH:          ${ATF}/doc
-_atf_test_case.4=	atf-test-case.4
+TESTS=		atf-test-case.4
+TESTSPACKAGE=	tests
 .endif
 
 .if ${MK_PF} != "no"
diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile
index e2abf1d60905..0f6559b236c6 100644
--- a/share/man/man5/Makefile
+++ b/share/man/man5/Makefile
@@ -1,14 +1,11 @@
 .include <src.opts.mk>
 
+MANGROUPS=	MAN
+
 #MISSING: dump.5 plot.5
-MAN=	acct.5 \
-	ar.5 \
-	a.out.5 \
+MAN=	a.out.5 \
 	${_boot.config.5} \
 	core.5 \
-	devfs.conf.5 \
-	devfs.rules.5 \
-	device.hints.5 \
 	dir.5 \
 	disktab.5 \
 	elf.5 \
@@ -16,32 +13,24 @@ MAN=	acct.5 \
 	eui64.5 \
 	fbtab.5 \
 	forward.5 \
-	fs.5 \
-	fstab.5 \
 	group.5 \
 	hosts.5 \
 	hosts.equiv.5 \
-	hosts.lpd.5 \
 	intro.5 \
 	libmap.conf.5 \
 	link.5 \
 	mailer.conf.5 \
 	make.conf.5 \
-	moduli.5 \
 	motd.5 \
 	mount.conf.5 \
 	networks.5 \
-	nsmb.conf.5 \
 	nsswitch.conf.5 \
 	os-release.5 \
-	passwd.5 \
 	pbm.5 \
-	periodic.conf.5 \
 	phones.5 \
 	portindex.5 \
 	protocols.5 \
 	quota.user.5 \
-	rc.conf.5 \
 	rctl.conf.5 \
 	regdomain.5 \
 	remote.5 \
@@ -54,18 +43,6 @@ MAN=	acct.5 \
 	style.mdoc.5 \
 	sysctl.conf.5 \
 
-MLINKS=	dir.5 dirent.5
-MLINKS+=fs.5 inode.5
-MLINKS+=hosts.equiv.5 rhosts.5
-MLINKS+=passwd.5 master.passwd.5
-MLINKS+=passwd.5 pwd.db.5
-MLINKS+=passwd.5 spwd.db.5
-MLINKS+=portindex.5 INDEX.5
-MLINKS+=quota.user.5 quota.group.5
-MLINKS+=rc.conf.5 rc.conf.local.5
-MLINKS+=resolver.5 resolv.conf.5
-MLINKS+=src.conf.5 src-env.conf.5
-
 .if ${MK_BLUETOOTH} != "no"
 MAN+=	bluetooth.device.conf.5 \
 	bluetooth.hosts.5 \
@@ -80,11 +57,68 @@ MAN+=	freebsd-update.conf.5
 MAN+=	hesiod.conf.5
 .endif
 
+MLINKS=	dir.5 dirent.5
+MLINKS+=fs.5 inode.5
+MLINKS+=hosts.equiv.5 rhosts.5
+MLINKS+=portindex.5 INDEX.5
+MLINKS+=quota.user.5 quota.group.5
+MLINKS+=resolver.5 resolv.conf.5
+MLINKS+=src.conf.5 src-env.conf.5
+
+MANGROUPS+=	ACCT
+ACCT=		acct.5
+ACCTPACKAGE=	acct
+
+MANGROUPS+=	BOOTLOADER
+BOOTLOADER=	device.hints.5
+BOOTLOADERPACKAGE=bootloader
+
+MANGROUPS+=	CLANG
+CLANG=		ar.5
+CLANGPACKAGE=	clang
+
+MANGROUPS+=	LP
+LP=		hosts.lpd.5
+LPPACKAGE=	lp
+
+MANGROUPS+=	PERIODIC
+PERIODIC=	periodic.conf.5
+PERIODICPACKAGE=periodic
+
 .if ${MK_PF} != "no"
-MAN+=	pf.conf.5 \
-	pf.os.5
+MANGROUPS+=	PF
+PF=		pf.conf.5 \
+		pf.os.5
+PFPACKAGE=	pf
 .endif
 
+MANGROUPS+=	RC
+RC=		rc.conf.5
+RCLINKS=	rc.conf.5 rc.conf.local.5
+RCPACKAGE=	rc
+
+MANGROUPS+=	RUNTIME
+RUNTIME=	devfs.conf.5 \
+		devfs.rules.5 \
+		fstab.5 \
+		passwd.5
+RUNTIMELINKS=	passwd.5 master.passwd.5
+RUNTIMELINKS+=	passwd.5 pwd.db.5
+RUNTIMELINKS+=	passwd.5 spwd.db.5
+RUNTIMEPACKAGE=	runtime
+
+MANGROUPS+=	SMB
+SMB=		nsmb.conf.5
+SMBPACKAGE=	smbutils
+
+MANGROUPS+=	SSH
+SSH=		moduli.5
+SSHPACKAGE=	ssh
+
+MANGROUPS+=	UFS
+UFS=		fs.5
+UFSPACKAGE=	ufs
+
 # This makes more sense for amd64 and i386 but
 # we decide to install all manpages in all architectures
 _boot.config.5=	boot.config.5
diff --git a/share/man/man8/Makefile b/share/man/man8/Makefile
index bd6bdfe4ba05..c408f1b65a80 100644
--- a/share/man/man8/Makefile
+++ b/share/man/man8/Makefile
@@ -1,5 +1,7 @@
 .include <src.opts.mk>
 
+MANGROUPS=	MAN
+
 MAN=	\
 	beinstall.8 \
 	crash.8 \
@@ -7,29 +9,32 @@ MAN=	\
 	diskless.8 \
 	intro.8 \
 	nanobsd.8 \
-	rc.8 \
-	rc.subr.8 \
 	rescue.8 \
-	${_uefi.8} \
+	${_uefi.8}
 
 MLINKS= \
 	beinstall.8 beinstall.sh.8 \
-	nanobsd.8 nanobsd.sh.8 \
-	rc.8 rc.d.8 \
-	rc.8 rc.firewall.8 \
-	rc.8 rc.local.8 \
-	rc.8 rc.network.8 \
-	rc.8 rc.pccard.8 \
-	rc.8 rc.resume.8 \
-	rc.8 rc.serial.8 \
-	rc.8 rc.shutdown.8
+	nanobsd.8 nanobsd.sh.8
 
-.if ${MK_NIS} != "no"
-MAN+=	yp.8
+MANGROUPS+=	RC
+RC=		rc.8 rc.subr.8
+RCLINKS=	rc.8 rc.d.8 \
+		rc.8 rc.firewall.8 \
+		rc.8 rc.local.8 \
+		rc.8 rc.network.8 \
+		rc.8 rc.pccard.8 \
+		rc.8 rc.resume.8 \
+		rc.8 rc.serial.8 \
+		rc.8 rc.shutdown.8
+RCPACKAGE=	rc
 
-MLINKS+=yp.8 NIS.8 \
-	yp.8 nis.8 \
-	yp.8 YP.8
+.if ${MK_NIS} != "no"
+MANGROUPS+=	YP
+YP=		yp.8
+YPLINKS=	yp.8 NIS.8 \
+		yp.8 nis.8 \
+		yp.8 YP.8
+YPPACKAGE=	yp
 .endif
 
 # This makes more sense for aarch 64 and amd64
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index f709a4818dd5..b73e47b3ef4d 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,5 +1,7 @@
 .include <src.opts.mk>
 
+PACKAGE=	kernel
+
 MAN=	accept_filter.9 \
 	accf_data.9 \
 	accf_dns.9 \