Files
makronix/tools/ext-sync.sh
T
lotherk bfb8f1a32e source set: one tree, usr/src, the whole repository
The source medium carried six sets: NetBSD's src, gnusrc, syssrc and
sharesrc at /usr/src, xsrc at /usr/xsrc and msrc at /usr/msrc.  Makronix is
one tree, so there is one set now: src.tgz, unpacked to /usr/src, with the
repository as it is -- src/, xsrc/, ext/, pkgsrc/, mobile/, www/, docs/,
tools/, the root files, PINS, packages.list, distfiles.lst and distfiles/
(only the archives of the Makronix packages).

- makesrctars -m packs the staged tree as usr/src and skips the split sets.
  It keeps the modes and the links of the repository (pkgsrc and tools run
  their scripts directly); build.sh gets the directory as MAKROSRCDIR.
- tools/srctree-stage.sh replaces tools/msrc-stage.sh.  It copies git's file
  list of the root repository and of pkgsrc (tracked files plus the untracked
  Makronix recipes: AGENTS.md, wm/mcde, x11/mcde-motif,
  filesystems/afpfs-ng), stages the distfiles, and puts the pkgsrc patch
  names that ustar cannot store into pkgsrc-longnames.cpio.
- makesrctars removes source sets of the old layout from
  RELEASEDIR/source/sets before it writes, so no stale gnusrc/msrc/xsrc can
  travel on a medium.

Measured: tools/srctree-stage.sh -> 462655 entries, 11 GB, 214 names in
pkgsrc-longnames.cpio; make sourcesets verified distfiles.lst (2010 archives,
0 missing, 0 wrong hash) and wrote RELEASEDIR/source/sets/src.tgz
(build/logs/sourcesets-2026-11-15.log).

The installer side is not in this commit: it is being changed in the same
tree by the sysinst profile work (tasksd t0260) -- one SET_SRC, the long-name
extraction from /usr/src/pkgsrc, the messages and sysinst.8.
docs/OFFLINE-BUILD.md, docs/BUILD-VM.md, docs/LICENSES.md and GOAL.md
describe the one tree.
2026-11-15 21:45:20 +00:00

48 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
#
# ext-sync.sh -- put the recipes of ext/ into the pkgsrc tree
#
# usage: tools/ext-sync.sh [PKGSRCDIR]
#
# A fork under ext/src/<name>/ (ext/AGENTS.md) keeps its pkgsrc recipe in
# ext/src/<name>/pkgsrc/. pkgsrc builds a recipe only from inside its tree
# (the recipe includes ../../mk/bsd.pkg.mk), so this copies it to
# PKGSRCDIR/<category>/<name>, the category being the first word of the
# recipe's CATEGORIES -- the way an owned copy is kept in this tree.
# PKGSRCDIR defaults to pkgsrc/ of this tree.
#
# A copy, not a link: the source set and the VM need real files. The
# target is only ever replaced when upstream pkgsrc does not own that path
# (`git ls-files' of the pkgsrc import is empty for it): an upstream package
# of the same name is never overwritten.
set -eu
TOP=$(cd "$(dirname "$0")/.." && pwd)
PKGSRCDIR=${1:-$TOP/pkgsrc}
# ext/src/<name>/pkgsrc is <category>/<name>; a second package from the same
# tree, ext/src/<name>/pkgsrc-<part>, is <category>/<name>-<part> (MCDE's
# Motif: ext/src/mcde/pkgsrc-motif, x11/mcde-motif)
for recipe in "$TOP"/ext/src/*/pkgsrc "$TOP"/ext/src/*/pkgsrc-*; do
[ -f "$recipe/Makefile" ] || continue
name=$(basename "$(dirname "$recipe")")
case ${recipe##*/} in
pkgsrc-*) name=$name-${recipe##*/pkgsrc-} ;;
esac
cat=$(sed -n 's/^CATEGORIES=[[:space:]]*\([^[:space:]]*\).*/\1/p' \
"$recipe/Makefile")
[ -n "$cat" ] || { echo "ext-sync: no CATEGORIES in $recipe/Makefile" >&2; exit 1; }
dst=$PKGSRCDIR/$cat/$name
if [ -d "$PKGSRCDIR/.git" ] &&
[ -n "$(git -C "$PKGSRCDIR" ls-files -- "$cat/$name" | head -1)" ]; then
echo "ext-sync: $cat/$name belongs to upstream pkgsrc, not replaced" >&2
exit 1
fi
rm -rf "$dst"
mkdir -p "$dst"
(cd "$recipe" && tar -cf - .) | (cd "$dst" && tar -xf -)
echo "ext-sync: $cat/$name"
done