20 Commits
Author SHA1 Message Date
lotherkandClaude Sonnet 5.5 f5cb3e0048 pkgchroot: remove the mount points after the unmount
checkflist stopped the MacBook release with 105 extra files in DESTDIR: ./mnt/dev, ./mnt/pkgsrc,
./mnt/work ... (the sandbox's mount points), plus debris of earlier runs (a nested usr/src tree,
var/tmp/cwdtest*, dev/null, etc/usermgmt.conf), which were removed from build/obj by hand.
The mount points are rmdir'ed now, never rm -rf'ed: a mounted directory is not touched.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 09:14:56 +00:00
lotherkandClaude Sonnet 5.5 1e4ac1135c pkgchroot: the staleness key survives a recipe without options.mk
Under set -e the cat of the absent options.mk ended the key's group before the source id
was written: a commit in ext/src/mcde never changed the key, so the MacBook kept building
the old work directory (UilLexPars.h: File exists, three runs).  Optional files get '|| :';
find -L, because the recipe mirror is symlinks and PLIST/patches were not hashed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 07:04:11 +00:00
lotherkandClaude Sonnet 5.5 e2293a29c3 pkgchroot: a fork in the middle of the list was never seen as a fork
sandbox_stale matched " $(fork_recipes) " against " <path> ", but the list is one path per line,
so only the first and the last entry had a space on both sides.  x11/mcde-motif is not among
them: its source commit never reached the staleness key and a fix in ext/src/mcde was built
into the old work directory (MacBook 2026-11-24, UilLexPars.h: File exists, again).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 06:59:40 +00:00
lotherk 974603f8a6 pkgsrc: the forks of ext/ build from their tree, not from an archive
Each fork kept a recipe beside its source and a tarball in distfiles/ whose
distinfo had to be regenerated after every commit (tools/ext-dist.sh,
tools/mcde-dist.sh), and the work directory of a build could not see a later
commit at all (tools/ext-resync.sh merged an archive into it).  Three tools,
one artefact per fork in git, and the failure mode that cost the 2026-11-23
release: mcde 288d1383 built from the commit of the day before, because the
recipe's mtime said "not stale".

Now the recipe builds the source tree itself, which is how pkgsrc's own
net/fetch and pkgtools/pkg_install do it: DISTFILES= # empty, do-extract
fills WRKSRC.  What is gone with that:

  - the tarballs (distfiles/{mcde,splinter,junction,wikid,skilld,memoryd,
    tasksd}-*) and their .key
  - tools/ext-dist.sh, tools/mcde-dist.sh, tools/ext-resync.sh and its test
  - fork_archives in tools/makronix-distfiles.sh (nothing to fetch or stage)
  - the distinfo files of the eight recipes

What replaces it: tools/ext-extract.sh, called from do-extract.  It hashes
the tree, copies only the files that differ, keeps the time stamp of the rest
(so a commit rebuilds what it touched and not 27 minutes of MCDE) and
removes the copy when a file left the tree.  The build key of a fork carries
the source commit for the same reason: a commit does not change the recipe.

The recipes keep $Makronix$ as their header; afpfs-ng keeps its upstream
$NetBSD: ...$ line and its real distfile, and fork_src() leaves it alone.

Verified:
  - bmake package built all eight recipes from the tree with no distinfo:
    splinter, junction, wikid, skilld, memoryd, tasksd, mcde (16 MB), and
    mcde-motif's shared tree
  - tools/test-tools.sh: 38 ok, 0 bad (5 new cases for ext-extract.sh)
  - tools/makronix-distfiles.sh check: 0 missing, 0 wrong hash
  - tools/makronix-pins.sh check: PINS matches
2026-11-23 19:49:07 +00:00
lotherk 7388548136 pkgchroot: throw away a .destdir that no finished install left
pkgsrc removes DESTDIR on package-clean only; an install that died before
writing .install_done leaves the staging tree in place, and the next install
then fails on a file that is already there.  pkgconf's
'ln -s pkgconf .destdir/usr/pkg/bin/pkg-config: File exists' stopped
x11/mcde-motif and wm/mcde on the MacBook.

Test: with .build_done and no .install_done the .destdir is removed; with
.install_done it stays.  Both cases checked in a scratch tree.
2026-11-23 16:47:22 +00:00
lotherk 7f74532130 pkgchroot, userland: a repository package is built, not installed
In the chroot path every package of packages.list went through 'install',
which keeps an old registration and builds no archive: build/packages/All
held 64 packages and none of the five the media's repository names, so
make_repo said 'no package for: junction-0.1 wikid-0.1 ...' and the release
stopped.  The target is now per package, as the cross path already had it.

