Commit Graph
12 Commits
Author SHA1 Message Date
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