build: build the ports in one tools step, not in chunks
Tools caches the build-only dependencies it builds (cmake, autoconf, the Rust and Go compilers) for the rest of a ports step only, and the packages set keeps just the listed ports and their runtime dependencies. Each chunk therefore rebuilt them: the second chunk started by rebuilding the autotools the first had built. The step also runs without an argument now: an argument makes tools stop at the first failed port, while without one it goes on with the others and fails at the end. ports_list served only the chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
52f795704a
commit
9eceff0663
2 changed files with 30 additions and 69 deletions
30
RELEASE.md
30
RELEASE.md
|
|
@ -170,8 +170,9 @@ release/vm.sh sync 14.3 # this repository (with .git) -> /usr/deps
|
|||
- **Setup:** `setup` installs git, python3 and rsync from the frozen package
|
||||
set of exactly that FreeBSD release.
|
||||
- **Restarts:** the VM does not start with the build host. After a reboot,
|
||||
`vm.sh start` it and run `build` again: finished sets are reused, and the
|
||||
ports are built in chunks (below), so at most one chunk is lost.
|
||||
`vm.sh start` it and run `build` again: finished sets are reused. The
|
||||
ports step writes its set only when it ends (below), so a reboot during
|
||||
it loses that run's packages.
|
||||
|
||||
### Build, sign, collect
|
||||
|
||||
|
|
@ -197,13 +198,18 @@ release/vm.sh pull-out 14.3 26.1 # -> /scratch/mono-opnsense/out/26.1
|
|||
becomes `<release>_<patches>`.
|
||||
3. Builds base, kernel and xtools, then this repository's kernel modules, as
|
||||
an early check against the new kernel.
|
||||
4. Builds the ports in chunks of `PORTS_CHUNK` (default 20) ports. Tools
|
||||
adds the packages it built to the packages set only when a ports step
|
||||
ends, and every run starts from that set, so a single step of several days
|
||||
would lose everything to a reboot of the build host; a chunk loses only
|
||||
itself. The list is tools' `ports.conf`, read the way tools reads it. A
|
||||
chunk in which a port fails still saves the others, then stops the build.
|
||||
A final whole ports step builds whatever the chunks missed and prunes.
|
||||
4. Builds the ports in one tools ports step over the whole list, tools'
|
||||
`ports.conf`. Tools caches the build-only dependencies it builds (cmake,
|
||||
autoconf, the Rust and Go compilers) for the rest of a step only, and the
|
||||
packages set keeps just the listed ports and their runtime dependencies.
|
||||
Splitting the list into several steps would rebuild those dependencies in
|
||||
each one. That cost was measured: a second chunk of 20 started by
|
||||
rebuilding the autotools the first chunk had already built. The set is
|
||||
written when the step ends; a reboot of the build host during it loses
|
||||
that run, and the next run starts from the previous set. A port that
|
||||
fails is recorded and the step goes on with the others, then fails at the
|
||||
end. Tools stops at the first failure only when its step is given an
|
||||
argument, and `build` gives none.
|
||||
5. The ports fetch their distfiles as they build. Some no longer download as
|
||||
recorded in the ports tree's distinfo, chiefly patches GitHub generates
|
||||
on the fly (`github.com/<owner>/<repo>/commit/<hash>.patch`): GitHub
|
||||
|
|
@ -216,11 +222,13 @@ release/vm.sh pull-out 14.3 26.1 # -> /scratch/mono-opnsense/out/26.1
|
|||
port's `checksum` target then verifies the SHA256, so only the original
|
||||
bytes are accepted. The results are appended to the distfiles set,
|
||||
which tools extracts into every ports step's chroot.
|
||||
- `ports-mgmt/pkg` is fetched this way before the first chunk: the
|
||||
- `ports-mgmt/pkg` is fetched this way before the ports step: its
|
||||
chroot builds pkg before anything else.
|
||||
- Any other port whose distfiles fail to fetch ("Couldn't fetch it" in
|
||||
the step's output, `/var/tmp/gwbuild-ports.log`) is fetched this way
|
||||
and its chunk runs once more. A distfile that still cannot be fetched
|
||||
and the ports step runs once more. It skips the packages it has
|
||||
already built, but rebuilds the build-only dependencies of the ports
|
||||
it still has to build. A distfile that still cannot be fetched
|
||||
stops the build with the port's name.
|
||||
- Tools' own `distfiles` step, which would fetch every distfile up front
|
||||
for offline rebuilds, is not run. It walks the whole dependency tree of
|
||||
|
|
|
|||
|
|
@ -135,51 +135,15 @@ host_pkg()
|
|||
fi
|
||||
}
|
||||
|
||||
# ports_list: the ports of tools' config/SERIES/ports.conf, read as tools' list_config
|
||||
# reads them: comments skipped, each origin expanded with the PRODUCT_* values tools'
|
||||
# Makefile gives its scripts, and lines dropped whose quirks name our target,
|
||||
# architecture or SSL flavour
|
||||
ports_list()
|
||||
{
|
||||
# one value per line, in this order; some may be empty
|
||||
_vals=$(${TOOLS} -V ARCH -V APACHE -V LUA -V PERL -V PHP -V PYTHON -V RUBY -V SSL)
|
||||
[ "$(echo "${_vals}" | wc -l)" -eq 8 ] || die "cannot read the PRODUCT values from tools"
|
||||
{
|
||||
read -r _arch
|
||||
read -r PRODUCT_APACHE
|
||||
read -r PRODUCT_LUA
|
||||
read -r PRODUCT_PERL
|
||||
read -r PRODUCT_PHP
|
||||
read -r PRODUCT_PYTHON
|
||||
read -r PRODUCT_RUBY
|
||||
read -r PRODUCT_SSL
|
||||
} <<EOF
|
||||
${_vals}
|
||||
EOF
|
||||
_target=${_arch%%:*}
|
||||
_arch=${_arch##*:}
|
||||
set -f
|
||||
while read -r _origin _quirks; do
|
||||
case ${_origin} in
|
||||
'' | '#'*) continue ;;
|
||||
esac
|
||||
eval "_origin=${_origin}"
|
||||
for _q in $(echo "${_quirks}" | tr ',' ' '); do
|
||||
if [ "${_q}" = "${_target}" ] || [ "${_q}" = "${_arch}" ] || [ "${_q}" = "${PRODUCT_SSL}" ]; then
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
echo "${_origin}"
|
||||
done < "/usr/tools/config/${SERIES}/ports.conf"
|
||||
set +f
|
||||
}
|
||||
|
||||
# build_ports: tools' ports step, in chunks of PORTS_CHUNK (20) ports. Tools adds
|
||||
# the packages it built to the packages set only when a ports step ends, and the
|
||||
# next run starts from that set, so one long step loses days of work to a reboot of
|
||||
# the build host; a chunk loses at most itself. A chunk with a failed port still
|
||||
# saves the others, then stops the build. A last, whole ports step builds whatever
|
||||
# the chunks missed (nothing, unless ports_list and tools disagree) and prunes.
|
||||
# build_ports: tools' ports step, over the whole ports list in one run. Tools caches
|
||||
# the build-only dependencies it builds (cmake, autoconf, the Rust and Go compilers)
|
||||
# for the rest of a run only, and keeps just the listed ports and their runtime
|
||||
# dependencies in the packages set, so splitting the list into several runs rebuilds
|
||||
# those dependencies in each one: days under emulation. The set is written when the
|
||||
# run ends; a reboot of the build host during the run loses it, and the next run
|
||||
# starts again from the previous set. A port that fails is recorded and the run goes
|
||||
# on with the others (tools stops at the first failure only when its step is given an
|
||||
# argument, which is why none is given here); the step fails at the end.
|
||||
#
|
||||
# The ports fetch their distfiles as they build. Tools' distfiles step, which would
|
||||
# fetch them all beforehand for offline rebuilds, is not run: it walks the whole
|
||||
|
|
@ -192,19 +156,8 @@ build_ports()
|
|||
# the ports step's chroot builds pkg before anything else
|
||||
step "distfiles of ports-mgmt/pkg"
|
||||
repair_distfiles ports-mgmt/pkg
|
||||
_list=$(ports_list)
|
||||
_total=$(echo "${_list}" | wc -l | tr -d ' ')
|
||||
_done=0
|
||||
echo "${_list}" | xargs -n "${PORTS_CHUNK:-20}" echo | while read -r _chunk; do
|
||||
_t0=$(date +%s)
|
||||
_done=$((_done + $(echo "${_chunk}" | wc -w)))
|
||||
step "ports ${_done}/${_total}: ${_chunk}"
|
||||
# "gwchunk" names no package: nothing is removed for a rebuild
|
||||
ports_run ports-gwchunk PORTSLIST="${_chunk}" PORTSENV="DEPEND=no PRUNE=no"
|
||||
step "ports ${_done}/${_total} took $((($(date +%s) - _t0) / 60)) minutes"
|
||||
done
|
||||
step "ports: whole list"
|
||||
ports_run ports-gwchunk
|
||||
step "ports"
|
||||
ports_run ports
|
||||
}
|
||||
|
||||
# ports_run TARGET [ARG...]: a tools ports step, its output also in PORTS_LOG. The
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue