From c80fd324b0ab7cafb11847dff2d6c7b23ade2997 Mon Sep 17 00:00:00 2001 From: Sam James Date: Wed, 8 Jun 2022 23:29:21 +0100 Subject: sys-libs/glibc: fix linux-headers check The comment in the ebuild tries to say it all, but the gist is that because the environment (which includes installed packages and their versions!) isn't (necessarily) consistent b/t pkg_pretend and pkg_setup, and pkg_pretend is run before any packages are merged at all, if one has an old linux-headers installed, and a new linux-headers is queued to upgrade before glibc, the emerge will still die in pkg_pretend b/c it's run before the new linux-headers (or indeed anything) gets merged. Signed-off-by: Sam James --- sys-libs/glibc/glibc-9999.ebuild | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'sys-libs') diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild index 8c330f867cbc..2a030e2f9928 100644 --- a/sys-libs/glibc/glibc-9999.ebuild +++ b/sys-libs/glibc/glibc-9999.ebuild @@ -785,11 +785,19 @@ sanity_prechecks() { fi fi - ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" - if ! eend_KV ${build_kv} ${want_kv} ; then - echo - eerror "You need linux-headers of at least ${want_kv}!" - die "linux-headers version too low!" + # Do not run this check for pkg_pretend, just pkg_setup and friends (if we ever get used there). + # It's plausible (seen it in the wild) that Portage will (correctly) schedule a linux-headers + # upgrade before glibc, but because pkg_pretend gets run before any packages are merged at all (not + # just glibc), the whole emerge gets aborted without a good reason. We probably don't + # need to run this check at all given we have a dependency on the right headers, + # but let's leave it as-is for now. + if [[ ${EBUILD_PHASE_FUNC} != pkg_pretend ]] ; then + ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" + if ! eend_KV ${build_kv} ${want_kv} ; then + echo + eerror "You need linux-headers of at least ${want_kv}!" + die "linux-headers version too low!" + fi fi fi fi -- cgit v1.2.3-65-gdbad