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 BBA07158020 for ; Sun, 16 Oct 2022 19:11:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 13A69E0D10; Sun, 16 Oct 2022 19:11:02 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 pigeon.gentoo.org (Postfix) with ESMTPS id EEB86E0D10 for ; Sun, 16 Oct 2022 19:11:01 +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 065C234116E for ; Sun, 16 Oct 2022 19:11:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 63546602 for ; Sun, 16 Oct 2022 19:10:59 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1665947433.a189abfaca3603bf1c298e92eb755c117e0e7fa2.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/operations/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/operations/format.py X-VCS-Directories: src/pkgcore/operations/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: a189abfaca3603bf1c298e92eb755c117e0e7fa2 X-VCS-Branch: master Date: Sun, 16 Oct 2022 19:10:59 +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: cd228b01-cce5-40c0-ab6a-d1e763421ac1 X-Archives-Hash: 405f1456d291c6cd8a2858f0c32c3add commit: a189abfaca3603bf1c298e92eb755c117e0e7fa2 Author: Arthur Zamarin gentoo org> AuthorDate: Sun Oct 16 19:04:32 2022 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Sun Oct 16 19:10:33 2022 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=a189abfa operations.fetch: better error messages when fetching fails Improve the error messages when we have fetch failures. Till now we were always outputting the first version of the package in error, and weren't listing which distfiles failed. Now we output all failures separately, use a special FetchError exception class, and output unversioned atom in final error message. Resolves: https://github.com/pkgcore/pkgdev/issues/86 Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/operations/format.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pkgcore/operations/format.py b/src/pkgcore/operations/format.py index cdb16fdc0..d66eaf192 100644 --- a/src/pkgcore/operations/format.py +++ b/src/pkgcore/operations/format.py @@ -4,7 +4,7 @@ build operation __all__ = ( 'build_base', 'install', 'uninstall', 'replace', 'fetch_base', - 'empty_build_op', 'FailedDirectory', 'GenericBuildError', + 'empty_build_op', 'FailedDirectory', 'GenericBuildError', 'FetchError', ) import os @@ -133,8 +133,10 @@ class operations(_operations_mod.base): build_ops = self.domain.build_pkg(pkgwrap, observer, failed=True) build_ops.nofetch() build_ops.cleanup(force=True) - observer.error('failed fetching files: %s::%s', self.pkg.cpvstr, self.pkg.repo.repo_id) - raise GenericBuildError('failed fetching required distfiles') + for fetchable in failures: + observer.error('failed fetching %s', fetchable.uri) + observer.error('failed fetching files for package %s::%s', self.pkg.unversioned_atom, self.pkg.repo.repo_id) + raise FetchError(failures) self.verified_files = verified return True @@ -335,3 +337,9 @@ class GenericBuildError(BuildError): def __init__(self, err): super().__init__(f"failed build operation: {err}") self.err = str(err) + + +class FetchError(BuildError): + def __init__(self, failures): + super().__init__("failed fetching required distfiles") + self.err = str(failures)