build-lock: the nested path (make release -> sourcesets -> build-lock) ran
sh -c without dropping MAKEFLAGS, so step 5 hit the same read-only
.MAKE.LEVEL.ENV as step 4 did.
2026-11-23 15:23:18 +00:00
lotherk 730d766943 pkgchroot: keep the binary package, the media repository is filled from it
install removes the .tgz again (_KEEP_BIN_PKGS defaults to no, and install
builds no package to begin with), so the MacBook's build/packages/All held
64 packages and none of the ones packages.list names as repo: make_repo had
nothing to copy and the release stopped there.
2026-11-23 14:21:17 +00:00
lotherk 8aef98293a pkgchroot: the build key is the recipe's content, not its mtime
The mtime test said nothing on the MacBook: a git checkout does not renew the
time of a file whose content changed in an earlier commit, so
/usr/src/pkgsrc/wm/mcde/Makefile kept 2026-11-22 10:27 after mcde 288d1383 was
checked out, and the work directory of 21:55 counted as newer.  The release
then installed the binary of the day before again (run f, 12:30: no rebuild).

sandbox_stale() now hashes what the build reads -- Makefile, options.mk,
patches, PLIST, distinfo (which tools/ext-dist.sh writes from the archive) --
and compares that with the key it stored after the last build.  A package
without a key is rebuilt once, which is the cost of the fix.

Test: key for wm/mcde computes (dc7b25d0...); dash -n; the release is not run
with it yet.
2026-11-23 12:33:33 +00:00
lotherk d300fc1329 release: a stale package work directory is rebuilt, not installed
Two bugs made the native release ship code from the day before:

- tools/pkgchroot.sh ran 'install' in a work directory pkgsrc had already
  built.  pkg_add printed 'already recorded as installed' and the step
  counted as done, so MCDE and splinter in the 2026-11-23e run were the
  binaries of 2026-11-22 21:39 while their distfiles were written 08:38
  (build/logs/release-2026-11-23e.log:30,44).  sandbox_stale() now drops a
  work directory that is older than its recipe, and the old registration
  goes with it -- the cross path in tools/userland.sh did that already.

- ensure_bootstrap returned at once for every mode but cross, so a fresh
  tree without build/pkg stopped in tools/makronix-set.sh (pkg_info) and in
  the reinstall logic (pkg_delete).  It now bootstraps in all three modes.

The target system needs none of it: /usr/bin/make and /usr/sbin/pkg_add are
in base-util-bin and base-pkgutil-bin.

Test: sandbox_stale() against a work directory dated 2026-11-22 21:39 and
the recipe of 2026-11-23 -- stale: removed; fresh: kept.  dash -n on both
scripts.  The release itself is not run yet.

ext/src/mcde 288d1383: dtphoto, one CMD_SHOWOPTIONS case
ext/src/splinter f7c374b: embed.c, <signal.h> for kill/SIGKILL
2026-11-23 11:41:40 +00:00
lotherkandClaude Sonnet 5.5 db91645aab pkgchroot.sh: cncl-1.0, Makronix's own licence, is acceptable
make release on the MacBook (build/logs/release-2026-11-23b.log): junction, wikid, skilld, memoryd, tasksd
'has an unacceptable license condition: cncl-1.0'.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 09:25:55 +00:00
lotherk a537a3b57d pkgchroot: force deinstalls, and `mount' keeps its mounts
Two bugs, both measured on 2026-11-22 while rebuilding wm/mcde:

1. `force' ran `clean' + `reinstall'.  reinstall is `install-clean
   install' (mk/install/deinstall.mk:50) and install-clean only removes
   state files, it does not deinstall.  So pkg_add saw the package
   already recorded, refused with "package `mcde-0.1.0' already
   recorded as installed" and returned 0 -- the sysroot kept the
   pre-fix binaries: dtphoto stayed at 15:15 while the binary package
   carried the 21:28 build.  pkgsrc documents the way itself in
   mk/install/install.mk:225: `make deinstall reinstall'.  `deinstall
   || true' because the package may not be installed yet.

2. sandbox_mount set `trap umount_all EXIT INT TERM HUP', so the
   `mount' subcommand unmounted everything again before the caller
   could use it, and still printed "pkgchroot: mounted".  The trap
   belongs to the modes that mount and work: build and force.

