From 044b50c69ec326cbefdc7b5c886aa5d6385d9db5 Mon Sep 17 00:00:00 2001 From: lotherk Date: Sat, 14 Nov 2026 22:45:40 +0000 Subject: [PATCH] tools/mcde-plist-check.sh, make mcde-linux MCDE_DIRS=plist: every file MCDE installs is in the PLIST (t0217) pkgsrc stops make userland at the first installed file the PLIST does not list, after hours of build (McdeLock.pm, Thumb.h, 0010.language, DtScrn.t.pm, userland-2026-11-14n.log:26326). This installs the native build into a fresh temporary DESTDIR (not build/mcde-root, where make install never removes old files) and names every file under dt/ that neither PLIST lists, in seconds. Compared: only dt/; both PLISTs, the Motif one read as if under dt/ (the native build makes its own Motif there, x11/mcde-motif ships it into the prefix); libraries without their version; without documentation (-docs, pkgsrc-cross.mk.conf:238) and the four files the recipe moves to share/doc. Measured: the current PLIST: 3208 names, ok. Controls from history: the PLIST before fe8abbd1bb gives exactly the six files that commit added; before 2e062c4590 it gives McdeLock.pm and the same six. (First versions gave 241 and 4 false positives: the Motif PLIST sits in the prefix, not under dt/, and the recipe moves four docs.) The rule is in ext/src/mcde/AGENTS.md. Co-Authored-By: Claude Sonnet 5.5 --- ext/src/mcde/AGENTS.md | 16 +++++++ tools/mcde-linux.sh | 9 +++- tools/mcde-plist-check.sh | 99 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100755 tools/mcde-plist-check.sh diff --git a/ext/src/mcde/AGENTS.md b/ext/src/mcde/AGENTS.md index 2813185b3d..5264db0708 100644 --- a/ext/src/mcde/AGENTS.md +++ b/ext/src/mcde/AGENTS.md @@ -487,6 +487,22 @@ tests installs. `MCDE_DIRS=programs/dtfile` for one directory, `MCDE_DIRS=install` into `build/mcde-root/dt`), and `make mcde-host` (`tools/mcde-host.sh`, the desktop in `/usr/mdt`). +- **Every file MCDE installs is a line in `pkgsrc/PLIST`**, in the same change + that adds the file (a program, an icon, a header, a config file): pkgsrc's + check stops `make userland` at the first one that is missing, after hours of + build (14.11.: McdeLock.pm, Thumb.h, 0010.language, DtScrn.t.pm, + `build/logs/userland-2026-11-14n.log:26326`). The line is sorted as + `LC_ALL=C sort` sorts; the files of an option go with `${PLIST.docs}` or + `${PLIST.appbuilder}`. Check before you commit: `make mcde-linux + MCDE_DIRS=plist` (`tools/mcde-plist-check.sh`) installs the native build into a + temporary directory and names every file under `dt/` that no PLIST lists, in + seconds -- after `make mcde-linux MCDE_DIRS=install`. Measured against the + history: with the PLIST from before `fe8abbd1bb` it names exactly the six + files that commit added. It excludes, with the reasons in its header, the + documentation (`-docs`), the files the recipe moves to `share/doc`, and reads + the Motif PLIST as if it were under `dt/`. A file that should not be + installed at all is a bug of its `Makefile.am`, not a PLIST line; + `tools/mcde-plist.sh LOG` adds what a failed build reported. - The C dialect is set by `configure.ac` (`-std=gnu11` and five GCC 14 downgrades; `MCDE_DIALECT_CFLAGS` for a build that ignores CFLAGS); no build system needs to know it. diff --git a/tools/mcde-linux.sh b/tools/mcde-linux.sh index e14ff962dc..9496c476c7 100755 --- a/tools/mcde-linux.sh +++ b/tools/mcde-linux.sh @@ -3,8 +3,10 @@ # # mcde-linux.sh -- build MCDE natively on the (Linux) build host, for development # -# usage: tools/mcde-linux.sh [install [SUBDIR ...] | check SUBDIR ... | SUBDIR ...] +# usage: tools/mcde-linux.sh [install [SUBDIR ...] | check SUBDIR ... | plist | SUBDIR ...] # (make mcde-linux [MCDE_DIRS="install programs/dtfile"]) +# plist: tools/mcde-plist-check.sh -- every file this tree installs is in +# the PLIST (no build; needs the build `make mcde-linux' made) # # MCDE runs on Linux as well as on NetBSD (ext/src/mcde/AGENTS.md), so the host # that builds Makronix can build and run it directly: fast turns for work on @@ -53,6 +55,11 @@ if [ $# -eq 0 ]; then elif [ "$1" = install ] && [ $# -eq 1 ]; then nice -n 19 make -j"$JOBS" || finish $? make install || finish $? +elif [ "$1" = plist ] && [ $# -eq 1 ]; then + # not a build: do the files this tree installs appear in the PLIST of + # ext/src/mcde/pkgsrc (what pkgsrc's check would stop on, hours later)? + "$TOP/tools/mcde-plist-check.sh" + finish $? elif [ "$1" = check ]; then shift for d in "$@"; do diff --git a/tools/mcde-plist-check.sh b/tools/mcde-plist-check.sh new file mode 100755 index 0000000000..3021992644 --- /dev/null +++ b/tools/mcde-plist-check.sh @@ -0,0 +1,99 @@ +#!/bin/sh +# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. +# +# mcde-plist-check.sh -- does the PLIST of MCDE list what MCDE installs? +# +# usage: make mcde-linux MCDE_DIRS=plist (this script, through mcde-linux.sh) +# tools/mcde-plist-check.sh [PLIST] (the same; PLIST defaults to +# ext/src/mcde/pkgsrc/PLIST) +# +# pkgsrc stops `make userland' when MCDE installs a file that ext/src/mcde/ +# pkgsrc/PLIST does not list ("ERROR: The following files are in .../.destdir/ +# usr/pkg but not in the PLIST", build/logs/userland-2026-11-14n.log:26326: +# McdeLock.pm, Thumb.h, 0010.language, DtScrn.t.pm) -- after hours of build. +# This finds the same files in seconds: it installs the native development +# build (build/mcde-linux, made by `make mcde-linux') into a temporary DESTDIR +# -- a fresh one, not build/mcde-root, where `make install' never removes the +# files of an older install -- and lists every file under dt/ that no PLIST names. +# Then: tools/mcde-plist.sh adds them from a build log, or add the lines by hand +# (sorted, ${PLIST.x} prefix for an option's files) and say it in the commit. +# +# What it compares, and why that is enough: +# - only dt/ (the prefix of the files MCDE installs); etc/ and var/ are placed by +# the recipe's own rules; +# - against BOTH PLISTs of the archive (pkgsrc/PLIST and pkgsrc-motif/PLIST): +# a native build makes its own Motif under dt/, which Makronix ships as +# x11/mcde-motif, straight into the prefix; the second PLIST is read as if its +# lines were under dt/; +# - shared libraries by name without the version (libtt.so.2.1.0 here, +# libtt.so.2.1 on NetBSD); +# - without the documentation (dt/man, dt/share/man): the recipe builds with +# PKG_OPTIONS.cde= -docs (tools/pkgsrc-cross.mk.conf:238); +# - without dt/CONTRIBUTORS, COPYING, HISTORY and README.md: the recipe's +# post-install moves them to share/doc/${PKGBASE} (the .for loop there). +# The other direction (a PLIST line that nothing installs here) is not checked: +# the options (nls, pam, appbuilder) and the platform decide those. +# +# Exit status 0: nothing missing; 1: files missing from the PLIST; 2: no build. + +set -u + +TOP=$(cd "$(dirname "$0")/.." && pwd) +B=$TOP/build/mcde-linux +R=$TOP/build/mcde-root # the prefix mcde-linux.sh configures: $R/dt +PLIST=${1:-$TOP/ext/src/mcde/pkgsrc/PLIST} +MOTIF=$TOP/ext/src/mcde/pkgsrc-motif/PLIST + +[ -f "$B/config.status" ] || + { echo "mcde-plist-check: no native build in $B: make mcde-linux MCDE_DIRS=install" >&2; exit 2; } +[ -f "$PLIST" ] || { echo "mcde-plist-check: no $PLIST" >&2; exit 2; } + +tmp=$(mktemp -d "${TMPDIR:-/tmp}/mcde-plist.XXXXXX") || exit 2 +trap 'rm -rf "$tmp"' EXIT HUP INT TERM + +# a path as it is compared: the version of a library left out +norm() +{ + sed -E 's#^(dt/lib/lib[A-Za-z0-9_+-]+)\.(so(\.[0-9]+)*|a|la)$#\1#' | + LC_ALL=C sort -u +} + +# the lines of a PLIST that name files: no @ lines, no comments, the +# ${PLIST.x} prefix of an option's line taken off +plist_lines() +{ + [ -f "$1" ] && + sed -e '/^@/d' -e '/^#/d' -e 's/^\${PLIST\.[a-z0-9]*}//' "$1" +} + +# what the PLISTs name under dt/. MCDE's own: the lines that start with dt/. +# The Motif of x11/mcde-motif goes straight into the prefix (include/Xm/Xm.h, +# lib/libXm.so), the private Motif of a native build into dt/ (dt/include/Xm/ +# Xm.h): its lines are put under dt/ to be compared. +plist_files() +{ + plist_lines "$1" | sed -n '/^dt\//p' + plist_lines "$2" | sed 's#^#dt/#' +} + +# the files a fresh install puts under dt/ +if ! make -C "$B" install DESTDIR="$tmp/root" > "$tmp/install.log" 2>&1; then + echo "mcde-plist-check: make install into a temporary directory failed:" >&2 + tail -5 "$tmp/install.log" >&2 + exit 2 +fi +( cd "$tmp/root$R" && find dt \( -type f -o -type l \) ) | + grep -v -E '^dt/((share/)?man(/|$)|(CONTRIBUTORS|COPYING|HISTORY|README\.md)$)' | + norm > "$tmp/installed" +plist_files "$PLIST" "$MOTIF" | norm > "$tmp/listed" + +LC_ALL=C comm -23 "$tmp/installed" "$tmp/listed" > "$tmp/missing" +n=$(wc -l < "$tmp/missing" | tr -d ' ') +echo "mcde-plist-check: $(wc -l < "$tmp/installed" | tr -d ' ') installed names under dt/, $(wc -l < "$tmp/listed" | tr -d ' ') in the PLISTs" +if [ "$n" -ne 0 ]; then + sed 's|^|mcde-plist-check: not in the PLIST: |' "$tmp/missing" + echo "mcde-plist-check: $n file(s) installed and not in $PLIST" + exit 1 +fi +echo "mcde-plist-check: ok" +exit 0