From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CB3F3158041 for ; Thu, 28 Mar 2024 14:48:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A894E2A54; Thu, 28 Mar 2024 14:48:41 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 03461E2A54 for ; Thu, 28 Mar 2024 14:48:41 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4C74934301F for ; Thu, 28 Mar 2024 14:48:40 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AF30415F4 for ; Thu, 28 Mar 2024 14:48:38 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1711637269.08a2bc3800ea2e997716903244ec041339b45b06.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/BinpkgPrefetcher.py X-VCS-Directories: lib/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 08a2bc3800ea2e997716903244ec041339b45b06 X-VCS-Branch: master Date: Thu, 28 Mar 2024 14:48:38 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: de30e26c-3fcb-4389-9723-045f2f247246 X-Archives-Hash: 683e665c4746dacb601b8f65eb80a60b commit: 08a2bc3800ea2e997716903244ec041339b45b06 Author: Zac Medico gentoo org> AuthorDate: Sun Mar 24 22:11:54 2024 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu Mar 28 14:47:49 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=08a2bc38 BinpkgPrefetcher: Emit eerror message for binarytree inject failure Since it is confusing when emerge exits due to an error that only shows in the fetch log, emit an eerror message when binarytree inject fails: >>> Running pre-merge checks for sys-libs/glibc-2.38-r10 * Fetching in the background: * /var/cache/binpkgs/sys-libs/glibc/glibc-2.38-r10-5.gpkg.tar.partial * To view fetch progress, run in another terminal: * tail -f /var/log/emerge-fetch.log >>> Failed to emerge sys-libs/glibc-2.38-r10 * Messages for package sys-libs/glibc-2.38-r10: * Binary package is not usable: * !!! * gpg: keyblock resource '/etc/portage/gnupg/pubring.kbx': No such file or directory * [GNUPG:] ERROR add_keyblock_resource 33587281 * [GNUPG:] PLAINTEXT 74 0 * [GNUPG:] NEWSIG * gpg: Signature made Wed 20 Mar 2024 10:34:45 PM CET * gpg: using RSA key 534E4209AB49EEE1C19D96162C44695DB9F6043D * [GNUPG:] ERROR keydb_search 33554445 * [GNUPG:] ERROR keydb_search 33554445 * [GNUPG:] ERRSIG 2C44695DB9F6043D 1 10 01 1710970485 9 534E4209AB49EEE1C19D96162C44695DB9F6043D * [GNUPG:] NO_PUBKEY 2C44695DB9F6043D * !!! Invalid binary package: '/var/cache/binpkgs/sys-devel/binutils/binutils-2.41-r5-4.gpkg.tar.partial', GPG verify failed Fixes: 0ff49114cec7 ("binarytree: Handle inject failures") Bug: https://bugs.gentoo.org/927632 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/BinpkgPrefetcher.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/lib/_emerge/BinpkgPrefetcher.py b/lib/_emerge/BinpkgPrefetcher.py index ed68d2852c..a8af30ca80 100644 --- a/lib/_emerge/BinpkgPrefetcher.py +++ b/lib/_emerge/BinpkgPrefetcher.py @@ -7,7 +7,10 @@ import sys from _emerge.BinpkgFetcher import BinpkgFetcher from _emerge.CompositeTask import CompositeTask from _emerge.BinpkgVerifier import BinpkgVerifier +import portage from portage import os +from portage.elog import messages as elog_messages +from portage.util import no_color class BinpkgPrefetcher(CompositeTask): @@ -48,6 +51,7 @@ class BinpkgPrefetcher(CompositeTask): self.wait() return + injected_pkg = None stdout_orig = sys.stdout stderr_orig = sys.stderr out = io.StringIO() @@ -67,12 +71,33 @@ class BinpkgPrefetcher(CompositeTask): output_value = out.getvalue() if output_value: - self.scheduler.output( - output_value, - log_path=self.scheduler.fetch.log_file, - background=self.background, - ) + if injected_pkg is None: + msg = ["Binary package is not usable:"] + msg.extend("\t" + line for line in output_value.splitlines()) + self._elog("eerror", msg) + else: + self.scheduler.output( + output_value, + log_path=self.scheduler.fetch.log_file, + background=self.background, + ) self._current_task = None self.returncode = 1 if injected_pkg is None else os.EX_OK self.wait() + + def _elog(self, elog_funcname, lines, phase="other"): + out = io.StringIO() + elog_func = getattr(elog_messages, elog_funcname) + global_havecolor = portage.output.havecolor + try: + portage.output.havecolor = not no_color(self._bintree.settings) + for line in lines: + elog_func(line, phase=phase, key=self.pkg.cpv, out=out) + finally: + portage.output.havecolor = global_havecolor + msg = out.getvalue() + if msg: + self.scheduler.output( + msg, background=self.background, log_path=self.scheduler.fetch.log_file + )