61 lines
2.1 KiB
Bash
61 lines
2.1 KiB
Bash
#!/bin/sh
|
|
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
#
|
|
# mcde-plist.sh -- put the files pkgsrc's PLIST check complains about into the
|
|
# PLIST of MCDE.
|
|
#
|
|
# usage: tools/mcde-plist.sh LOG
|
|
#
|
|
# When MCDE installs a file that ext/src/mcde/pkgsrc/PLIST does not list, the
|
|
# build stops with
|
|
#
|
|
# ERROR: The following files are in .../.destdir/usr/pkg but not in the PLIST:
|
|
# ERROR: .../.destdir/usr/pkg/dt/bin/dtnetutility
|
|
#
|
|
# (make userland stops there: build/logs/userland-2026-11-14p.log). This reads
|
|
# those lines from LOG, and puts each file into the PLIST at its place (the
|
|
# lines are sorted as `LC_ALL=C sort' sorts them; a line with a ${PLIST.x}
|
|
# prefix is compared without it). Nothing else in the PLIST changes. Look at
|
|
# `git diff' afterwards: a file that should not be installed at all is a bug of
|
|
# the program's Makefile.am, not a PLIST line.
|
|
#
|
|
# Then: tools/ext-sync.sh, and the build again (an install in pkgsrc/wm/mcde
|
|
# repeats only the install when the build is done).
|
|
|
|
set -eu
|
|
|
|
TOP=$(cd "$(dirname "$0")/.." && pwd)
|
|
PLIST=$TOP/ext/src/mcde/pkgsrc/PLIST
|
|
|
|
[ $# -eq 1 ] && [ -f "$1" ] || { echo "usage: ${0##*/} LOG" >&2; exit 2; }
|
|
|
|
tmp=${TMPDIR:-/tmp}/mcde-plist.$$
|
|
trap 'rm -f "$tmp".*' EXIT HUP INT TERM
|
|
|
|
# the files after "but not in the PLIST", relative to usr/pkg
|
|
sed -n '/but not in the PLIST:/,/^[^E]/p' "$1" | sed -n 's/^ERROR: *.*\.destdir\/usr\/pkg\///p' |
|
|
LC_ALL=C sort -u > "$tmp.new"
|
|
[ -s "$tmp.new" ] || { echo "mcde-plist: nothing to add in $1"; exit 0; }
|
|
|
|
# the PLIST and the new lines, merged by the name without the ${PLIST.x} prefix
|
|
awk -v new="$tmp.new" '
|
|
BEGIN {
|
|
while ((getline f < new) > 0) add[++n] = f
|
|
i = 1
|
|
}
|
|
{
|
|
name = $0
|
|
sub(/^\$\{PLIST\.[a-z]*\}/, "", name)
|
|
while (i <= n && add[i] < name && substr(name, 1, 1) != "@") {
|
|
print add[i]; i++
|
|
}
|
|
if (i <= n && add[i] == name) i++ # already there
|
|
print
|
|
}
|
|
END { while (i <= n) print add[i++] }
|
|
' "$PLIST" > "$tmp.plist"
|
|
|
|
added=$(( $(wc -l < "$tmp.plist") - $(wc -l < "$PLIST") ))
|
|
cat "$tmp.plist" > "$PLIST"
|
|
echo "mcde-plist: $added line(s) added to ${PLIST#$TOP/}"
|