Files
makronix/tools/mcde-plist-check.sh
lotherkandClaude Sonnet 5.5 044b50c69e 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 <noreply@anthropic.com>
2026-11-14 22:45:40 +00:00

100 lines
4.3 KiB
Bash
Executable File

#!/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