Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] emirrordist: Report all stat() errors instead of first one
Date: Mon, 21 Oct 2019 07:34:10
Message-Id: a8962b4e-cf05-58e5-47f3-cfd2444157a3@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] emirrordist: Report all stat() errors instead of first one by "Michał Górny"
1 On 10/20/19 2:54 AM, Michał Górny wrote:
2 > When DeletionIterator fails, report all stat() errors. Reporting
3 > just the first one results in confusing logs, suggesting that one
4 > of the location did not exist but the other existed and was removed.
5 > ---
6 > lib/portage/_emirrordist/DeletionIterator.py | 8 ++++----
7 > 1 file changed, 4 insertions(+), 4 deletions(-)
8 >
9 > diff --git a/lib/portage/_emirrordist/DeletionIterator.py b/lib/portage/_emirrordist/DeletionIterator.py
10 > index cd773b3c8..dab6eaea2 100644
11 > --- a/lib/portage/_emirrordist/DeletionIterator.py
12 > +++ b/lib/portage/_emirrordist/DeletionIterator.py
13 > @@ -25,20 +25,20 @@ class DeletionIterator(object):
14 > distfiles_set.update(layout.get_filenames(distdir))
15 > for filename in distfiles_set:
16 > # require at least one successful stat()
17 > - first_exception = None
18 > + exceptions = []
19 > for layout in reversed(self._config.layouts):
20 > try:
21 > st = os.stat(
22 > os.path.join(distdir, layout.get_path(filename)))
23 > except OSError as e:
24 > - first_exception = e
25 > + exceptions.append(e)
26 > else:
27 > if stat.S_ISREG(st.st_mode):
28 > break
29 > else:
30 > - if first_exception is not None:
31 > + if exceptions:
32 > logging.error("stat failed on '%s' in distfiles: %s\n" %
33 > - (filename, first_exception))
34 > + (filename, '; '.join(str(x) for x in exceptions)))
35 > continue
36 >
37 > if filename in file_owners:
38 >
39
40 Looks good. Please merge.
41 --
42 Thanks,
43 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature