Files
gentoo-zh/scripts/needs-perl-update.sh
T
Zakk 2c552a6c56 scripts/needs-perl-update.sh: update perl when the binhost index fails
When emerge --pretend cannot fetch a binhost index, it resolves the
target against ebuilds only. The perl modules then stay on the
installed perl, the output names no dev-lang/perl, and the script
reports that no update is needed. The later `emerge --onlydeps` fetches
the index, pulls dev-lang/perl 5.44 binpkgs against the stage3's perl
5.42 and fails with a slot conflict.

That happened to =app-text/imewlconverter-9999 on amd64-desktop-openrc
in run 37817036593: its `emerge --onlydeps` step printed no "[gentoo]
Local copy of remote index is within TTL" line, while the other jobs of
the same run did, and the systemd job of the same atom updated perl.

Exit 0 when the output reports "Error fetching binhost package info",
so an unknown answer costs a perl update instead of a failed job.

Signed-off-by: Zakk <zakk@gentoozh.org>
2026-10-09 05:28:13 +11:00

12 lines
687 B
Bash
Executable File

#!/usr/bin/env bash
# usage: needs-perl-update.sh <atom>; exit 0 if the atom's binpkg dependencies would replace dev-lang/perl.
atom=${1:?atom}
# A masked package never reports its dependencies, so accept every license and
# unmask the keywords, which a live ebuild without KEYWORDS needs.
output=$(ACCEPT_KEYWORDS="~$(portageq envvar ARCH)" ACCEPT_LICENSE="*" FEATURES="getbinpkg" \
emerge --pretend --quiet --onlydeps --autounmask=y --autounmask-continue=y "${atom}" 2>&1)
# Without a binhost index the list shows no binpkgs, so it cannot tell; update perl to be safe.
grep -q 'Error fetching binhost package info' <<<"${output}" && exit 0
grep -q 'dev-lang/perl[-:]' <<<"${output}"