Files
Oleksandr ShyshatskyiandClaude Opus 5 09e1e6521f patch.sh was asking the payload questions its recipes had already answered
Four sections went. Three of them were checks: _sqlite3 by name, which
pkgs/3rdparty/python/build.sh already made; libsodium's symlink, which
pkgs/3rdparty/libsodium/build.sh already made; and an ABI walk of the whole
payload, which bin/build-packages.sh makes over every PKG_ROOT on the way into
every .ipk -- from the packaging loop rather than a build.sh, so cached trees
are re-read too.

The fourth was not a check. config.env's BUSYBOX_BIN was copied into the
payload here, which made it the one file no package owned: an allowance in the
"every file is owned" test, an ABI gate of its own because the payload-wide one
ran before the copy, and a file no `opkg remove` could take away. It is
pkgs/3rdparty/busybox now, PKG_WHEN-gated on BUSYBOX_BIN, and it needed a third
source verb -- pkg_prebuilt, beside pkg_unpack and pkg_intree -- because a
recipe names its source exactly once and this one's source is a path someone
typed. Once it was a package, nothing in the payload came from outside the
feed, which is what made the payload-wide ABI gate redundant rather than merely
duplicated.

The "at least twelve extension modules in site-packages" count was the one
check with nowhere to go and no duplicate. It is pkg_pynative in the seven
python-* recipes that ship a .so: an aggregate could say that a native package
had fallen back to a pure-python wheel but never which one, and each of those
recipes can say it about itself.

What that costs is written into the section it left: a gate inside build.sh
does not run on a cache hit, and no python recipe sets PKG_STAMP_EXTRA. That is
pkg_stamp's problem, not an argument for a second copy of every check here.

Measured: `make packages` builds anvil-busybox_1.31.1-1_mipsel_xburst2.ipk,
`make build` assembles a 32-package payload whose bin/busybox is listed in
anvil-busybox.list, and qa-static is 265 passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gKRUCqj18TVF1Vz1oMpmC
2026-08-29 15:24:20 +03:00

41 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# greenlet -- built for the printer's CPython, into its site-packages.
set -euo pipefail
. ./bin/common.sh
. pkgs/lib.sh
pkg_begin python-greenlet || exit 0
pkg_toolchain
pkg_deps
pkg_buildpython
pkg_pytarget
pkg_unpack "$(pypkg_tgz greenlet)"
# gcc 7.2 refuses greenlet 3.x's C++ designated initializers wherever they skip
# a field. The rule was probed, not assumed: in-order contiguous is fine, a
# TRAILING gap is fine, an interior or leading gap is refused.
# fill-designators.py writes the skipped fields back as explicit zeros, taking
# field order from the TARGET's own headers and refusing to guess about a
# designator that is not in them. These are objects of static storage duration,
# so every field it inserts was already zero: it changes the spelling, not the
# program. 55 fields across two files.
_g=$(pkg_pysrc greenlet)
# Deliberately unquoted: the find is a LIST of sources to patch, one argument
# each, and none of greenlet's file names has ever contained a space.
# shellcheck disable=SC2046
"$HOSTPY" tools/python-packages/fill-designators.py \
"$PKG_PYINC" \
$(find "$_g/src/greenlet" -name '*.cpp' -o -name '*.hpp' | sort) \
> "$PKG_LOG/fill-designators.log" 2>&1 \
|| pkg_die "greenlet: fill-designators.py failed -- see $PKG_WORK/fill-designators.log"
pkg_pywheel greenlet
pkg_ship "lib/python$PY_MM/site-packages"
# One is the whole package: greenlet IS _greenlet, and everything above this
# line exists because that C++ has to compile for this ABI. The default count
# rather than the three .so files actually shipped -- the other two are
# greenlet/tests/, which ride along and are nobody's dependency.
pkg_pynative
pkg_end