Test: `pkgchroot.sh mount' leaves 5 mounts standing and
/mnt/pkgsrc/wm/mcde is visible in the chroot; `pkgchroot.sh umount'
brings it back to 0.  `deinstall' in the chroot removed
/usr/pkg/dt/bin/dtphoto and deregistered mcde-0.1.0.
2026-11-22 21:56:11 +00:00
lotherk 691bf6e543 pkgchroot: the file index is rebuilt before any build
The by-file index beside the package database is a cache, and pkg_add trusts
it without checking the database: after a `force' run had removed packages,
it still named digest-20220214 as the owner of /usr/pkg/bin/digest -- a
package that was not registered and a file that did not exist.  pkg_add then
reported "digest-20220214: conflicting PLIST with digest-20220214: bin/digest"
against itself and would not install the tool, so every build that needed
something from the sysroot stopped.  Measured 2026-11-22: 45 packages were
left deleted, and none of them could be reinstalled.

sandbox_index() rebuilds the index from the +CONTENTS of the packages that
are registered, so it can only name packages that exist.  It runs at the end
of sandbox_mount(), before any build starts, and uses the sysroot's own
pkg_admin (/usr/sbin: the package tools are part of a base set since they
moved there), so the index format matches the pkg_add inside the chroot.

Measured: with the stale index, `tools/pkgchroot.sh force pkgtools/digest'
failed with the self-conflict above; after `pkg_admin -K ... rebuild' it
built and installed (rc=0, 14131 files from 86 packages).
2026-11-22 18:06:47 +00:00
lotherk 71ccd4b0b9 pkgchroot: force builds the package it was named, not its category
sandbox_run() assigned c=$1 and p=${1%/*} without local, so the second
sandbox_run in force's loop saw p=wm instead of p=wm/mcde: `pkgchroot force
wm/mcde` cleaned mcde and then ran `make -C /mnt/pkgsrc/wm reinstall`, a bulk
reinstall of every window manager in the category (measured 2026-11-22 on the
MacBook: after "Cleaning for mcde-0.1.0" it began to fetch 2bwm and afterstep).

The variables are prefixed (sr_path, sr_dir) so they cannot collide with a
caller's loop variable.

Measured: sh -n tools/pkgchroot.sh rc=0.
2026-11-22 11:29:52 +01:00
lotherk 11bf05e108 pkgchroot: force -- clean and reinstall when only the recipe changed
install sees the package already recorded in the sysroot and does nothing,
so a change that does not bump the version went into no build at all
(measured 2026-11-21: the System Settings change).  force throws the work
directory away and installs again.
2026-11-21 21:54:43 +01:00
lotherk 6ec89e2678 pkgchroot: docbook stylesheets from the local catalog
xmlto (a dependency of wm/mcde) resolves the stylesheet of its manual through
the URL in the XML PI, and a chroot without a route stopped with "failed to
load external entity http://docbook.sourceforge.net/release/xsl/current/
manpages/docbook.xsl" (measured 2026-11-21 on the MacBook).  docbook-xsl
ships the mapping in /usr/pkg/share/xsl/docbook/catalog.xml; XML_CATALOG_FILES
names it, so the build needs no network.
2026-11-21 09:17:16 +01:00
lotherk b08d9d2cbc pkgchroot: no PKG_PATH -- pkgsrc refuses to build with it
pkgsrc stops every package with "Please unset PKG_PATH before doing pkgsrc
work!" (measured 2026-11-21 on the MacBook).  Dependencies are built here
like every other package, natively in the sysroot.
2026-11-21 03:33:06 +01:00
lotherk fef02b7f3f pkgchroot/userland: a fresh way starts with fresh work directories and a repository
Two things the MacBook needed once its sysroot was empty:

- build/sandbox/work belongs to the way it was built like /usr/pkg does: a
  cross work directory says .depends_done and then installs a package whose
  dependencies this sysroot no longer has.  A change of way moves it aside.
- pkg_add inside the chroot had no PKG_PATH, so a dependency pkgsrc did not
  build stopped mcde-motif with "no pkg found for libXft>=2.3.8nb1".  The
  binary repository of the set is mounted at /mnt/repo and named in PKG_PATH
  (measured 2026-11-21).
2026-11-21 03:25:16 +01:00
lotherk f973adc406 pkgchroot: /sbin and /usr/sbin in PATH -- mount is there
A build started over ssh on the MacBook ran with a PATH without /sbin, and
every package stopped at "pkgchroot.sh: umount_all: mount: not found"
(measured 2026-11-21, build/logs/native-2026-11-21.log).
2026-11-21 02:04:14 +01:00
lotherk a4ea8fb56b release: a Makronix host builds the set in its own sysroot -- the first green release
build/obj/releasedir/amd64 with the sets is there, built on makronix-build by
/root/build-now.sh: fetch exit=0, userland exit=0, release exit=0
(build/logs/native-2026-11-20.log, 2026-11-21 01:32).

tools/userland.sh: on NetBSD the packages of the set are built in the sysroot,
natively (MODE=chroot, tools/pkgchroot.sh); on Linux pkgsrc cross-builds for
the same sysroot as before (MODE=cross).  Both fill destdir/usr/pkg and both
end in the same makronix set; the recipes know nothing of either.  In the
chroot the four forks built with no case for the host at all, where the cross
path had stopped on x11-links, the cross libtool, freetype and the host X
tools one after the other.

tools/makronix-set.sh, three things that only a release shows:

- ./usr/pkg itself is a METALOG record.  The prefix belongs to no package and
  the ancestor loop stops before it, so nbmtree stopped the distribution step
  with "./usr/pkg: missing directory in specification".
- What the set does not name, the sysroot does not keep.  A chroot build
  installs its build tools (perl, autoconf, ...) to build the set; the prune
  deregisters them and 526 of their files stayed (perl's cpan, perldoc, man
  pages), plus pkgdb.refcount.  checkflist counted every one as an extra file.
- ensure_pkgdb (pkg_admin -K db rebuild) runs for chroot too: a pkg_add that
  died leaves the by-file index claiming files nobody owns, and the next
  install of that package stops with "conflicting PLIST with libnbcompat".

tools/pkgchroot.sh: the sysroot's /dev and /mnt are tmpfs (the sets describe
those directories), pkgsrc, distfiles, work and packages are null mounts, and
WRKOBJDIR/PACKAGES/DISTDIR travel as make arguments -- the base bmake does not
read MAKECONF, and a mk.conf in the sysroot's /etc would be an extra file.
After the build the runtime state the packages leave behind is removed
(/var/cache, /var/dt, /var/spool/calendar, /tmp/dtinfogen-*, pkgdb.refcount);
none of it is in a base set.
2026-11-21 01:49:15 +01:00
lotherk 915fa8f763 userland: on Makronix the packages are built in the sysroot, natively
The packages of the makronix set are built for the target sysroot on every
host, but the way to build a Makronix program differs with the host, and that
difference belongs in the tools, not in recipes (AGENTS.md: cross and native
are one build):

  chroot  the host IS Makronix: tools/pkgchroot.sh chroots into
          build/obj/destdir.$ARCH and builds there with that system's
          compiler, libraries and package tools, into its /usr/pkg.  NetBSD
          builds its own packages this way.  Default on NetBSD.
  cross   the host is not Makronix (Linux): pkgsrc cross-builds for the same
          sysroot with this tree's toolchain (tools/pkgsrc-cross.mk.conf).

Measured 2026-11-20 on makronix-build, same tree, same four forks:

  cross: x11/mcde-motif and wm/mcde stopped one after the other on things
  that exist only because the build runs for a system it does not run on --
  pkgtools/x11-links with a doubled sysroot (7 instead of 111 pkg-config
  links, x11/libXft then "Package 'x11' not found"), the cross libtool
  writing .la dependencies as "=<work>/.buildlink/lib/libpng16.la", the base
  freetype 2.10.4 linked instead of the 2.15.0 pkgsrc builds, makestrs and
  tradcpp built for the target and run on the host.

  chroot: fuse-afpfs-ng, splinter, mcde-motif and mcde built with no case for
  the host at all (build/logs/pkgchroot-2026-11-20.log, 0 errors), the last
  two in 66 minutes including every dependency; /usr/pkg/dt/bin/dtfile in the
  sysroot, mcde-0.1.0.tgz in build/packages/All.

tools/pkgchroot.sh mounts the sysroot's /dev and /mnt as tmpfs (the sets
describe those directories; nothing of the build stays in them), the tree's
pkgsrc, distfiles, work and packages by null mount, and passes WRKOBJDIR,
PACKAGES and DISTDIR as make arguments -- the base bmake does not read
MAKECONF, and a mk.conf in the sysroot's /etc would be an extra file for
checkflist.  The binary packages of the set are still fetched (they are built
for the same NetBSD/x86_64), so only the four forks are built from source.
2026-11-20 22:06:03 +01:00