[PATCH] openbsd: Include man pages from baseXX.tgz

[PATCH] openbsd: Include man pages from baseXX.tgz

From: Keith Whitney
A number of OpenBSD man pages are currently missing in exman, since they
reside in OpenBSD's baseXX.tgz [1]:
    - help(1)
    - man(1)
    - pkg_add(1)
    - OpenBSD::BaseState(3p)
    - packages(7)
    - adduser(8)
    - afterboot(8)
    - user(8)
    - useradd(8)
    - userdel(8)
    - userinfo(8)
    - usermod(8)

This patch adds baseXX.tgz to the OpenBSD distfiles, which begrudgingly
adds ~330 MiB to the install. I figure this might acceptable since
base.txz is similarly fetched for FreeBSD.

Since this isn't ideal, I'll look into whether these man pages are
intended to be in baseXX.tgz or not. If not, I'll see about changing
this upstream, and this patch can be reverted.

[1] Lines 2876-2931: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/distrib/sets/lists/base/mi?annotate=1.1065
---
 OpenBSD/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OpenBSD/Makefile b/OpenBSD/Makefile
index 54c8b0f..f8eb64d 100644
--- a/OpenBSD/Makefile
+++ b/OpenBSD/Makefile
@@ -2,7 +2,7 @@ SYSTEM = OpenBSD
 VERSION = 7.1
 MIRROR = https://cdn.openbsd.org/pub/OpenBSD/${VERSION}/amd64
 V = ${VERSION:S/.//}
-DISTFILES = comp${V}.tgz game${V}.tgz man${V}.tgz
+DISTFILES = base${V}.tgz comp${V}.tgz game${V}.tgz man${V}.tgz
 FILES = ./usr/share/man/man[1-9]*/
 STRIP = 4
 
-- 
2.32.0 (Apple Git-132)

Re: [PATCH] openbsd: Include man pages from baseXX.tgz

From: june
> On Jul 3, 2022, at 10:31, Keith Whitney <klw0@klw0.org> wrote:
> 
> A number of OpenBSD man pages are currently missing in exman, since they
> reside in OpenBSD's baseXX.tgz

Woops, I never noticed that. Thanks!

Re: [PATCH] openbsd: Include man pages from baseXX.tgz

From: Štěpán Němec
To: june
>> On Jul 3, 2022, at 10:31, Keith Whitney <klw0@klw0.org> wrote:
>> 
>> A number of OpenBSD man pages are currently missing in exman, since they
>> reside in OpenBSD's baseXX.tgz

> Woops, I never noticed that. Thanks!

Sorry I'm late to the party. I, too, had been wondering whether the
lacunae were intentional. OpenBSD base man pages are not alone here,
though:

OpenBSD X11 man pages are all missing (file sets xbase, xserv, xshare
(xfont contains no man pages)). Their inclusion would require more
tweaking (they are under /usr/X11R?/).

The NetBSD situation is similar, missing X11 man pages from xbase,
xcomp and xserver file sets, plus (mostly roff/man(doc)-related) man
pages from text.tar.xz. Unlike OpenBSD, NetBSD base.tar.xz doesn't
seem to contain any man pages.

In FreeBSD there are man pages in src.txz missing from base.txz,
although that might reflect some intention on the FreeBSD maintainers'
part (I don't know, not being that familiar with FreeBSD).

[For reference or convenience I'm attaching a script similar to what I
used to obtain the information above; it's crude, but can hopefully
serve for illustration purposes and is easily adjustable.]

Any opinions? I think I'd prefer we do include the X11 man pages as
well, though perhaps merged with the others (i.e., no separate X11 tree)
to make it simpler?

I'll send a patch to add the NetBSD text file set for now; I assume
that should be uncontroversial.

-- 
Štěpán

#!/bin/sh

list_file_sets() {
  os=$1; shift
  case $os in
    NetBSD)
      sed -n 's/^.*(\([^)]*\)).*$/\1/p' "$@"
      ;;
    OpenBSD)
      sed -n 's/^.*(\(x[^)]*\)).*$/\1/p' "$@"
      ;;
    FreeBSD)
      cut -f 1 "$@"
      ;;
  esac
}

grep_man() {
  os=$1
  list_url=$2
  base_url=${list_url%/*}
  if [ -d "$os" ]; then reuse=true; else reuse=false; fi

  $reuse || mkdir "$os"
  cd -- "$os" || exit
  printf '\n%s:\n' "$os"
  $reuse || curl -sLO "$list_url"
  list_file_sets "$os" "${list_url##*/}" |
    while IFS= read -r file_set; do
      printf '\n%s:\n' "$file_set"
      $reuse || curl -sLO "$base_url"/"$file_set"
      tar tf "$file_set" | grep '/man[0-9][0-9A-Za-z]*/' | sort
    done
  cd .. || exit
}

while IFS=' ' read -r os url; do
  grep_man "$os" "$url"
done <<.
NetBSD https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/amd64/binary/sets/MD5
OpenBSD https://ftp.openbsd.org/pub/OpenBSD/7.1/amd64/SHA256
FreeBSD https://download.freebsd.org/ftp/releases/amd64/13.1-RELEASE/MANIFEST
.

cd FreeBSD || exit
tar tf base.txz |
  sed -n '\|/man[0-9][0-9A-Za-z]*/| {
	    s|.*/||
	    s/\.gz$//
	    p
	  }' | sort >fbsd-base
tar tf src.txz | sed -n '\|/man[0-9][0-9A-Za-z]*/|s|.*/||p' | sort >fbsd-src
echo
echo 'FreeBSD in src and not in base:'
comm -13 fbsd-base fbsd-src | grep '\.[0-9]$'

[PATCH] NetBSD: include text.tar.xz man pages

From: Štěpán Němec
Cc: june, klw0
---
 NetBSD/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetBSD/Makefile b/NetBSD/Makefile
index eccc22f5002b..6c490e3f5cc2 100644
--- a/NetBSD/Makefile
+++ b/NetBSD/Makefile
@@ -1,7 +1,7 @@
 SYSTEM = NetBSD
 VERSION = 9.3
 MIRROR = https://cdn.netbsd.org/pub/NetBSD/NetBSD-${VERSION}/amd64/binary/sets
-DISTFILES = comp.tar.xz games.tar.xz man.tar.xz
+DISTFILES = comp.tar.xz games.tar.xz man.tar.xz text.tar.xz
 FILES = ./usr/share/man/man[1-9]*/
 STRIP = 4
 

base-commit: 3d3f0c9e48d8f64ac2bf0983eb947d6b3f1fa532
prerequisite-patch-id: 4d96fa9477b5a8f5bca61be8b80505541692b7d0
prerequisite-patch-id: 782fd52fcca77b930de4631e2fc654383ea7c792
-- 
2.38.0