public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/
Date: Tue,  4 Oct 2022 08:24:08 +0000 (UTC)	[thread overview]
Message-ID: <1664871701.9e2ed58e4695b3030e7ab2824b690bda8ed5d180.arthurzam@gentoo> (raw)

commit:     9e2ed58e4695b3030e7ab2824b690bda8ed5d180
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  4 08:21:41 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> 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 <arthurzam <AT> 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:


             reply	other threads:[~2022-10-04  8:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04  8:24 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-16 16:38 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/ Arthur Zamarin
2022-10-29 11:56 Arthur Zamarin
2022-11-26 11:17 Arthur Zamarin
2022-12-13 19:58 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-25 17:40 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2023-01-03 18:06 Arthur Zamarin
2023-01-17 20:50 Arthur Zamarin
2023-02-04 19:52 Arthur Zamarin
2023-06-30 20:08 Arthur Zamarin
2023-10-23 17:35 Arthur Zamarin
2023-12-26 17:45 Arthur Zamarin
2024-06-13 16:40 Arthur Zamarin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1664871701.9e2ed58e4695b3030e7ab2824b690bda8ed5d180.arthurzam@gentoo \
    --to=arthurzam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox