commit:     fbd6909c24f51ad79fb313ddd7043b4a40de91a6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 26 21:37:24 2023 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Dec 26 22:01:51 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fbd6909c

Scheduler: Handle unpack_metadata SignatureException in _run_pkg_pretend

This will handle the InvalidSignature exception that triggered
bug 920258, allowing emerge --keep-going to skip the package
if possible. All of the gpg stderr output is dumped before the
exception is raised, as shown in bug 920258 comment #0.

Bug: https://bugs.gentoo.org/920258
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/_emerge/Scheduler.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/_emerge/Scheduler.py b/lib/_emerge/Scheduler.py
index 4193ffdd03..620d513511 100644
--- a/lib/_emerge/Scheduler.py
+++ b/lib/_emerge/Scheduler.py
@@ -992,7 +992,16 @@ class Scheduler(PollScheduler):
 
                     infloc = os.path.join(build_dir_path, "build-info")
                     ensure_dirs(infloc)
-                    await bintree.dbapi.unpack_metadata(settings, infloc, 
loop=loop)
+                    try:
+                        await bintree.dbapi.unpack_metadata(settings, infloc, 
loop=loop)
+                    except portage.exception.SignatureException as e:
+                        writemsg(
+                            f"!!! Invalid binary package: 
'{bintree.getname(x.cpv)}', {e}\n",
+                            noiselevel=-1,
+                        )
+                        failures += 1
+                        self._record_pkg_failure(x, settings, 1)
+                        continue
                     ebuild_path = os.path.join(infloc, x.pf + ".ebuild")
                     settings.configdict["pkg"]["EMERGE_FROM"] = "binary"
                     settings.configdict["pkg"]["MERGE_TYPE"] = "binary"

Reply via email to