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) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0033A158094 for ; Tue, 4 Oct 2022 08:24:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1C50DE092D; Tue, 4 Oct 2022 08:24:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F3624E092D for ; Tue, 4 Oct 2022 08:24:10 +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 21BE5340E2A for ; Tue, 4 Oct 2022 08:24:10 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5ABDB5D4 for ; Tue, 4 Oct 2022 08:24:08 +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: <1664871701.9e2ed58e4695b3030e7ab2824b690bda8ed5d180.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/ebuild/repository.py X-VCS-Directories: src/pkgcore/ebuild/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 9e2ed58e4695b3030e7ab2824b690bda8ed5d180 X-VCS-Branch: master Date: Tue, 4 Oct 2022 08:24:08 +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: b1dd2a0e-552a-46da-bf2a-c3b466650cf7 X-Archives-Hash: 5cb4c53ca5ba7d281e92ee602d4c0dd5 commit: 9e2ed58e4695b3030e7ab2824b690bda8ed5d180 Author: Arthur Zamarin gentoo org> AuthorDate: Tue Oct 4 08:21:41 2022 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Tue Oct 4 08:21:41 2022 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=9e2ed58e repository: check issues with distdir only if fetch failed Perform the checks for distdir (so we have more informative output) only if a fetch failed. As a result, if it doesn't need to fetch, it won't check the distdir. Follows: 97d53b0ca18c9581a054e930f3496768ae923b18 Resolves: https://github.com/pkgcore/pkgdev/issues/99 Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/ebuild/repository.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/pkgcore/ebuild/repository.py b/src/pkgcore/ebuild/repository.py index 47eaaea0b..3a8f20b35 100644 --- a/src/pkgcore/ebuild/repository.py +++ b/src/pkgcore/ebuild/repository.py @@ -25,7 +25,7 @@ from snakeoil.strings import pluralism from .. import fetch from ..config.hint import ConfigHint, configurable from ..log import logger -from ..operations import repo as _repo_ops +from ..operations import OperationError, repo as _repo_ops from ..package import errors as pkg_errors from ..repository import configured, errors, prototype, util from ..repository.virtual import RestrictionRepo @@ -51,16 +51,6 @@ class repo_operations(_repo_ops.operations): if distdir is None: distdir = domain.distdir - try: - os.makedirs(distdir, exist_ok=True) - except OSError as exc: - observer.error(f'failed to create distdir {distdir!r}: {exc.strerror}') - return ('failed to create distdir', ) - - if not os.access(distdir, os.W_OK): - observer.error(f'no write access to distdir: {distdir!r}') - return ('no write access to distdir', ) - ret = set() matches = self.repo.itermatch(restriction, sorter=sorted) @@ -115,9 +105,23 @@ class repo_operations(_repo_ops.operations): # fetch distfiles pkg_ops = domain.pkg_operations(pkg, observer=observer) - if not pkg_ops.fetch(list(fetchables.values()), observer, distdir=distdir): - ret.add(key) - continue + try: + if not pkg_ops.fetch(list(fetchables.values()), observer, distdir=distdir): + ret.add(key) + continue + except OperationError: + # check for special cases of fetch failures + try: + os.makedirs(distdir, exist_ok=True) + except OSError as exc: + observer.error(f'failed to create distdir {distdir!r}: {exc.strerror}') + return ('failed to create distdir', ) + + if not os.access(distdir, os.W_OK): + observer.error(f'no write access to distdir: {distdir!r}') + return ('no write access to distdir', ) + + raise # calculate checksums for fetched distfiles try: