commit: 2569a1a1d889a76af80ce24a005d54269df7d2e2 Author: Sheng Yu <syu.os <AT> protonmail <DOT> com> AuthorDate: Fri Apr 7 04:50:49 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Apr 7 09:49:11 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2569a1a1
dbapi: Catch invalid binpkg error during pkgmove Bug: https://bugs.gentoo.org/877271 Bug: https://bugs.gentoo.org/903917 Bug: https://bugs.gentoo.org/903926 Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com> Closes: https://github.com/gentoo/portage/pull/1022 Signed-off-by: Sam James <sam <AT> gentoo.org> NEWS | 3 +++ lib/portage/dbapi/__init__.py | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 506e673e1..1d05f1de2 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,9 @@ Features: for a time for compatibility. Bug fixes: +* dbapi: Handle mismatched binpkg structure during pkgmoves (bug #877271, + bug #903917, bug #903926). + * tests: util/test_shelve: fix test failure if the backend for the shelve module does not create the shelve db using the literal filename. diff --git a/lib/portage/dbapi/__init__.py b/lib/portage/dbapi/__init__.py index 366a6c170..31453d149 100644 --- a/lib/portage/dbapi/__init__.py +++ b/lib/portage/dbapi/__init__.py @@ -4,6 +4,7 @@ __all__ = ["dbapi"] import re +import warnings import portage @@ -21,7 +22,7 @@ from portage.const import MERGING_IDENTIFIER from portage import os from portage import auxdbkeys from portage.eapi import _get_eapi_attrs -from portage.exception import InvalidData +from portage.exception import InvalidBinaryPackageFormat, InvalidData from portage.localization import _ from _emerge.Package import Package @@ -410,7 +411,10 @@ class dbapi: updates_list, metadata, parent=pkg ) if metadata_updates: - aux_update(cpv, metadata_updates) + try: + aux_update(cpv, metadata_updates) + except InvalidBinaryPackageFormat as e: + warnings.warn(e) if onUpdate: onUpdate(maxval, i + 1) if onProgress:
