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.
This commit is contained in:
lotherk committed 2026-11-15 21:45:20 +00:00
1 parent 079330f37d
commit bfb8f1a32e
13 files changed
+216 -180

No files matched your search

+8 -10
View File
@@ -65,14 +65,11 @@ Zielplatte. Der Stand heute ist in `AGENTS.md` beschrieben.
## Der Selbstbau: das Source-Set
Makronix kann sich 100 % offline selbst bauen. Dafür trägt das Medium die
Quellen mit:
- NetBSD-`src` über die vorhandenen Source-Sets von NetBSD
(`makesrctars`: `src`, `gnusrc`, `syssrc`, `sharesrc`). Dazu `xsrc` (wieder
seit 2026-11-13, siehe "X wieder in der Basis").
- Ein eigenes Set (Arbeitsname `msrc`) mit allem, was NetBSD nicht
abdeckt: `pkgsrc`, `tools`, `Makefile`, `docs`, die Distfiles und
eine Datei mit den Pins.
Quellen mit: ein einziges Set `src`, das den ganzen Repo-Baum nach `/usr/src`
auspackt -- `src/`, `xsrc/`, `ext/` (die Forks samt Rezepten), `pkgsrc/`,
`mobile/`, `www/`, `docs/`, `tools/`, die Wurzeldateien, die Pins und die
Distfiles. Ein zweiter Baum (`/usr/xsrc`, `/usr/msrc`) und ein zweites Set
gibt es nicht mehr (Konrad, 2026-11-15).
- Die Distfiles sind nur die, die zu Makronix gehören (die `makronix`-
Paketliste), nicht der ganze pkgsrc-Bestand.
- Das Source-Set ist in sysinst wie alles andere standardmäßig ausgewählt.
@@ -122,9 +119,10 @@ Repos, je eine im Root von `src` und `pkgsrc` und je eine in den 21
obersten Verzeichnissen von `src`; seit `src/` getrackt ist, sind sie Teil des
Baums, kein Beiwerk.
Offen:
Entschieden (Konrad, 2026-11-15): das Source-Set heißt `src`, ist ein einziger
Baum und liegt in `/usr/src`; kein `/usr/xsrc`, kein `/usr/msrc`.
- Endgültiger Name des Source-Sets (`msrc` oder anders).
Offen: nichts zum Source-Set.
Geklärt (2026-11-14, gelesen und im VM-Test belegt): wie ein verschlüsselter
Root unter EFI mit dem NetBSD-Standard startet. Der EFI-Loader nimmt als
+9 -9
View File
@@ -37,8 +37,8 @@ BUILD_SH := cd $(SRC) && ./build.sh \
.PHONY: all build release install tools kernel clean-sanity stamp test compress \
iso sourcesets isosrc cdtest userland usb mcde-linux mcde-host
# Where tools/msrc-stage.sh assembles the msrc set.
SRCSTAGE := $(TOP)/build/msrc
# Where tools/srctree-stage.sh assembles the source tree (one set, /usr/src).
SRCSTAGE := $(TOP)/build/srctree
# Before every build: drop the derived artefacts whose content depends on the
# sources. Without this, an incremental run keeps an old INSTALL ramdisk and
@@ -98,18 +98,18 @@ test:
@tools/test-tools.sh
@tools/test.sh
# The source sets, RELEASEDIR/source/sets: NetBSD's own (src, gnusrc, syssrc,
# sharesrc: `build.sh sourcesets', src/BUILDING) and msrc, which carries the
# rest a system needs to rebuild itself offline -- pkgsrc, tools, the Makefile,
# docs, the archives of the Makronix packages only, and the pins (tools/
# msrc-stage.sh, patch 0010 for makesrctars -m). Needs the distfiles
# The source set, RELEASEDIR/source/sets/src.tgz: the whole repository as one
# tree that unpacks to /usr/src -- src/, xsrc/, ext/, pkgsrc/, mobile/, tools/,
# docs/, the pins and the archives of the Makronix packages only
# (tools/srctree-stage.sh, makesrctars -m). It replaces NetBSD's split source
# sets; there is no /usr/xsrc and no /usr/msrc any more. Needs the distfiles
# (tools/makronix-distfiles.sh fetch).
sourcesets:
tools/makronix-pins.sh check
tools/makronix-distfiles.sh verify
tools/makronix-distfiles.sh check
tools/msrc-stage.sh $(SRCSTAGE)
$(BUILD_SH) -V MSRCDIR=$(SRCSTAGE) -V MAKESRCTARS_KEEPGIT=yes sourcesets
tools/srctree-stage.sh $(SRCSTAGE)
$(BUILD_SH) -V MAKROSRCDIR=$(SRCSTAGE) sourcesets
# The DVD that carries the source sets too (distrib/common/Makefile.bootcd:
# CDSOURCE copies RELEASEDIR/source onto the medium). A CD does not hold them,
+2 -2
View File
@@ -80,7 +80,7 @@ is for testing/install proof, not for building (Root-`AGENTS.md`, 2026-11-13).
line can be limited to one platform with `@ARCH`; read by `tools/pkglist.sh`).
- Not done yet: the binary directory is not put on a medium; the sizes say
the DVD, not CD 2. The binaries are not covered by the offline rebuild (no
sources in `msrc`): Makronix rebuilds itself, not Firefox. The version
sources of them in the source set): Makronix rebuilds itself, not Firefox. The version
of the branch (2026Q3) is not the version of the pinned pkgsrc tree
(`git-base` is 2.55.0 there and 2.56.0 in the VM's build); mixing the two in
one `/usr/pkg` is possible only where their dependency versions agree.
@@ -125,7 +125,7 @@ tooldir and object files on the local disk, sources from the share):
What follows for the work: **edit through the share, build from a local copy.**
`tools/` and `docs/` are small and read warm; `src/` and `pkgsrc/` are built
from the VM's own disk (`/usr/src`, `/usr/msrc`).
from the VM's own disk (`/usr/src`, the whole tree).
### How it is set up
+5 -5
View File
@@ -33,9 +33,9 @@ they already had.
## Source set and installed system (status 2026-11-15, tasksd t0233)
The `msrc` source set (assembled by `tools/msrc-stage.sh`) now carries
`LICENSE`, `GOAL.md`, `AGENTS.md`, `ROADMAP.md` and `ISSUES.md` at its root
(`/usr/msrc/` when unpacked), so a system rebuilt from the source set has the
The source set (assembled by `tools/srctree-stage.sh`) carries `LICENSE`,
`GOAL.md`, `AGENTS.md`, `ROADMAP.md` and `ISSUES.md` at its root
(`/usr/src/` when unpacked), so a system rebuilt from the source set has the
CNCL text and the project documents.
On an installed system the CNCL text is installed as
@@ -43,5 +43,5 @@ On an installed system the CNCL text is installed as
built via `src/share/doc/makronix/Makefile` and listed in
`src/distrib/sets/lists/base/mi`). A banner/motd reference was not added.
**Still open:** regenerate/verify a fresh `msrc` source set so
`tar -tzf msrc.tgz` contains `usr/msrc/LICENSE` (and the other root docs).
**Still open:** regenerate/verify a fresh source set so
`tar -tzf src.tgz` contains `usr/src/LICENSE` (and the other root docs).
+37 -19
View File
@@ -1,28 +1,29 @@
# Rebuilding Makronix without a network
What the source sets are, where they land, and what is and is not proven.
What the source set is, where it lands, and what is and is not proven.
## The sets
## The set
`make sourcesets` writes `RELEASEDIR/source/sets/`:
`make sourcesets` writes one set, `RELEASEDIR/source/sets/src.tgz`:
| set | unpacks to | what |
|---|---|---|
| `src`, `gnusrc`, `syssrc`, `sharesrc` | `/usr/src` | Makronix's NetBSD tree (base `src/BASE`), as it is in the repository; no `.git` |
| `msrc` | `/usr/msrc` | the Makronix tree: `Makefile`, `GOAL.md`, `AGENTS.md`, `docs/`, `tools/`, `packages.list`, `PINS`, `distfiles.lst`, `pkgsrc/` (pinned checkout with `.git`), `distfiles/` (only the archives of Makronix packages), and the link `src -> /usr/src` |
| `src` | `/usr/src` | the whole repository: `src/`, `xsrc/`, `ext/`, `pkgsrc/` (the pinned checkout), `mobile/`, `www/`, `docs/`, `tools/`, the root files, `packages.list`, `PINS`, `distfiles.lst`, and `distfiles/` (only the archives of the Makronix packages) |
The first four come from NetBSD's `makesrctars`; `msrc` from the same
command (`-m`, patch 0010), assembled by `tools/msrc-stage.sh`. `src/` is
tracked in the development repository, so the source sets carry the files a
rebuild needs, not the history; `pkgsrc/` still carries its own `.git`.
`tools/makronix-pins.sh check` compares `PINS` with
the repositories.
There is no second tree and no second set: `xsrc/` is part of the repository,
and `/usr/msrc` is gone. The set comes from NetBSD's `makesrctars`
(`-m`, `src/distrib/sets/makesrctars`) and is assembled by
`tools/srctree-stage.sh`, which copies git's file list of the root repository
and of `pkgsrc/` from the working tree. It carries the files a rebuild needs,
not the history: no `.git` anywhere, no `build/`, and of `refs/` only
`refs/AGENTS.md` (the reference checkouts are not build inputs).
`tools/makronix-pins.sh check` compares `PINS` with the repositories.
The sets are `.tgz` (`makesrctars`), about 2.3 GB together with the git
repositories: they fit a DVD, not a CD. `make isosrc` writes the DVD with
The set is one `.tgz` (`makesrctars`). `make isosrc` writes the DVD with
`RELEASEDIR/source` on it (`CDSOURCE`, `distrib/common/Makefile.bootcd`); the
CD does not carry them. sysinst installs the source sets that the medium
carries in the simple mode, and skips silently those it does not.
CD does not carry it. sysinst installs the source set when the medium carries
it and the installation asks for it (the simple mode selects it by default; a
medium without the set installs no sources). The size is measured below.
## Which distfiles
@@ -40,9 +41,9 @@ cross build), and it includes packages that the base system satisfies.
## What to do on the installed system
# as root; the sets are unpacked by sysinst or with tar -xzpf -C /
cd /usr/msrc
export MAKRONIX_TOP=/usr/msrc
# as root; the set is unpacked by sysinst or with tar -xzpf -C /
cd /usr/src
export MAKRONIX_TOP=/usr/src
`tools/pkgsrc-cross.mk.conf` takes its paths from `MAKRONIX_TOP` and uses
`distfiles/` when it exists. git needs `safe.directory` for trees owned by
@@ -55,12 +56,29 @@ See the end of this file; the measurements are in `build/logs/`.
(filled in by the tests: nothing below this line is a claim until it names a
log)
### Measured 2026-11-15: the one source set
- `tools/srctree-stage.sh build/srctree`: 462655 entries, 11 GB, 214 patch
names in `pkgsrc-longnames.cpio`; no `.git`, no `build/`.
- `make sourcesets` (32 min): `distfiles.lst` verified against the recipes
(2010 archives, 0 missing, 0 with a wrong hash) and
`RELEASEDIR/source/sets/src.tgz` written, 5.5 GB; size and hashes are in
`build/logs/sourcesets-2026-11-15.log` and `RELEASEDIR/source/sets/SHA512`.
The target removed the sets of the old layout before it wrote.
- Not a single-layer DVD: 5.5 GB fits a dual-layer DVD (8.5 GB) together
with the install sets, not a DVD-5. The old split sets were 5.6 GB
together, so this is not bigger than before.
- Not proven: an installation from this set and `make release` inside it
(that is `tasksd t0050`).
### Measured 2026-11-07
- The DVD made by `make isosrc` installs `/usr/src` and `/usr/msrc` (with
`PINS`, `pkgsrc`, and all 71 distfiles of `distfiles.lst`);
`PINS` names the overlay base of the tree it was made from:
`build/logs/install-src-cd13-2026-11-07.log` (all checks PASS).
`build/logs/install-src-cd13-2026-11-07.log` (all checks PASS). This was
measured with the split sets (src, gnusrc, syssrc, sharesrc, msrc); since
2026-11-15 there is one `/usr/src` and no `/usr/msrc` (above).
- Not proven yet: that a system installed this way rebuilds itself with no
network. That is done in the build VM (see `docs/BUILD-VM.md`).
+10 -4
View File
@@ -48,11 +48,13 @@ MAKETARS_FLAGS=
.if ${MKREPRO_TIMESTAMP:Uno} != "no"
MAKETARS_FLAGS+= -T "${MKREPRO_TIMESTAMP}"
.endif
.if ${MKX11} != "no"
# The Makronix tree is one set (usr/src): src/, xsrc/, ext/, pkgsrc/, ... .
# When MAKROSRCDIR is given there is no separate xsrc set.
.if ${MKX11} != "no" && !defined(MAKROSRCDIR)
MAKESRCTARS_X11_FLAGS= -x ${X11SRCDIR}
.endif
.if defined(MSRCDIR)
MAKESRCTARS_MSRC_FLAGS= -m ${MSRCDIR}
.if defined(MAKROSRCDIR)
MAKESRCTARS_MAKRO_FLAGS= -m ${MAKROSRCDIR}
.endif
.if ${MKX11} != "no"
MAKEFLIST_X11_FLAGS= ,x
@@ -251,10 +253,14 @@ do-${tar}: .PHONY sanitise_METALOG
makesrctars: .PRECIOUS .PHONY check_RELEASEDIR
${_MKMSG_CREATE} "source tar files"
# One set is made (Makronix: src.tgz, the whole tree); sets of an
# earlier layout (gnusrc, msrc, xsrc, ...) must not survive, or the
# medium would carry them and the installer would offer them.
rm -f ${SOURCETARDIR}/*.tgz
mkdir -p ${SOURCETARDIR}
${SETSCMD} ./makesrctars ${MAKESRCTARS_FLAGS} \
${MAKESRCTARS_X11_FLAGS} \
${MAKESRCTARS_MSRC_FLAGS} \
${MAKESRCTARS_MAKRO_FLAGS} \
${NETBSDSRCDIR} ${SOURCETARDIR}
+30 -22
View File
@@ -12,7 +12,7 @@ rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
# set defaults
xsrcdir=
msrcdir=
makrosrcdir=
keepgit=false
keeplinks=false
quiet=false
@@ -23,11 +23,14 @@ export GZIP
usage()
{
cat 1>&2 <<USAGE
Usage: ${prog} [-N password/group dir] [-g] [-m msrcdir] [-q] [-x xsrcdir] srcdir setdir
Usage: ${prog} [-N password/group dir] [-g] [-m makrosrcdir] [-q] [-x xsrcdir] srcdir setdir
-N dir location which contains master.passwd and group files
(defaults to \${srcdir}/etc)
-g keep the .git directory of each tree in its set
-m msrcdir build msrc.tgz from msrcdir
-m makrosrcdir build src.tgz from the whole Makronix tree in
makrosrcdir: it unpacks to usr/src and carries src/,
xsrc/, ext/, pkgsrc/, mobile/, tools/, docs/ and the
archives. This replaces the split NetBSD source sets.
-q quiet operation
-x xsrcdir build xsrc.tgz from xsrcdir
srcdir location of sources
@@ -50,7 +53,7 @@ while getopts N:gm:qx: ch; do
keepgit=true
;;
m)
msrcdir="${OPTARG}"
makrosrcdir="${OPTARG}"
;;
q)
quiet=true
@@ -102,15 +105,16 @@ makeset()
printf "obj\n./.git\n./.hg\n" > "${intmp}"
fi
# Symbolic links are dropped (the spec has no link target) unless the
# set asks for them: msrc has src and xsrc pointing to /usr/src
# and /usr/xsrc.
# set asks for them: the Makronix tree keeps every link of the
# repository.
mtreekw=type
droplinks='type=link'
if ${keeplinks}; then
# msrc: pkgsrc is not NetBSD's src, where every file is 0664 and
# the scripts that matter are run as `sh script'. pkgsrc runs
# bootstrap, configure and mk/scripts/* directly: keep the modes
# of the tree (git records 0644 and 0755), see fixmodes.
# The Makronix tree is not NetBSD's src, where every file is 0664
# and the scripts that matter are run as `sh script'. pkgsrc and
# tools/ run bootstrap, configure and their scripts directly:
# keep the modes and the links of the tree (git records 0644 and
# 0755), see fixmodes.
mtreekw=type,link,mode
droplinks='^$'
fi
@@ -140,6 +144,22 @@ makeset()
)}
# The Makronix tree: one set, usr/src, the repository as it is -- src/,
# xsrc/, ext/, pkgsrc/, mobile/, tools/, docs/ and the archives of its
# packages. It replaces NetBSD's split source sets: there is no second tree
# at /usr/xsrc and no /usr/msrc any more (Konrad, 2026-11-15).
#
if [ -n "${makrosrcdir}" ]; then
if ! cd "${makrosrcdir}"; then
echo >&2 "${prog}: can't chdir to ${makrosrcdir}"
exit 1
fi
srcprefix=usr/src
export setdir MTREE PAX CKSUM GZIP PASSWD srcprefix
keeplinks=true
makeset src .
else
# create (base)src sets
#
@@ -171,18 +191,6 @@ if [ -n "${xsrcdir}" ]; then
makeset xsrc .
fi
# create the msrc source set (the rest of what the system needs to
# rebuild itself: pkgsrc, patches, tools, the archives of its packages)
#
if [ -n "${msrcdir}" ]; then
if ! cd "${msrcdir}"; then
echo >&2 "${prog}: can't chdir to ${msrcdir}"
exit 1
fi
srcprefix=usr/msrc
keeplinks=true
makeset msrc .
fi
+1 -1
View File
@@ -12,7 +12,7 @@
# 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 (msrc) and the VM need real files. The
# 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.
+1 -1
View File
@@ -13,7 +13,7 @@
# makronix-distfiles.sh check verify build/distfiles
# makronix-distfiles.sh stage DIR put them into DIR/distfiles/
#
# The source set (msrc) lets the system rebuild itself offline, so it
# The source set lets the system rebuild itself offline, so it
# carries the archives pkgsrc would download -- but the shared DISTDIR
# (tools/pkgsrc-cross.mk.conf) holds everything ever built on this host, in
# several versions, partly unpacked. What is not Makronix's does not belong on
+1 -1
View File
@@ -7,7 +7,7 @@
#
# src/ and xsrc/ are tracked in this repository; their upstream bases are
# src/BASE and xsrc/BASE (the NetBSD commits the forks started from). pkgsrc is still its own repository.
# PINS goes into the msrc source set, so a system rebuilt from the set knows
# PINS goes into the source set, so a system rebuilt from the set knows
# what it was built from.
set -u
-105
View File
@@ -1,105 +0,0 @@
#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
# msrc-stage.sh -- assemble what the msrc set carries.
#
# usage: msrc-stage.sh DIR
#
# DIR becomes the root of the set: makesrctars -m DIR packs it as
# usr/msrc/... (src/distrib/sets/makesrctars, the same way src becomes
# usr/src). What the set is for: a Makronix that rebuilds itself without a
# network. NetBSD's own source sets carry src/ (with its tools); this one
# carries the rest:
#
# Makefile GOAL.md AGENTS.md docs/ tools/ the Makronix repository itself
# packages.list PINS distfiles.lst the packages, the commits, the archives
# pkgsrc/ the pinned checkout, with its .git
# distfiles/ only the archives of distfiles.lst
# src -> /usr/src the layout of the development tree,
# pointing at where the src set lands
#
# There is no `.git` for the Makronix tree in the set: `src/` is tracked in
# the development repository, and the set carries the files a rebuild needs,
# not the history. Everything is a real file, a hard link (pkgsrc, distfiles:
# no copy is made here) or the link; the set keeps links (makesrctars -m).
# Refuses a pkgsrc that has local edits, a stale PINS, and distfiles that are
# not complete.
set -eu
TOP=$(cd "$(dirname "$0")/.." && pwd)
[ $# -eq 1 ] || { echo "usage: $0 DIR" >&2; exit 1; }
DIR=$1
die()
{
echo "msrc-stage: $*" >&2
exit 1
}
"$TOP/tools/makronix-pins.sh" check || die "PINS is stale"
# pkgsrc must be what the pin says, with nothing changed (our AGENTS.md at its
# root is untracked on purpose)
[ -z "$(git -C "$TOP/pkgsrc" status --porcelain --untracked-files=no)" ] \
|| die "pkgsrc has local edits; the set carries the pinned commit"
rm -rf "$DIR"
mkdir -p "$DIR"
for f in Makefile GOAL.md AGENTS.md LICENSE ROADMAP.md ISSUES.md packages.list PINS distfiles.lst .gitignore; do
cp -p "$TOP/$f" "$DIR/$f"
done
for d in docs tools; do
cp -Rp "$TOP/$d" "$DIR/$d"
done
# ext/: the forks (MCDE, afpfs-ng) and their recipes. Without the tree an
# offline system could not rebuild a fork from its archive, and the recipe of a
# built package would be missing (t0071). Hard links, like pkgsrc below.
cp -al "$TOP/ext" "$DIR/ext" 2>/dev/null || cp -Rp "$TOP/ext" "$DIR/ext"
# pkgsrc with its .git: hard links, not a second 1 GB
cp -al "$TOP/pkgsrc" "$DIR/pkgsrc" 2>/dev/null || cp -Rp "$TOP/pkgsrc" "$DIR/pkgsrc"
# ustar is the format of every set, and the installer's tar (bin/pax built
# -DSMALL -DNO_CPIO, distrib/amd64/ramdisks) reads nothing else: a pathname is
# stored only if its last component has at most 100 characters and the
# directory part at most 155 (pax(1), -x ustar). pax drops the rest and the
# set is still made, exit 0: 235 patch files of eleven packages (www/firefox,
# mail/thunderbird, devel/bazel ...) on 2026-11-14
# (build/logs/sourcesets-2026-11-14b.log). pkgsrc names a patch after the file
# it patches and records the name in distinfo, so the files cannot be renamed.
# They go into pkgsrc-longnames.cpio instead (cpio has no such limit; the
# installed system's pax reads it, only the installer's does not): the files
# are taken out of the ustar tree, and the installation puts them back
# (sysinst setup.c: `pax -r -pp -f pkgsrc-longnames.cpio` in usr/msrc/pkgsrc).
# Konrad, 2026-11-14: the sources of every package Makronix uses as a binary
# are in the set, among them Firefox and Thunderbird, so they must be whole.
PAX=$(ls "$TOP"/build/obj/tooldir.*/bin/nbpax 2>/dev/null | head -1)
[ -x "$PAX" ] || PAX=pax
(cd "$DIR/pkgsrc" && find . -path ./.git -prune -o -type f -print | sed 's|^\./||') |
awk '{
full = "usr/msrc/pkgsrc/" $0
n = split(full, c, "/"); last = c[n]
dir = substr(full, 1, length(full) - length(last) - 1)
if (length(last) > 100 || length(dir) > 155)
print $0
}' | LC_ALL=C sort > "$DIR/pkgsrc-longnames.txt"
if [ -s "$DIR/pkgsrc-longnames.txt" ]; then
(cd "$DIR/pkgsrc" && "$PAX" -w -x cpio -d < "$DIR/pkgsrc-longnames.txt") \
> "$DIR/pkgsrc-longnames.cpio" || die "pax -x cpio failed"
while read -r f; do
rm -f "$DIR/pkgsrc/$f"
done < "$DIR/pkgsrc-longnames.txt"
echo "msrc-stage: $(wc -l < "$DIR/pkgsrc-longnames.txt" | tr -d ' ') files with names ustar cannot store are in pkgsrc-longnames.cpio"
else
rm -f "$DIR/pkgsrc-longnames.txt"
fi
ln -s /usr/src "$DIR/src"
"$TOP/tools/makronix-distfiles.sh" stage "$DIR"
echo "msrc-stage: $DIR ready: $(find "$DIR" | wc -l | tr -d ' ') entries," \
"$(du -sh "$DIR" | cut -f1)"
+1 -1
View File
@@ -4,7 +4,7 @@
# MAKRONIX_TOP is the root of the Makronix tree and must be in the environment
# of every bootstrap and package build (MAKRONIX_TOP=$PWD bmake ...): the paths
# below follow it, so the same file serves the development tree and the tree
# the source set unpacks to (/usr/msrc). Before 2026-11-06 they were
# the source set unpacks to (/usr/src). Before 2026-11-06 they were
# absolute paths of the development machine.
#
# Used as a mk-fragment (bootstrap --mk-fragment), so it ends up in the
+111
View File
@@ -0,0 +1,111 @@
#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
# srctree-stage.sh -- assemble the one source tree the source set carries.
#
# usage: srctree-stage.sh DIR
#
# DIR becomes the root of the set: makesrctars -m DIR packs it as
# usr/src/... (src/distrib/sets/makesrctars). That is the whole point: the
# set is the repository as it is, unpacked to /usr/src, so a Makronix system
# rebuilds itself from exactly the tree it was built from. There is no
# second tree at /usr/xsrc and no /usr/msrc any more (Konrad, 2026-11-15):
#
# src/ xsrc/ ext/ pkgsrc/ mobile/ www/ docs/ tools/ the repository
# Makefile GOAL.md AGENTS.md LICENSE ROADMAP.md ... its root files
# packages.list PINS distfiles.lst packages, pins, archives
# distfiles/ only the archives of
# distfiles.lst
#
# The file list is git's: every tracked file of the root repository and of
# pkgsrc (its own repository, pinned) is copied from the working tree, so a
# change that is not committed yet is in the set the running build uses. No
# .git and no build output is carried. refs/ is a set of reference
# checkouts (netbsd, linux, openbsd, 11 GB) and only its AGENTS.md is part of
# the tree a rebuild needs.
#
# Refuses a pkgsrc that has local edits, a stale PINS, and distfiles that are
# not complete. ustar limit: pkgsrc patch names longer than 100 characters
# (or 155 in the directory part) are not in the tree but in
# pkgsrc-longnames.cpio, which the installer puts back (sysinst setup.c).
set -eu
TOP=$(cd "$(dirname "$0")/.." && pwd)
[ $# -eq 1 ] || { echo "usage: $0 DIR" >&2; exit 1; }
DIR=$1
# absolute: the copy runs in subshells that change directory (pkgsrc/)
case $DIR in
/*) ;;
*) DIR=$(pwd)/$DIR ;;
esac
die()
{
echo "srctree-stage: $*" >&2
exit 1
}
"$TOP/tools/makronix-pins.sh" check || die "PINS is stale"
# pkgsrc must be what the pin says, with nothing changed (our AGENTS.md at its
# root is untracked on purpose)
[ -z "$(git -C "$TOP/pkgsrc" status --porcelain --untracked-files=no)" ] \
|| die "pkgsrc has local edits; the set carries the pinned commit"
# pax of the tooldir keeps the modes (0655 is wrong on scripts) and the links;
# the host's pax may not exist (the build host is Linux for the cross build).
PAX=$(ls "$TOP"/build/obj/tooldir.*/bin/nbpax 2>/dev/null | head -1)
[ -n "$PAX" ] && [ -x "$PAX" ] || PAX=pax
command -v "$PAX" >/dev/null 2>&1 || die "no pax (nbpax, or pax in PATH)"
rm -rf "$DIR"
mkdir -p "$DIR"
# The root repository, tracked files only, from the working tree.
(cd "$TOP" && git ls-files | grep -v '^refs/' ; echo refs/AGENTS.md) |
(cd "$TOP" && "$PAX" -rw -pm "$DIR") \
|| die "copying the repository into $DIR failed"
# pkgsrc: its own repository, pinned, plus what is ours and untracked there
# (AGENTS.md and the recipes of the Makronix packages, tools/ext-sync.sh copies
# them in; git ignores neither). build/ and other ignored work is not carried.
mkdir -p "$DIR/pkgsrc"
(cd "$TOP/pkgsrc" && git ls-files && git ls-files --others --exclude-standard) |
(cd "$TOP/pkgsrc" && "$PAX" -rw -pm "$DIR/pkgsrc") \
|| die "copying pkgsrc into $DIR/pkgsrc failed"
"$TOP/tools/makronix-distfiles.sh" stage "$DIR"
# ustar is the format of every set, and the installer's tar (bin/pax built
# -DSMALL -DNO_CPIO, distrib/amd64/ramdisks) reads nothing else: a pathname is
# stored only if its last component has at most 100 characters and the
# directory part at most 155 (pax(1), -x ustar). pax drops the rest and the
# set is still made, exit 0: 235 patch files of eleven packages (www/firefox,
# mail/thunderbird, devel/bazel ...) on 2026-11-14
# (build/logs/sourcesets-2026-11-14b.log). pkgsrc names a patch after the file
# it patches and records the name in distinfo, so the files cannot be renamed.
# They go into pkgsrc-longnames.cpio instead (cpio has no such limit; the
# installed system's pax reads it, only the installer's does not): the files
# are taken out of the ustar tree, and the installation puts them back
# (sysinst setup.c: `pax -r -pp -f pkgsrc-longnames.cpio` in usr/src/pkgsrc).
(cd "$DIR/pkgsrc" && find . -path ./.git -prune -o -type f -print | sed 's|^\./||') |
awk '{
full = "usr/src/pkgsrc/" $0
n = split(full, c, "/"); last = c[n]
dir = substr(full, 1, length(full) - length(last) - 1)
if (length(last) > 100 || length(dir) > 155)
print $0
}' | LC_ALL=C sort > "$DIR/pkgsrc-longnames.txt"
if [ -s "$DIR/pkgsrc-longnames.txt" ]; then
(cd "$DIR/pkgsrc" && "$PAX" -w -x cpio -d < "$DIR/pkgsrc-longnames.txt") \
> "$DIR/pkgsrc-longnames.cpio" || die "pax -x cpio failed"
while read -r f; do
rm -f "$DIR/pkgsrc/$f"
done < "$DIR/pkgsrc-longnames.txt"
echo "srctree-stage: $(wc -l < "$DIR/pkgsrc-longnames.txt" | tr -d ' ') files with names ustar cannot store are in pkgsrc-longnames.cpio"
fi
rm -f "$DIR/pkgsrc-longnames.txt"
echo "srctree-stage: $DIR ready: $(find "$DIR" | wc -l | tr -d ' ') entries," \
"$(du -sh "$DIR" | cut -f1)"