Files
gentoo-zh/scripts/needs-cpu-flags.sh
T
Zakk 6fced8485a .github/workflows: give CPU flags only to packages that need them
emerge-on-pr and tatt gave the runner's CPU flags to every target, and autobump and
autobump-trial to every package through */*. A package with optional flags, such as
dev-util/opencode-bin or sci-ml/llama-cpp, was then tested only in its runner
variant, never in the baseline one most of its users get, and in autobump a
dependency with such flags would no longer match the binhost's USE and would be
built from source.

Each workflow now tries the package with the baseline flags first and writes the
runner's flags only when its REQUIRED_USE is unsatisfied, as for dev-util/hunk-bin
and dev-util/oh-my-pi-bin. The check accepts all keywords and licenses, because a
masked package does not report its REQUIRED_USE.
The four workflows share the check in scripts/needs-cpu-flags.sh.

Signed-off-by: Zakk <zakk@gentoozh.org>
2026-10-01 15:54:24 +10:00

11 lines
496 B
Bash
Executable File

#!/usr/bin/env bash
# needs-cpu-flags.sh - does a package need more CPU flags than the profile's baseline?
# usage: needs-cpu-flags.sh <atom>
# exit 0 when its REQUIRED_USE is unsatisfied with the baseline flags, 1 otherwise.
# A masked package never reports its REQUIRED_USE, so every keyword and license is accepted.
atom=${1:?atom}
output=$(ACCEPT_KEYWORDS="~$(portageq envvar ARCH)" ACCEPT_LICENSE="*" \
emerge --pretend --quiet --nodeps "${atom}" 2>&1)
grep -q REQUIRED_USE <<<"${output}"